widgets: move to a more flexible widget default props structure
This commit is contained in:
parent
cb289fb795
commit
0fb49a6779
39 changed files with 822 additions and 1567 deletions
|
|
@ -39,7 +39,7 @@ class Editor {
|
|||
if ((propName === 'label' || propName === 'popupLabel') && value === true) {
|
||||
w.props[propName] = 'auto'
|
||||
} else {
|
||||
w.props[propName] = value !== '' ? value : deepCopy(defaults[w.props.type][propName].value)
|
||||
w.props[propName] = value !== '' ? value : deepCopy(defaults[w.props.type]._props()[propName])
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class UiInspector extends UiWidget {
|
|||
|
||||
this.mounted = false
|
||||
|
||||
this.expandedCategories = ['_widget']
|
||||
this.expandedCategories = ['widget']
|
||||
|
||||
this.widget = null
|
||||
|
||||
|
|
@ -114,65 +114,52 @@ class UiInspector extends UiWidget {
|
|||
|
||||
this.widget = widget
|
||||
|
||||
let category
|
||||
for (let categoryName in props) {
|
||||
|
||||
for (let propName in props) {
|
||||
if (categoryName === 'children') continue
|
||||
|
||||
if (propName === '_children' || propName === 'tabs' || propName === 'widgets' || propName === '_props') continue
|
||||
let category = html`<osc-inspector-category class="${this.expandedCategories.indexOf(categoryName) > -1 ? 'expanded' : ''}"></osc-inspector-category>`,
|
||||
categoryLabel = categoryName === 'class_specific' ? widget.props.type : categoryName
|
||||
|
||||
let field,
|
||||
shared = true
|
||||
category.appendChild(html`
|
||||
<div class="category-header" data-name="${categoryName}">${categoryLabel}${categoryName === 'widget' && widgets.length > 1 ? `s (${widgets.length})` : ''}</div>
|
||||
`)
|
||||
|
||||
for (var w of widgets) {
|
||||
if (defaults[w.props.type][propName] === undefined) {
|
||||
shared = false
|
||||
let notEmpty
|
||||
|
||||
for (let propName in props[categoryName]) {
|
||||
|
||||
// skip if property is not shared between selected widgets
|
||||
if (widgets.some((w)=>{
|
||||
for (let c in defaults[w.props.type]) {
|
||||
if (!defaults[w.props.type][c].hasOwnProperty(propName)) return false
|
||||
}
|
||||
})) continue
|
||||
|
||||
let field = propName.includes('_separator') ?
|
||||
html`<div class="separator">${props[categoryName][propName]}</div>` :
|
||||
new UiInspectorField({
|
||||
parent: this,
|
||||
widget: widget,
|
||||
name: propName,
|
||||
value: widget.props[propName],
|
||||
default: defaults[widget.props.type][categoryName][propName],
|
||||
tabIndex: tabIndex++
|
||||
}).container
|
||||
|
||||
if (field) {
|
||||
category.appendChild(field)
|
||||
notEmpty = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!shared) continue
|
||||
|
||||
|
||||
if (propName.indexOf('_separator') > -1) {
|
||||
|
||||
field = html`<div class="separator">${props[propName]}</div>`
|
||||
|
||||
} else if (propName.indexOf('_') === 0) {
|
||||
|
||||
if (category) content.appendChild(category)
|
||||
|
||||
category = html`<osc-inspector-category class="${this.expandedCategories.indexOf(propName) > -1 ? 'expanded' : ''}"></osc-inspector-category>`
|
||||
|
||||
field = html`<div class="category-header" data-name="${propName}">${props[propName]}${propName === '_widget' && widgets.length > 1 ? `s (${widgets.length})` : ''}</div>`
|
||||
|
||||
} else if (widget.props[propName] === undefined) {
|
||||
|
||||
continue
|
||||
|
||||
} else {
|
||||
|
||||
field = new UiInspectorField({
|
||||
parent: this,
|
||||
widget: widget,
|
||||
name: propName,
|
||||
value: widget.props[propName],
|
||||
default: defaults[w.props.type][propName],
|
||||
tabIndex: tabIndex++
|
||||
}).container
|
||||
|
||||
if (!field) continue
|
||||
|
||||
}
|
||||
if (category) {
|
||||
category.appendChild(field)
|
||||
} else {
|
||||
content.appendChild(field)
|
||||
}
|
||||
|
||||
if (notEmpty) {
|
||||
content.appendChild(category)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (category) content.appendChild(category)
|
||||
|
||||
this.lock = true
|
||||
|
||||
if (this.mounted) {
|
||||
|
|
|
|||
|
|
@ -14,36 +14,37 @@ class Button extends Widget {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
return super.defaults(Button).extend({
|
||||
style: {
|
||||
_separator_button_style: 'Button style',
|
||||
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
|
||||
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 (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`',
|
||||
]},
|
||||
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.',
|
||||
]},
|
||||
},
|
||||
class_specific: {
|
||||
on: {type: '*', value: 1, help: [
|
||||
'Set to `null` to send send no argument in the osc message',
|
||||
]},
|
||||
off: {type: '*', value: 0, help: [
|
||||
'Set to `null` to send send no argument in the osc message. Must be different from `on`.',
|
||||
]},
|
||||
mode: {type: 'string', value: 'toggle', choices: ['toggle', 'push', 'tap'], help: [
|
||||
'Interraction mode:',
|
||||
'- `toggle` (classic on/off switch)',
|
||||
'- `push` (press & release)',
|
||||
'- `tap` (no release)'
|
||||
]},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'},
|
||||
|
||||
|
||||
_class_specific: 'button',
|
||||
|
||||
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 (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`',
|
||||
]},
|
||||
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.',
|
||||
]},
|
||||
on: {type: '*', value: 1, help: [
|
||||
'Set to `null` to send send no argument in the osc message',
|
||||
]},
|
||||
off: {type: '*', value: 0, help: [
|
||||
'Set to `null` to send send no argument in the osc message. Must be different from `on`.',
|
||||
]},
|
||||
mode: {type: 'string', value: 'toggle', choices: ['toggle', 'push', 'tap'], help: [
|
||||
'Interraction mode:',
|
||||
'- `toggle` (classic on/off switch)',
|
||||
'- `push` (press & release)',
|
||||
'- `tap` (no release)'
|
||||
]},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the button require a double tap to be pushed instead of a single tap'},
|
||||
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
|
||||
|
||||
}, [], {}, Button)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,16 +13,17 @@ class Dropdown extends MenuBase {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'dropdown',
|
||||
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
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',
|
||||
]}
|
||||
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
_separator_dropdown_style: 'Dropdown style',
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
},
|
||||
class_specific: {
|
||||
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',
|
||||
]}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,16 +12,17 @@ module.exports = class File extends Widget {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'file',
|
||||
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
directory: {type: 'string', value: 'auto', help: 'Default browsing directory'},
|
||||
extension: {type: 'string', value: '*', help: 'Only display files with this extension'},
|
||||
hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'},
|
||||
allowDir: {type: 'boolean', value: false, help: 'Allow selecting a folder (by pressing "open" when no file is selected)'}
|
||||
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
_separator_file_style: 'File style',
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
hidePath: {type: 'boolean', value: false, help: 'Set to `true` to only display the filename (the whole path will still be used as value)'},
|
||||
},
|
||||
class_specific: {
|
||||
directory: {type: 'string', value: 'auto', help: 'Default browsing directory'},
|
||||
extension: {type: 'string', value: '*', help: 'Only display files with this extension'},
|
||||
allowDir: {type: 'boolean', value: false, help: 'Allow selecting a folder (by pressing "open" when no file is selected)'}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,15 @@ class Input extends Canvas {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'input',
|
||||
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], 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)'},
|
||||
asYouType: {type: 'boolean', value: false, help: 'Set to `true` to make the input send its value at each keystroke'}
|
||||
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
_separator_input_style: 'Input style',
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], 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)'},
|
||||
},
|
||||
class_specific: {
|
||||
asYouType: {type: 'boolean', value: false, help: 'Set to `true` to make the input send its value at each keystroke'}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,32 +14,36 @@ class Menu extends MenuBase {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'menu',
|
||||
|
||||
size: {type: 'number|array', value: 200, help: [
|
||||
'- If `layout` is `circular`: diameter (in px)',
|
||||
'- Else: square size or `[width, height]` array',
|
||||
]},
|
||||
textAlign: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
menuAlignV: {type: 'string', value: 'center', choices: ['center', 'top', 'bottom'], help: 'Set to `top` or `bottom` to change menu alignment (otherwise center)'},
|
||||
menuAlignH: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change menu alignment (otherwise center)'},
|
||||
layout: {type: 'string', value: 'circular', choices: ['circular', 'horizontal', 'vertical', 'grid'], help: [
|
||||
'Defines whether the menu\'s layout should be rendered in a circle or in a box'
|
||||
]},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
toggle: {type: 'boolean', value: false, help: 'Set to `true` to make the menu stay opened after mouse/touch release'},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the menu require a double tap to be opened instead of a single tap'},
|
||||
values: {type: 'array|object', value: [1, 2, 3], 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',
|
||||
]},
|
||||
weights: {type: 'array', value: '', help: [
|
||||
'`Array` of `number` defining the weights of each value in `values`',
|
||||
'Ignored when `mode` is `grid`'
|
||||
]},
|
||||
|
||||
return super.defaults().extend({
|
||||
geometry: {
|
||||
_separator_menu_geometry: 'Menu geometry',
|
||||
size: {type: 'number|array', value: 200, help: [
|
||||
'- If `layout` is `circular`: diameter (in px)',
|
||||
'- Else: square size or `[width, height]` array',
|
||||
]},
|
||||
},
|
||||
style: {
|
||||
_separator_menu_style: 'Menu style',
|
||||
textAlign: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
|
||||
menuAlignV: {type: 'string', value: 'center', choices: ['center', 'top', 'bottom'], help: 'Set to `top` or `bottom` to change menu alignment (otherwise center)'},
|
||||
menuAlignH: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Set to `left` or `right` to change menu alignment (otherwise center)'},
|
||||
layout: {type: 'string', value: 'circular', choices: ['circular', 'horizontal', 'vertical', 'grid'], help: [
|
||||
'Defines whether the menu\'s layout should be rendered in a circle or in a box'
|
||||
]},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
},
|
||||
class_specific: {
|
||||
toggle: {type: 'boolean', value: false, help: 'Set to `true` to make the menu stay opened after mouse/touch release'},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the menu require a double tap to be opened instead of a single tap'},
|
||||
values: {type: 'array|object', value: [1, 2, 3], 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',
|
||||
]},
|
||||
weights: {type: 'array', value: '', help: [
|
||||
'`Array` of `number` defining the weights of each value in `values`',
|
||||
'Ignored when `mode` is `grid`'
|
||||
]},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,25 +13,26 @@ class Switch extends MenuBase {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'switch',
|
||||
|
||||
layout: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
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',
|
||||
]},
|
||||
mode: {type: 'string', value: 'tap', choices: ['tap', 'slide', 'click'], help: [
|
||||
'Interraction mode:',
|
||||
'- `tap`: activates when the pointer is down but prevents further scrolling',
|
||||
'- `slide`: same as `tap` but allows sliding between values',
|
||||
'- `click`: activates upon click only and allows further scrolling',
|
||||
]},
|
||||
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
|
||||
|
||||
}, [], {}, Switch)
|
||||
return super.defaults(Switch).extend({
|
||||
style: {
|
||||
_separator_switch_style: 'Switch style',
|
||||
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
|
||||
layout: {type: 'string', value: 'vertical', choices: ['vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
},
|
||||
class_specific: {
|
||||
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',
|
||||
]},
|
||||
mode: {type: 'string', value: 'tap', choices: ['tap', 'slide', 'click'], help: [
|
||||
'Interraction mode:',
|
||||
'- `tap`: activates when the pointer is down but prevents further scrolling',
|
||||
'- `slide`: same as `tap` but allows sliding between values',
|
||||
'- `click`: activates upon click only and allows further scrolling',
|
||||
]},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ class Switch extends MenuBase {
|
|||
|
||||
super.setCssVariables()
|
||||
|
||||
this.container.classList.toggle('padding-0', this.getProp('padding') === -1)
|
||||
this.container.classList.toggle('padding-0', this.getProp('padding') === -1)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,124 +43,117 @@ class Widget extends EventEmitter {
|
|||
|
||||
}
|
||||
|
||||
static defaults(insert={}, except=[], push={}, Class=Widget) {
|
||||
static defaults(Class=Widget) {
|
||||
|
||||
var defaults = {
|
||||
widget: {
|
||||
type: {type: 'string', value: 'auto', help: 'Widget type'},
|
||||
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.' },
|
||||
visible: {type: 'boolean', value: true, help: 'Set to `false` to hide the widget.'},
|
||||
interaction: {type: 'boolean', value: true, help: 'Set to `false` to disable pointer interactions.'},
|
||||
},
|
||||
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: 'Widget width'},
|
||||
height: {type: 'number|percentage', value: 'auto', help: 'Widget height'},
|
||||
expand: {type: 'boolean|number', value: 'false', help: 'If parent\'s layout is `vertical` or `horizontal`, set this to `true` to stretch the widget to use available space automatically.'},
|
||||
},
|
||||
style: {
|
||||
colorText: {type: 'string', value: 'auto', help: 'Text color. Set to "auto" to inherit from parent widget.'},
|
||||
colorWidget: {type: 'string', value: 'auto', help: 'Widget\'s default accent color. Set to "auto" to inherit from parent widget.'},
|
||||
colorStroke: {type: 'string', value: 'auto', help: 'Stroke color. Set to "auto" to use `colorWidget`.'},
|
||||
colorFill: {type: 'string', value: 'auto', help: 'Fill color. Set to "auto" to use `colorWidget`.'},
|
||||
alphaStroke: {type: 'number', value: 'auto', help: 'Stroke color opacity.'},
|
||||
alphaFillOff: {type: 'number', value: 'auto', help: 'Fill color opacity (off).'},
|
||||
alphaFillOn: {type: 'number', value: 'auto', help: 'Fill color opacity (on).'},
|
||||
lineWidth: {type: 'number', value: 'auto', help: 'Stroke width.'},
|
||||
padding: {type: 'number', value: 'auto', help: 'Inner spacing.'},
|
||||
css: {type: 'string', value: '', help: [
|
||||
'CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.',
|
||||
'Available css variables:',
|
||||
...Class.cssVariables.map(x=>'- `' + x.css + '`: `' + x.js + '`')
|
||||
]},
|
||||
},
|
||||
class_specific: {
|
||||
|
||||
_widget: 'widget',
|
||||
|
||||
type: {type: 'string', value: 'auto', help: 'Widget type'},
|
||||
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.' },
|
||||
visible: {type: 'boolean', value: true, help: 'Set to `false` to hide the widget.'},
|
||||
interaction: {type: 'boolean', value: true, help: 'Set to `false` to disable pointer interactions.'},
|
||||
|
||||
_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: 'Widget width'},
|
||||
height: {type: 'number|percentage', value: 'auto', help: 'Widget height'},
|
||||
expand: {type: 'boolean|number', value: 'false', help: 'If parent\'s layout is `vertical` or `horizontal`, set this to `true` to stretch the widget to use available space automatically.'},
|
||||
|
||||
_style: 'style',
|
||||
|
||||
|
||||
colorText: {type: 'string', value: 'auto', help: 'Text color. Set to "auto" to inherit from parent widget.'},
|
||||
colorWidget: {type: 'string', value: 'auto', help: 'Widget\'s default accent color. Set to "auto" to inherit from parent widget.'},
|
||||
colorStroke: {type: 'string', value: 'auto', help: 'Stroke color. Set to "auto" to use `colorWidget`.'},
|
||||
colorFill: {type: 'string', value: 'auto', help: 'Fill color. Set to "auto" to use `colorWidget`.'},
|
||||
alphaStroke: {type: 'number', value: 'auto', help: 'Stroke color opacity.'},
|
||||
alphaFillOff: {type: 'number', value: 'auto', help: 'Fill color opacity (off).'},
|
||||
alphaFillOn: {type: 'number', value: 'auto', help: 'Fill color opacity (on).'},
|
||||
|
||||
lineWidth: {type: 'number', value: 'auto', help: 'Stroke width.'},
|
||||
padding: {type: 'number', value: 'auto', help: 'Inner spacing.'},
|
||||
|
||||
|
||||
|
||||
css: {type: 'string', value: '', help: [
|
||||
'CSS rules. See <a href="https://openstagecontrol.ammd.net/docs/customization/css-tips/">documentation</a>.',
|
||||
'Available css variables:',
|
||||
...Class.cssVariables.map(x=>'- `' + x.css + '`: `' + x.js + '`')
|
||||
]},
|
||||
|
||||
_value: 'value',
|
||||
|
||||
value: {type: '*', value: '', help: 'Define the widget\'s value depending on other widget\'s values / properties using the advanced property syntax'},
|
||||
default: {type: '*', value: '', help: 'If set, the widget will be initialized with this value when the session is loaded.'},
|
||||
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)'
|
||||
]},
|
||||
script: {type: 'script', value: '', help: 'Script executed whenever the widget\'s value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.'},
|
||||
|
||||
_osc: 'osc',
|
||||
|
||||
address: {type: 'string', value: 'auto', help: [
|
||||
'OSC address for sending / receiving messages, it must start with a slash (`/`)',
|
||||
'By default ("auto"), the widget\'s id is used: `/widget_id`',
|
||||
]},
|
||||
preArgs: {type: '*|array', value: '', help: [
|
||||
'A value or array of values that will be prepended to the OSC messages.',
|
||||
]},
|
||||
typeTags: {type: 'string', value: '', help: [
|
||||
'Defines the osc argument types, one letter per argument (including preArgs)',
|
||||
'- If empty, the types are infered automatically from the values (with numbers casted to floats by default)',
|
||||
'- If there are more arguments than type letters, the last type is used for the extra arguments',
|
||||
'See http://opensoundcontrol.org/spec-1_0 for existing typetags'
|
||||
]},
|
||||
decimals: {type: 'integer', value: 2, help: [
|
||||
'Defines the number of decimals to send.',
|
||||
]},
|
||||
target: {type: 'string|array|null', value: '', help: [
|
||||
'This defines the targets of the widget\'s OSC messages',
|
||||
'- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:port"]`',
|
||||
'- If midi is enabled, targets can be `midi:device_name`',
|
||||
'- If no target is set, messages can still be sent if the server has default targets',
|
||||
]},
|
||||
ignoreDefaults: {type: 'boolean', value: false, help: 'Set to `true` to ignore the server\'s default targets'},
|
||||
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]
|
||||
}
|
||||
},
|
||||
value: {
|
||||
value: {type: '*', value: '', help: 'Define the widget\'s value depending on other widget\'s values / properties using the advanced property syntax'},
|
||||
default: {type: '*', value: '', help: 'If set, the widget will be initialized with this value when the session is loaded.'},
|
||||
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)'
|
||||
]},
|
||||
script: {type: 'script', value: '', help: 'Script executed whenever the widget\'s value updates. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.'},
|
||||
},
|
||||
osc: {
|
||||
address: {type: 'string', value: 'auto', help: [
|
||||
'OSC address for sending / receiving messages, it must start with a slash (`/`)',
|
||||
'By default ("auto"), the widget\'s id is used: `/widget_id`',
|
||||
]},
|
||||
preArgs: {type: '*|array', value: '', help: [
|
||||
'A value or array of values that will be prepended to the OSC messages.',
|
||||
]},
|
||||
typeTags: {type: 'string', value: '', help: [
|
||||
'Defines the osc argument types, one letter per argument (including preArgs)',
|
||||
'- If empty, the types are infered automatically from the values (with numbers casted to floats by default)',
|
||||
'- If there are more arguments than type letters, the last type is used for the extra arguments',
|
||||
'See http://opensoundcontrol.org/spec-1_0 for existing typetags'
|
||||
]},
|
||||
decimals: {type: 'integer', value: 2, help: [
|
||||
'Defines the number of decimals to send.',
|
||||
]},
|
||||
target: {type: 'string|array|null', value: '', help: [
|
||||
'This defines the targets of the widget\'s OSC messages',
|
||||
'- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:port"]`',
|
||||
'- If midi is enabled, targets can be `midi:device_name`',
|
||||
'- If no target is set, messages can still be sent if the server has default targets',
|
||||
]},
|
||||
ignoreDefaults: {type: 'boolean', value: false, help: 'Set to `true` to ignore the server\'s default targets'},
|
||||
bypass: {type: 'boolean', value: false, help: 'Set to `true` to prevent the widget from sending any osc message'}
|
||||
}
|
||||
if (except.indexOf(k) < 0) alterDefaults[k] = defaults[k]
|
||||
}
|
||||
|
||||
for (var m in push) {
|
||||
if (!alterDefaults[m]) alterDefaults[m] = []
|
||||
if (typeof push[m] === 'string') alterDefaults[m] = push[m]
|
||||
else Object.assign(alterDefaults[m], push[m])
|
||||
}
|
||||
|
||||
alterDefaults._props = function() {
|
||||
var props = {}
|
||||
for (var k in this) {
|
||||
if (k[0] !== '_') {
|
||||
props[k] = this[k].value
|
||||
Object.defineProperty(defaults, '_props', {
|
||||
enumerable: false,
|
||||
value: function(){
|
||||
let props = {}
|
||||
for (let category in this) {
|
||||
for (let k in this[category]) {
|
||||
if (k[0] === '_') continue
|
||||
props[k] = this[category][k].value
|
||||
}
|
||||
}
|
||||
return props
|
||||
}
|
||||
return props
|
||||
}
|
||||
})
|
||||
|
||||
Object.defineProperty(defaults, 'extend', {
|
||||
enumerable: false,
|
||||
value: function(obj){
|
||||
for (let i in obj) {
|
||||
if (obj[i] === null) delete this[i]
|
||||
else {
|
||||
if (this[i] === undefined) this[i] = {}
|
||||
Object.assign(this[i], obj[i])
|
||||
for (let j in obj[i]) {
|
||||
if (obj[i][j] === null) delete this[i][j]
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
})
|
||||
|
||||
return alterDefaults
|
||||
return defaults
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,19 +18,19 @@ class Clone extends Container() {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
var defaults = super.defaults().extend({
|
||||
|
||||
_class_specific: 'clone',
|
||||
class_specific: {
|
||||
widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'},
|
||||
props: {type: 'object', value: {}, help: 'Cloned widget\'s properties to override'},
|
||||
},
|
||||
value: null,
|
||||
osc: null
|
||||
})
|
||||
|
||||
defaults.style = {css: defaults.style.css}
|
||||
|
||||
widgetId: {type: 'string', value: '', help: '`id` of the widget to clone'},
|
||||
props: {type: 'object', value: {}, help: 'Cloned widget\'s properties to override'},
|
||||
|
||||
}, [
|
||||
'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn', 'padding', 'lineWidth',
|
||||
'label', 'color',
|
||||
'_value', 'default', 'value', 'script', 'linkId',
|
||||
'_osc', 'decimals', 'address', 'preArgs', 'typeTags', 'target', 'ignoreDefaults', 'bypass'
|
||||
])
|
||||
return defaults
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ var Panel = require('./panel'),
|
|||
parser = require('../../parser')
|
||||
|
||||
|
||||
module.exports = class Keyboard extends Panel {
|
||||
class Keyboard extends Panel {
|
||||
|
||||
static description() {
|
||||
|
||||
|
|
@ -13,39 +13,34 @@ module.exports = class Keyboard extends Panel {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
_class_specific: 'keyboard',
|
||||
|
||||
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)'
|
||||
]},
|
||||
mode: {type: 'string', value: 'push', choices: ['push', 'toggle', 'tap'], help: [
|
||||
'Interraction mode:',
|
||||
'- `push` (press & release)',
|
||||
'- `toggle` (on/off switches)',
|
||||
'- `tap` (no release)'
|
||||
]},
|
||||
|
||||
}, [], {
|
||||
|
||||
css: {type: 'string', value: '', help: [
|
||||
'Available CSS variables:',
|
||||
'- `--color-white:color;` (white keys color)',
|
||||
'- `--color-black:color;` (black keys color)'
|
||||
]}
|
||||
|
||||
return Widget.defaults().extend({
|
||||
style: {
|
||||
_separator_keyboard_style: 'Keyboard style',
|
||||
colorWhite: {type: 'string', value: 'auto', help: 'White keys color.'},
|
||||
colorBlack: {type: 'string', value: 'auto', help: 'Black keys color.'},
|
||||
},
|
||||
class_specific: {
|
||||
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)'
|
||||
]},
|
||||
mode: {type: 'string', value: 'push', choices: ['push', 'toggle', 'tap'], help: [
|
||||
'Interraction mode:',
|
||||
'- `push` (press & release)',
|
||||
'- `toggle` (on/off switches)',
|
||||
'- `tap` (no release)'
|
||||
]},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -125,3 +120,10 @@ module.exports = class Keyboard extends Panel {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
Keyboard.cssVariables = Keyboard.prototype.constructor.cssVariables.concat(
|
||||
{js: 'colorWhite', css: '--color-white-key'},
|
||||
{js: 'colorBlack', css: '--color-black-key'}
|
||||
)
|
||||
|
||||
module.exports = Keyboard
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
var Panel = require('./panel'),
|
||||
Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties'),
|
||||
parser = require('../../parser'),
|
||||
{deepCopy} = require('../../utils')
|
||||
|
||||
|
||||
class Matrix extends StaticProperties(Panel, {scroll: false}) {
|
||||
class Matrix extends StaticProperties(Panel) {
|
||||
|
||||
static description() {
|
||||
|
||||
|
|
@ -15,28 +14,22 @@ class Matrix extends StaticProperties(Panel, {scroll: false}) {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
_class_specific: 'matrix',
|
||||
|
||||
colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'},
|
||||
widgetType: {type: 'string', value: 'button', help: 'Defines the type of the widgets in the matrix'},
|
||||
quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'},
|
||||
start: {type: 'integer', value: 0, help: 'First widget\'s index'},
|
||||
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: `$`',
|
||||
'Note: by default, the widgets inherit from the matrix\' `id` and osc properties (`id` and `address` are appended with `/$`)'
|
||||
]},
|
||||
|
||||
_separator: 'layout',
|
||||
|
||||
layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help: 'Defines how children are laid out.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
|
||||
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
|
||||
|
||||
}, [], {})
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
widgetType: {type: 'string', value: 'button', help: 'Defines the type of the widgets in the matrix'},
|
||||
quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'},
|
||||
start: {type: 'integer', value: 0, help: 'First widget\'s index'},
|
||||
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: `$`',
|
||||
'Note: by default, the widgets inherit from the matrix\' `id` and osc properties (`id` and `address` are appended with `/$`)'
|
||||
]},
|
||||
},
|
||||
style: {
|
||||
layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help: 'Defines how children are laid out.'},
|
||||
verticalTabs: null,
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
var Panel = require('./panel'),
|
||||
Widget = require('../common/widget'),
|
||||
{icon, iconify} = require('../../ui/utils'),
|
||||
resize = require('../../events/resize'),
|
||||
doubletab = require('../mixins/double_tap'),
|
||||
|
|
@ -16,45 +15,35 @@ class Modal extends Panel {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
_class_specific: 'modal',
|
||||
|
||||
colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'},
|
||||
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 (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`',
|
||||
]},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
traversing: {type: 'boolean', value: false, help: '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'},
|
||||
|
||||
_separator: 'popup',
|
||||
|
||||
popupLabel: {type: 'string|boolean', value: 'auto', 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'},
|
||||
|
||||
_separator1: 'widget container',
|
||||
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help: 'Defines how children are laid out.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
|
||||
|
||||
}, [], {
|
||||
|
||||
_children: 'children',
|
||||
|
||||
widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object'},
|
||||
value: {type: 'integer', value: '', help: [
|
||||
'Defines the modal\'s state:`0` for closed, `1` for opened'
|
||||
]},
|
||||
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the modal require a double tap to open instead of a single tap'},
|
||||
},
|
||||
geometry: {
|
||||
_separator_modal_geometry: 'Modal geometry',
|
||||
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'},
|
||||
},
|
||||
style: {
|
||||
_separator_modal_style: 'Modal 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 (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`',
|
||||
]},
|
||||
popupLabel: {type: 'string|boolean', value: 'auto', help: 'Alternative label for the modal popup'},
|
||||
verticalTabs: null,
|
||||
},
|
||||
children: {
|
||||
tab: null
|
||||
},
|
||||
value: {
|
||||
value: {type: 'integer', value: '', help: [
|
||||
'Defines the modal\'s state:`0` for closed, `1` for opened'
|
||||
]},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,42 +15,34 @@ class Panel extends Container() {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'panel',
|
||||
|
||||
colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
traversing: {type: 'boolean', value: false, help: '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'},
|
||||
|
||||
_separator1: 'widget container',
|
||||
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
|
||||
|
||||
_separator2: 'tab container',
|
||||
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
|
||||
}, [], {
|
||||
|
||||
_children: 'children',
|
||||
|
||||
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: {type: 'integer', value: '', help: [
|
||||
'Defines currently selected tab in the widget',
|
||||
'A tab can be opened only by setting its parent\'s value'
|
||||
]},
|
||||
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
traversing: {type: 'boolean', value: false, help: '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'},
|
||||
},
|
||||
style: {
|
||||
_separator_panel_style: 'Panel style',
|
||||
colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
},
|
||||
value: {
|
||||
value: {type: 'integer', value: '', help: [
|
||||
'Defines currently selected tab in the widget',
|
||||
'A tab can be opened only by setting its parent\'s value'
|
||||
]}
|
||||
},
|
||||
children: {
|
||||
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'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ class PatchBayNode extends Widget {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
label: {type: 'string', value: ''}
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
label: {type: 'string', value: ''}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -71,27 +73,25 @@ class PatchBay extends Container(Canvas) {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'patchbay',
|
||||
|
||||
inputs: {type: 'array|object', value: ['input_1', 'input_2'], help: [
|
||||
'- `Array` of input names : `[\'input_1\', \'input_2\']`',
|
||||
'- `Object` of `"label_1": "input_1"` 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',
|
||||
'',
|
||||
'Patchbay inputs can be connected to one or more outputs and will send messages of the following form when they are connected/disconnected: ',
|
||||
'`/patchbay_address input_x output_x output_y etc`',
|
||||
'If no output is connected to the input, the message will be `/patchbay_address input_x`',
|
||||
'The inputs values can be consumed with the property inheritance syntax: `@{patchbay_id/input_1}` returns an array of output names connected to `input_1`'
|
||||
]},
|
||||
outputs: {type: 'array|object', value: ['output_1', 'output_2'], help: 'List of output values the inputs can connect to (see `inputs`).'},
|
||||
|
||||
}, [], {
|
||||
|
||||
css: {type: 'string', value: '', help: [
|
||||
'The inputs/ouputs width can be adjusted by using the `.nodes` selector:',
|
||||
'`.nodes { width: 25% }`',
|
||||
]}
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
css: {type: 'string', value: '', help: [
|
||||
'The inputs/ouputs width can be adjusted by using the `.nodes` selector:',
|
||||
'`.nodes { width: 25% }`',
|
||||
]}
|
||||
},
|
||||
class_specific: {
|
||||
inputs: {type: 'array|object', value: ['input_1', 'input_2'], help: [
|
||||
'- `Array` of input names : `[\'input_1\', \'input_2\']`',
|
||||
'- `Object` of `"label_1": "input_1"` 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',
|
||||
'',
|
||||
'Patchbay inputs can be connected to one or more outputs and will send messages of the following form when they are connected/disconnected: ',
|
||||
'`/patchbay_address input_x output_x output_y etc`',
|
||||
'If no output is connected to the input, the message will be `/patchbay_address input_x`',
|
||||
'The inputs values can be consumed with the property inheritance syntax: `@{patchbay_id/input_1}` returns an array of output names connected to `input_1`'
|
||||
]},
|
||||
outputs: {type: 'array|object', value: ['output_1', 'output_2'], help: 'List of output values the inputs can connect to (see `inputs`).'},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
var Panel = require('./panel'),
|
||||
Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
|
||||
class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'root'}) {
|
||||
|
|
@ -12,43 +11,21 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
_class_specific: 'panel',
|
||||
|
||||
colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
traversing: {type: 'boolean', value: false, help: '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'},
|
||||
|
||||
_separator1: 'widget container',
|
||||
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
|
||||
|
||||
_separator2: 'tab container',
|
||||
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
|
||||
}, [
|
||||
'visible', 'label',
|
||||
'left', 'top', 'expand',
|
||||
'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOff',
|
||||
], {
|
||||
|
||||
_children:'children',
|
||||
|
||||
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: {type: 'integer', value: '', help: [
|
||||
'Defines currently widgeted tab in the widget',
|
||||
'A tab can be opened only by setting its parent\'s value'
|
||||
]},
|
||||
|
||||
return super.defaults().extend({
|
||||
widgets: {
|
||||
visible: null,
|
||||
},
|
||||
geometry: {
|
||||
left: null,
|
||||
top: null,
|
||||
expand: null,
|
||||
},
|
||||
style: {
|
||||
colorFill: null,
|
||||
colorStroke: null,
|
||||
alphaStroke: null,
|
||||
alphaFillOff: null,
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
var Panel = require('./panel'),
|
||||
Widget = require('../common/widget'),
|
||||
resize = require('../../events/resize'),
|
||||
{iconify} = require('../../ui/utils')
|
||||
|
||||
|
|
@ -13,49 +12,20 @@ class Tab extends Panel {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
|
||||
_class_specific: 'panel',
|
||||
|
||||
colorBg: {type: 'string', value: 'auto', help: 'Panel background color. Set to "auto" to inherit from parent widget.'},
|
||||
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 (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: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
traversing: {type: 'boolean', value: false, help: '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'},
|
||||
// detached: {type: 'boolean', value: true, help: 'Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens'},
|
||||
|
||||
_separator1: 'widget container',
|
||||
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:'Defines how children are laid out.'},
|
||||
justify: {type: 'string', value: 'start', choices: ['start', 'end', 'center', 'space-around', 'space-between'], help:'If `layout` is `vertical` or `horizontal`, defines how widgets should be justified.'},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
contain: {type: 'boolean', value: true, help:'If `layout` is `vertical` or `horizontal`, prevents children from overflowing the panel.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
innerPadding: {type : 'boolean', value: true, help: 'Set to `false` to make the `padding` property apply only between children and not at the container\'s inner boundaries.'},
|
||||
|
||||
_separator2: 'tab container',
|
||||
|
||||
verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'},
|
||||
|
||||
}, [
|
||||
'_geometry', 'left', 'top', 'width', 'height', 'expand',
|
||||
'colorStroke', 'alphaStroke', 'alphaFillOff', 'alphaFillOn'
|
||||
], {
|
||||
|
||||
_children:'children',
|
||||
|
||||
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: {type: 'integer', value: '', help: [
|
||||
'Defines currently widgeted tab in the widget',
|
||||
'A tab can be opened only by setting its parent\'s value'
|
||||
]},
|
||||
|
||||
return super.defaults().extend({
|
||||
geometry: null,
|
||||
style: {
|
||||
_separator_tab_style: 'Tab 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 (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`',
|
||||
]},
|
||||
colorStroke: null,
|
||||
alphaStroke: null,
|
||||
alphaFillOff: null,
|
||||
alphaFillOn: null,
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -87,7 +57,6 @@ class Tab extends Panel {
|
|||
|
||||
hide() {
|
||||
if (this.detached) return
|
||||
if (this.getProp('detached')) this.container.removeChild(this.widget)
|
||||
this.container.classList.remove('show')
|
||||
this.detached = true
|
||||
this.setVisibility()
|
||||
|
|
@ -95,7 +64,6 @@ class Tab extends Panel {
|
|||
|
||||
show() {
|
||||
if (!this.detached) return
|
||||
if (this.getProp('detached')) this.container.appendChild(this.widget)
|
||||
this.container.classList.add('show')
|
||||
this.detached = false
|
||||
this.setVisibility()
|
||||
|
|
|
|||
|
|
@ -13,14 +13,18 @@ class Frame extends StaticProperties(Widget, {bypass: true}) {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
}, ['decimals', 'typeTags', 'bypass', 'ignoreDefaults'], {
|
||||
|
||||
value: {type: 'string', value: '', help: [
|
||||
'External web page URL.',
|
||||
]}
|
||||
|
||||
return super.defaults().extend({
|
||||
value: {
|
||||
value: {type: 'string', value: '', help: [
|
||||
'External web page URL.',
|
||||
]}
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,21 +23,25 @@ class Html extends StaticProperties(Widget, {bypass: true}) {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'html',
|
||||
|
||||
html: {type: 'string', value: '', help: [
|
||||
'Allowed HTML tags:',
|
||||
' h1-6, blockquote, p, a, ul, ol, nl, li,',
|
||||
' b, i, strong, em, strike, code, hr, br, div,',
|
||||
' table, thead, img, caption, tbody, tr, th, td, pre',
|
||||
'Allowed attributes:',
|
||||
' <*>: class, style, title',
|
||||
' <img>: src, width, height',
|
||||
]},
|
||||
|
||||
}, ['decimals', 'typeTags', 'bypass', 'ignoreDefaults'], {})
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
html: {type: 'string', value: '', help: [
|
||||
'Allowed HTML tags:',
|
||||
' h1-6, blockquote, p, a, ul, ol, nl, li,',
|
||||
' b, i, strong, em, strike, code, hr, br, div,',
|
||||
' table, thead, img, caption, tbody, tr, th, td, pre',
|
||||
'Allowed attributes:',
|
||||
' <*>: class, style, title',
|
||||
' <img>: src, width, height',
|
||||
]},
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,25 +13,31 @@ module.exports = class Image extends StaticProperties(Widget, {bypass: true}) {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'image',
|
||||
|
||||
size: {type: 'string', value: 'cover', help: 'CSS background-size'},
|
||||
position: {type: 'string', value: 'center', help: 'CSS background-position'},
|
||||
repeat: {type: 'string', value: 'no-repeat', help: 'CSS background-repeat'},
|
||||
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'
|
||||
]}
|
||||
|
||||
}, ['decimals', 'typeTags', 'bypass', 'ignoreDefaults'], {
|
||||
|
||||
value: {type: 'string', value: '', help: [
|
||||
'- File `url` or `path` (relative to the session file location by default, falling back to absolute path)',
|
||||
'- Base64 encoded image : `data:image/...`'
|
||||
]}
|
||||
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
_separator_image_style: 'Image style',
|
||||
size: {type: 'string', value: 'cover', help: 'CSS background-size'},
|
||||
position: {type: 'string', value: 'center', help: 'CSS background-position'},
|
||||
repeat: {type: 'string', value: 'no-repeat', help: 'CSS background-repeat'},
|
||||
},
|
||||
class_specific: {
|
||||
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: {type: 'string', value: '', help: [
|
||||
'- File `url` or `path` (relative to the session file location by default, falling back to absolute path)',
|
||||
'- Base64 encoded image : `data:image/...`'
|
||||
]}
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,15 +14,19 @@ class Svg extends StaticProperties(Widget, {bypass: true}) {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'svg',
|
||||
|
||||
svg: {type: 'string', value: '', help: [
|
||||
'Svg xml definition (will be wrapped in a `< svg />` element)',
|
||||
]},
|
||||
|
||||
}, ['decimals', 'typeTags', 'bypass', 'ignoreDefaults'], {})
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
svg: {type: 'string', value: '', help: [
|
||||
'Svg xml definition (will be wrapped in a `< svg />` element)',
|
||||
]},
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
var {mapToScale} = require('../utils'),
|
||||
Plot = require('./plot'),
|
||||
Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
|
||||
class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smooth:true}) {
|
||||
|
|
@ -13,26 +12,33 @@ class Eq extends StaticProperties(Plot, {logScaleX: false, logScaleY:false, smoo
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
interaction: null
|
||||
},
|
||||
class_specific: {
|
||||
filters: {type: 'array', value: '', help: [
|
||||
'Each item must be an object with the following properties',
|
||||
'- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak", "bandpass" or "notch", default: "peak")',
|
||||
'- `freq`: number (filter\'s resonant frequency, default: 1000)',
|
||||
'- `q`: number (Q factor, default: 1)',
|
||||
'- `gain`: number (default: 0)',
|
||||
'- `on`: boolean (default: true)',
|
||||
'See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode'
|
||||
|
||||
_class_specific: 'eq',
|
||||
|
||||
filters: {type: 'array', value: '', help: [
|
||||
'Each item must be an object with the following properties',
|
||||
'- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak", "bandpass" or "notch", default: "peak")',
|
||||
'- `freq`: number (filter\'s resonant frequency, default: 1000)',
|
||||
'- `q`: number (Q factor, default: 1)',
|
||||
'- `gain`: number (default: 0)',
|
||||
'- `on`: boolean (default: true)',
|
||||
'See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode'
|
||||
|
||||
]},
|
||||
pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'},
|
||||
rangeX: {type: 'object', value: {min: 20, max: 22000}, help: 'Defines the min and max values for the x axis (in Hz, logarithmic scale)'},
|
||||
rangeY: {type: 'object', value: {min:-6, max:6}, help: 'Defines the min and max values for the y axis (in dB)'},
|
||||
origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
|
||||
|
||||
}, ['interaction', 'decimals', 'typeTags', 'bypass', 'ignoreDefaults'])
|
||||
]},
|
||||
pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'},
|
||||
rangeX: {type: 'object', value: {min: 20, max: 22000}, help: 'Defines the min and max values for the x axis (in Hz, logarithmic scale)'},
|
||||
rangeY: {type: 'object', value: {min:-6, max:6}, help: 'Defines the min and max values for the y axis (in dB)'},
|
||||
origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,29 +13,46 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
interaction: null
|
||||
},
|
||||
style: {
|
||||
_separator_plot_style: 'Plot style',
|
||||
dots: {type: 'boolean', value: false, help: 'Draw dots on the line'},
|
||||
bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'},
|
||||
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
},
|
||||
class_specific: {
|
||||
filters: {type: 'array', value: '', help: [
|
||||
'Each item must be an object with the following properties',
|
||||
'- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak", "bandpass" or "notch", default: "peak")',
|
||||
'- `freq`: number (filter\'s resonant frequency, default: 1000)',
|
||||
'- `q`: number (Q factor, default: 1)',
|
||||
'- `gain`: number (default: 0)',
|
||||
'- `on`: boolean (default: true)',
|
||||
'See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode'
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'plot',
|
||||
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'},
|
||||
dots: {type: 'boolean', value: false, help: 'Draw dots on the line'},
|
||||
bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'},
|
||||
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
|
||||
}, ['interaction', 'decimals', 'typeTags', 'bypass', 'ignoreDefaults'], {
|
||||
|
||||
value: {type: 'array|string', value: '', help: [
|
||||
'- `Array` of `y` values',
|
||||
'- `Array` of `[x, y]` `array` values',
|
||||
'- `String` `array`',
|
||||
'- `String` `object` to update specific coordinates only: `{0:1, 4:0}` will change the 1st and 5th points\' coordinates',
|
||||
]}
|
||||
|
||||
]},
|
||||
pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'},
|
||||
rangeX: {type: 'object', value: {min: 20, max: 22000}, help: 'Defines the min and max values for the x axis (in Hz, logarithmic scale)'},
|
||||
rangeY: {type: 'object', value: {min:-6, max:6}, help: 'Defines the min and max values for the y axis (in dB)'},
|
||||
origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
|
||||
},
|
||||
value: {
|
||||
value: {type: 'array|string', value: '', help: [
|
||||
'- `Array` of `y` values',
|
||||
'- `Array` of `[x, y]` `array` values',
|
||||
'- `String` `array`',
|
||||
'- `String` `object` to update specific coordinates only: `{0:1, 4:0}` will change the 1st and 5th points\' coordinates',
|
||||
]}
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
var {clip} = require('../utils'),
|
||||
Widget = require('../common/widget'),
|
||||
Plot = require('./plot'),
|
||||
StaticProperties = require('../mixins/static_properties'),
|
||||
canvasQueue = require('../common/queue')
|
||||
|
|
@ -15,19 +14,29 @@ class Visualizer extends StaticProperties(Plot, {rangeX: {min: '', max: ''}, dot
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
_class_specific: 'visualizer',
|
||||
|
||||
duration: {type: 'number', value: 1, help: 'Defines visualization duration in seconds'},
|
||||
framerate: {type: 'number', value: 30, help: 'Defines visualization framerate'},
|
||||
rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
freeze: {type: 'boolean', value: false, help: 'Set to `true` to freeze current view and ignore incoming values'}
|
||||
|
||||
}, ['interaction', 'decimals', 'typeTags', 'bypass', 'ignoreDefaults'], {})
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
interaction: null
|
||||
},
|
||||
style: {
|
||||
_separator_visualizer_style: 'Visualizer style',
|
||||
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
},
|
||||
class_specific: {
|
||||
duration: {type: 'number', value: 1, help: 'Defines visualization duration in seconds'},
|
||||
framerate: {type: 'number', value: 30, help: 'Defines visualization framerate'},
|
||||
rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
freeze: {type: 'boolean', value: false, help: 'Set to `true` to freeze current view and ignore incoming values'}
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module.exports.widgets = {
|
|||
xy: require('./pads/xy'),
|
||||
rgb: require('./pads/rgb'),
|
||||
multixy: require('./pads/multixy'),
|
||||
canvas: require('./pads/canvas'),
|
||||
// canvas: require('./pads/canvas'),
|
||||
|
||||
// sliders
|
||||
fader: require('./sliders/fader'),
|
||||
|
|
|
|||
|
|
@ -13,27 +13,36 @@ module.exports = class Led extends StaticProperties(Widget, {bypass: true, inter
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'led',
|
||||
|
||||
mode: {type: 'string', value: 'intensity', choices: ['intensity', 'color'], help: 'Defines how value is interpreted (see `value`)'},
|
||||
range: {type: 'object', value: {min:0, max:1}, help: 'Value range'},
|
||||
alphaRange: {type: 'object', value: {min:0, max:1}, help: 'Alpha range (if `mode` is `color`)'},
|
||||
logScale: {type: 'boolean', value: false, help: 'If `mode` is `intensity`, set to `true` to use logarithmic scale.'},
|
||||
borderRadius: {type: 'string', value: '', help: 'Css border-radius property.'},
|
||||
|
||||
}, ['interaction', 'decimals', 'bypass', 'ignoreDefaults'], {
|
||||
|
||||
value: {type: 'number|array|string', value: '', help: [
|
||||
'If `mode` is `intensity`:',
|
||||
'- `Number`: `intensity` between `range.min` and `range.max`',
|
||||
'If `mode` is `color`:',
|
||||
'- `Array`: `[r, g, b]` (`r`, `g` and `b` between `range.min` and `range.max`)',
|
||||
'- `Array`: `[r, g, b, alpha]` (`alpha` between `alphaRange.min` and `alphaRange.max`)',
|
||||
'- `String`: CSS color',
|
||||
]}
|
||||
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
interaction: null
|
||||
},
|
||||
style: {
|
||||
_separator_led_style: 'Led style',
|
||||
borderRadius: {type: 'string', value: '', help: 'Css border-radius property.'},
|
||||
},
|
||||
class_specific: {
|
||||
mode: {type: 'string', value: 'intensity', choices: ['intensity', 'color'], help: 'Defines how value is interpreted (see `value`)'},
|
||||
range: {type: 'object', value: {min:0, max:1}, help: 'Value range'},
|
||||
alphaRange: {type: 'object', value: {min:0, max:1}, help: 'Alpha range (if `mode` is `color`)'},
|
||||
logScale: {type: 'boolean', value: false, help: 'If `mode` is `intensity`, set to `true` to use logarithmic scale.'},
|
||||
},
|
||||
value: {
|
||||
value: {type: 'number|array|string', value: '', help: [
|
||||
'If `mode` is `intensity`:',
|
||||
'- `Number`: `intensity` between `range.min` and `range.max`',
|
||||
'If `mode` is `color`:',
|
||||
'- `Array`: `[r, g, b]` (`r`, `g` and `b` between `range.min` and `range.max`)',
|
||||
'- `Array`: `[r, g, b, alpha]` (`alpha` between `alphaRange.min` and `alphaRange.max`)',
|
||||
'- `String`: CSS color',
|
||||
]}
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,25 @@ module.exports = class Text extends StaticProperties(Widget, {bypass: true, inte
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'text',
|
||||
|
||||
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.',
|
||||
]},
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Css text-align property.'},
|
||||
|
||||
}, ['interaction', 'decimals', 'bypass', 'ignoreDefaults'], {})
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
interaction: null
|
||||
},
|
||||
style: {
|
||||
_separator_text_style: 'Text style',
|
||||
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.',
|
||||
]},
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Css text-align property.'},
|
||||
},
|
||||
osc: {
|
||||
decimals: null,
|
||||
typeTags: null,
|
||||
bypass: null,
|
||||
ignoreDefaults: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,15 +11,12 @@ class CanvasWidget extends Canvas {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'canvas',
|
||||
|
||||
|
||||
onCreate: {type: 'string', value: '', help: ' '},
|
||||
onTouch: {type: 'string', value: '', help: ' '},
|
||||
|
||||
}, [], {})
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
onCreate: {type: 'string', value: '', help: ' '},
|
||||
onTouch: {type: 'string', value: '', help: ' '},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,33 +17,31 @@ module.exports = class MultiXy extends Pad {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'multi xy',
|
||||
|
||||
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\']`)'
|
||||
]},
|
||||
|
||||
|
||||
_separator: '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',
|
||||
]},
|
||||
ephemeral: {type: 'boolean', value: false, help: 'When set to `true`, the points will be drawn only chile touched.'},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '},
|
||||
|
||||
}, [], {})
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
_separator_xy_style: 'Xy style',
|
||||
pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size'},
|
||||
ephemeral: {type: 'boolean', value: false, help: 'When set to `true`, the points will be drawn only chile touched.'},
|
||||
pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
},
|
||||
class_specific: {
|
||||
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\']`)'
|
||||
]},
|
||||
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'},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,21 +18,17 @@ module.exports = class Rgb extends Widget {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'rgb',
|
||||
|
||||
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.'},
|
||||
alpha:{type: 'boolean', value: false, help: 'Set to `true` to enable alpha channel'},
|
||||
rangeAlpha: {type: 'object', value: {min: 0, max: 1}, help: 'Defines the widget\'s output scale for the alpha channel.'},
|
||||
|
||||
}, ['color'], {
|
||||
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
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.'},
|
||||
alpha:{type: 'boolean', value: false, help: 'Set to `true` to enable alpha channel'},
|
||||
rangeAlpha: {type: 'object', value: {min: 0, max: 1}, help: 'Defines the widget\'s output scale for the alpha channel.'},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,29 +15,30 @@ module.exports = class Xy extends Pad {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: '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',
|
||||
]},
|
||||
ephemeral: {type: 'boolean', value: false, help: 'When set to `true`, the point will be drawn only chile touched.'},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'},
|
||||
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: `/<doubleTap> <preArgs>`'
|
||||
]},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '},
|
||||
|
||||
}, [], {})
|
||||
return super.defaults().extend({
|
||||
style: {
|
||||
_separator_xy_style: 'Xy style',
|
||||
pointSize: {type: 'integer', value: 20, help: 'Defines the points\' size'},
|
||||
ephemeral: {type: 'boolean', value: false, help: 'When set to `true`, the point will be drawn only while touched.'},
|
||||
pips: {type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
},
|
||||
class_specific: {
|
||||
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'},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'},
|
||||
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: `/<doubleTap> <preArgs>`'
|
||||
]},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,29 +14,26 @@ class Script extends Widget {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
visible: null,
|
||||
interaction: null
|
||||
},
|
||||
geometry: null,
|
||||
style: null,
|
||||
class_specific: {
|
||||
event: {type: 'string', value: 'value', choices: ['value', 'keyboard'], help: 'Define which events trigger the script\'s execution.'},
|
||||
script: {type: 'script', value: '', help: 'Script executed whenever the widget\'s receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.'},
|
||||
|
||||
_class_specific: 'script',
|
||||
_separator: 'event: keyboard',
|
||||
|
||||
event: {type: 'string', value: 'value', choices: ['value', 'keyboard'], help: 'Define which events trigger the script\'s execution.'},
|
||||
script: {},
|
||||
|
||||
_separator: 'event: keyboard',
|
||||
|
||||
keyBinding: {type: 'string|array', value: '', help: 'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation)'},
|
||||
keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'},
|
||||
keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'},
|
||||
|
||||
|
||||
|
||||
}, [
|
||||
|
||||
'visible', 'interaction',
|
||||
'_geometry', 'left', 'top', 'width', 'height', 'expand',
|
||||
'_style', 'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOn', 'alphaFillOff', 'padding', 'lineWidth', 'css'
|
||||
|
||||
], {
|
||||
script: {type: 'script', value: '', help: 'Script executed whenever the widget\'s receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>.'},
|
||||
keyBinding: {type: 'string|array', value: '', help: 'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation)'},
|
||||
keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'},
|
||||
keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'},
|
||||
},
|
||||
value: {
|
||||
script: null
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
var Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
|
||||
module.exports = class Variable extends StaticProperties(Widget, {bypass: true, interaction: false, visible: false}) {
|
||||
module.exports = class Variable extends StaticProperties(Widget, {interaction: false, visible: false}) {
|
||||
|
||||
static description() {
|
||||
|
||||
|
|
@ -11,15 +11,14 @@ module.exports = class Variable extends StaticProperties(Widget, {bypass: true,
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
|
||||
}, [
|
||||
'visible', 'interaction',
|
||||
'_geometry', 'left', 'top', 'width', 'height', 'expand',
|
||||
'_style', 'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOn', 'alphaFillOff', 'padding', 'css',
|
||||
'decimals', 'bypass'
|
||||
], {})
|
||||
return super.defaults().extend({
|
||||
widget: {
|
||||
visible: null,
|
||||
interaction: null
|
||||
},
|
||||
geometry: null,
|
||||
style: null,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
var Knob = require('./knob'),
|
||||
Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
|
||||
|
||||
module.exports = class Encoder extends StaticProperties(Knob, {angle: 360, range: {min: 0, max: 1}, sensitivity: 1, steps: ''}) {
|
||||
|
||||
static description() {
|
||||
|
|
@ -13,32 +11,26 @@ module.exports = class Encoder extends StaticProperties(Knob, {angle: 360, range
|
|||
|
||||
static defaults() {
|
||||
|
||||
return Widget.defaults({
|
||||
|
||||
_class_specific: 'encoder',
|
||||
|
||||
ticks: {type: 'number', value: 360, help: 'defines the granularity / verbosity of the encoder (number of step for a 360° arc)'},
|
||||
back: {type: '*', value: -1, help: 'Defines which value is sent when rotating the encoder anticlockwise'},
|
||||
forth: {type: '*', value: 1, help: 'Defines which value is sent when rotating the encoder clockwise'},
|
||||
release: {type: 'number', value: '', help: [
|
||||
'Defines which value is sent when releasing the encoder:',
|
||||
'- Set to `null` to send send no argument in the osc message',
|
||||
'- Can be an `object` if the type needs to be specified'
|
||||
]},
|
||||
mode: {type: 'string', value: 'circular', choices: ['circular', 'snap', 'vertical'], help: [
|
||||
'- `circular`: relative move in circular motion',
|
||||
'- `snap`: snap to touch position and move in vertical motion',
|
||||
'- `vertical`: relative move in vertical motion',
|
||||
]},
|
||||
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>`)'
|
||||
]},
|
||||
|
||||
}, [], {
|
||||
|
||||
touchAddress: {type: 'string', value:'', help: 'OSC address for touched state messages: `/touchAddress [preArgs] 0/1`'},
|
||||
|
||||
return super.defaults().extend({
|
||||
class_specific: {
|
||||
ticks: {type: 'number', value: 360, help: 'defines the granularity / verbosity of the encoder (number of step for a 360° arc)'},
|
||||
back: {type: '*', value: -1, help: 'Defines which value is sent when rotating the encoder anticlockwise'},
|
||||
forth: {type: '*', value: 1, help: 'Defines which value is sent when rotating the encoder clockwise'},
|
||||
release: {type: 'number', value: '', help: [
|
||||
'Defines which value is sent when releasing the encoder:',
|
||||
'- Set to `null` to send send no argument in the osc message',
|
||||
'- Can be an `object` if the type needs to be specified'
|
||||
]},
|
||||
mode: {type: 'string', value: 'circular', choices: ['circular', 'snap', 'vertical'], help: [
|
||||
'- `circular`: relative move in circular motion',
|
||||
'- `snap`: snap to touch position and move in vertical motion',
|
||||
'- `vertical`: relative move in vertical motion',
|
||||
]},
|
||||
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>`)'
|
||||
]},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,45 +11,46 @@ class Fader extends Slider {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'fader',
|
||||
|
||||
design: {type: 'string', value: 'default', choices: ['default', 'round', 'compact'], help: 'Design style'},
|
||||
knobSize: {type: 'number', value: 'auto', help: 'Fader knob size'},
|
||||
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'},
|
||||
pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints (ignored if `design` is `compact`)'},
|
||||
dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'},
|
||||
gradient: {type: 'array|object', value: [], help: [
|
||||
'When set, the meter\'s gauge will be filled with a linear color gradient',
|
||||
'- each item must be a CSS color string.',
|
||||
'- as an `object`: each key must be a number between 0 and 1',
|
||||
'- each item must be a CSS color string.',
|
||||
'Examples: `[\'blue\', \'red\']`, {\'0\': \'blue\', \'0.9\': \'blue\', \'1\': \'red\'} '
|
||||
]},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale. Set to `-1` for exponential scale.'},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the fader\'s sensitivity when `snap` is `false` '},
|
||||
steps: {type: 'string|number|array', value: '', help: [
|
||||
'Restricts the widget\'s value:',
|
||||
'- `auto`: use values defined in `range`',
|
||||
'- `number`: define a number of evenly spaced steps',
|
||||
'- `array`: use arbitrary values',
|
||||
]},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the fader\'s gauge'},
|
||||
|
||||
}, [], {}, Fader)
|
||||
return super.defaults(Fader).extend({
|
||||
style: {
|
||||
_separator_fader_style: 'Fader style',
|
||||
design: {type: 'string', value: 'default', choices: ['default', 'round', 'compact'], help: 'Design style'},
|
||||
knobSize: {type: 'number', value: 'auto', help: 'Fader knob size'},
|
||||
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display the fader horizontally'},
|
||||
pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints (ignored if `design` is `compact`)'},
|
||||
dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'},
|
||||
gradient: {type: 'array|object', value: [], help: [
|
||||
'When set, the meter\'s gauge will be filled with a linear color gradient',
|
||||
'- each item must be a CSS color string.',
|
||||
'- as an `object`: each key must be a number between 0 and 1',
|
||||
'- each item must be a CSS color string.',
|
||||
'Examples: `[\'blue\', \'red\']`, {\'0\': \'blue\', \'0.9\': \'blue\', \'1\': \'red\'} '
|
||||
]},
|
||||
},
|
||||
class_specific: {
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale. Set to `-1` for exponential scale.'},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the fader\'s sensitivity when `snap` is `false` '},
|
||||
steps: {type: 'string|number|array', value: '', help: [
|
||||
'Restricts the widget\'s value:',
|
||||
'- `auto`: use values defined in `range`',
|
||||
'- `number`: define a number of evenly spaced steps',
|
||||
'- `array`: use arbitrary values',
|
||||
]},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the fader\'s gauge'},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,44 +11,45 @@ module.exports = class Knob extends Slider {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
_class_specific: 'knob',
|
||||
|
||||
design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line'], help: [
|
||||
'Design style',
|
||||
'Note: "solid" design uses "colorStroke" for the central knob color.'
|
||||
]},
|
||||
mode: {type: 'string', value: 'vertical', choices: ['vertical', 'circular', 'snap'], help: [
|
||||
'- `circular`: relative move in circular motion',
|
||||
'- `snap`: snap to touch position and move in vertical motion',
|
||||
'- `vertical`: relative move in vertical motion',
|
||||
]},
|
||||
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: false, help: 'Set to `true` to show the scale\'s breakpoints'},
|
||||
dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'},
|
||||
angle: {type: 'number', value: 270, help: 'Defines the angle\'s width of the knob, in degrees'},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale. Set to `-1` for exponential scale.'},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the knob\'s sensitivity when `mode` is not `snap` '},
|
||||
steps: {type: 'string|number|array', value: '', help: [
|
||||
'Restricts the widget\'s value:',
|
||||
'- `auto`: use values defined in `range`',
|
||||
'- `number`: define a number of evenly spaced steps',
|
||||
'- `array`: use arbitrary values',
|
||||
]},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the knob\'s gauge'},
|
||||
|
||||
}, [], {}, Knob)
|
||||
return super.defaults(Knob).extend({
|
||||
style: {
|
||||
_separator_knob_style: 'Knob style',
|
||||
design: {type: 'string', value: 'default', choices: ['default', 'solid', 'line'], help: [
|
||||
'Design style',
|
||||
'Note: "solid" design uses "colorStroke" for the central knob color.'
|
||||
]},
|
||||
pips: {type: 'boolean', value: false, help: 'Set to `true` to show the scale\'s breakpoints'},
|
||||
dashed: {type: 'boolean|array', value: false, help: 'Set to `true` to display a dashed gauge. Can be set as an `array` of two numbers : `[dash_size, gap_size]`'},
|
||||
angle: {type: 'number', value: 270, help: 'Defines the angle\'s width of the knob, in degrees'},
|
||||
},
|
||||
class_specific: {
|
||||
mode: {type: 'string', value: 'vertical', choices: ['vertical', 'circular', 'snap'], help: [
|
||||
'- `circular`: relative move in circular motion',
|
||||
'- `snap`: snap to touch position and move in vertical motion',
|
||||
'- `vertical`: relative move in vertical motion',
|
||||
]},
|
||||
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|number', value: false, help: 'Set to `true` to use logarithmic scale. Set to `-1` for exponential scale.'},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the knob\'s sensitivity when `mode` is not `snap` '},
|
||||
steps: {type: 'string|number|array', value: '', help: [
|
||||
'Restricts the widget\'s value:',
|
||||
'- `auto`: use values defined in `range`',
|
||||
'- `number`: define a number of evenly spaced steps',
|
||||
'- `array`: use arbitrary values',
|
||||
]},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the starting point\'s value of the knob\'s gauge'},
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue