diff --git a/src/client/widgets/basics/button.js b/src/client/widgets/basics/button.js index 71401d27..e5ab02ce 100644 --- a/src/client/widgets/basics/button.js +++ b/src/client/widgets/basics/button.js @@ -31,7 +31,7 @@ class Button extends Widget { '- `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 accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, + colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'}, }) diff --git a/src/client/widgets/basics/switch.js b/src/client/widgets/basics/switch.js index c182aadb..c624ce8d 100644 --- a/src/client/widgets/basics/switch.js +++ b/src/client/widgets/basics/switch.js @@ -29,7 +29,7 @@ class Switch extends MenuBase { '- `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 accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, + colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'}, }) diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 8a8f33af..525ed01b 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -76,15 +76,15 @@ class Widget extends EventEmitter { _style:'style', - colorText: {type: 'string', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, - colorWidget: {type: 'string', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, - colorStroke: {type: 'string', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, - colorFill: {type: 'string', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, - alphaStroke: {type: 'number', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, - alphaFillOff: {type: 'number', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, - alphaFillOn: {type: 'number', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, + 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).'}, - padding: {type: 'number', value: 'auto', help: 'Defines the widget\'s accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget.'}, + padding: {type: 'number', value: 'auto', help: 'Inner spacing.'}, @@ -99,14 +99,13 @@ class Widget extends EventEmitter { '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: {type: 'script', value: '', help: 'Script executed whenever the widget\'s value is set.'}, _osc: 'osc', address: {type: 'string', value: 'auto', help: 'OSC address for sending messages, it must start with a /'}, preArgs: {type: '*|array', value: '', help: [ 'A value or array of values that will be prepended to the OSC messages.', - 'Values can be defined as objects if the osc type tag needs to be specified: `{type: "i", value: 1}`' ]}, typeTags: {type: 'string', value: '', help: [ 'Defines the osc argument types, one letter per argument (including preArgs)', diff --git a/src/client/widgets/containers/matrix.js b/src/client/widgets/containers/matrix.js index 6149ec18..ee478cac 100644 --- a/src/client/widgets/containers/matrix.js +++ b/src/client/widgets/containers/matrix.js @@ -20,7 +20,7 @@ class Matrix extends StaticProperties(Panel, {scroll: false}) { _matrix: 'matrix', widgetType: {type: 'string', value: 'button', help: 'Defines the type of the widgets in the matrix'}, - layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help:''}, + 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.'}, quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'}, start: {type: 'integer', value: 0, help: 'First widget\'s index'}, diff --git a/src/client/widgets/containers/modal.js b/src/client/widgets/containers/modal.js index ec62988a..0431beed 100644 --- a/src/client/widgets/containers/modal.js +++ b/src/client/widgets/containers/modal.js @@ -27,7 +27,7 @@ class Modal extends Panel { popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'}, popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'}, colorPanel: {type: 'string', value: 'auto', help:''}, - layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''}, + 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.'}, 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'}, scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'}, diff --git a/src/client/widgets/containers/panel.js b/src/client/widgets/containers/panel.js index 6b5d3593..5bbbaff6 100644 --- a/src/client/widgets/containers/panel.js +++ b/src/client/widgets/containers/panel.js @@ -20,7 +20,7 @@ class Panel extends Container() { _panel:'panel', colorPanel: {type: 'string', value: 'auto', help:''}, - layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''}, + 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.'}, verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'}, diff --git a/src/client/widgets/containers/root.js b/src/client/widgets/containers/root.js index 2734e4fe..2d1f9a0b 100644 --- a/src/client/widgets/containers/root.js +++ b/src/client/widgets/containers/root.js @@ -18,7 +18,7 @@ class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'ro _panel:'panel', colorPanel: {type: 'string', value: 'auto', help:''}, - layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''}, + 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.'}, verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'}, diff --git a/src/client/widgets/containers/tab.js b/src/client/widgets/containers/tab.js index d735acfe..e74e422e 100644 --- a/src/client/widgets/containers/tab.js +++ b/src/client/widgets/containers/tab.js @@ -17,7 +17,7 @@ module.exports = class Tab extends Panel { _tab:'tab', // detached: {type: 'boolean', value: true, help: 'Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens'}, - layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''}, + 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.'}, verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'}, diff --git a/src/client/widgets/indicators/led.js b/src/client/widgets/indicators/led.js index e22fca21..8dd325e7 100644 --- a/src/client/widgets/indicators/led.js +++ b/src/client/widgets/indicators/led.js @@ -1,4 +1,4 @@ -var {mapToScale, clip} = require('../utils'), +var {mapToScale} = require('../utils'), Widget = require('../common/widget'), html = require('nanohtml'), StaticProperties = require('../mixins/static_properties') @@ -17,19 +17,20 @@ module.exports = class Led extends StaticProperties(Widget, {bypass: true, inter _led:'led', - mode: {type: 'string', value: 'intensity', choices: ['intensity', 'color'], help: [ - '' - ]}, - range: {type: 'object', value: {min:0,max:1}, help: 'Value to led intensity mapping range'}, - logScale: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm\'s base.'}, + 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'], { value: {type: 'number|array|string', value: '', help: [ - '- `Number`: if `mode` is set to `intensity`', - '- `Array`: `[r, g, b]` (`r`, `g` and `b` between `0` and `255`)', - '- `Array`: `[r, g, b, alpha]` (`alpha` between `0` and `255`)', + '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', ]} @@ -75,11 +76,11 @@ module.exports = class Led extends StaticProperties(Widget, {bypass: true, inter if (Array.isArray(v) && v.length >= 3) { - for (let i in [0,1,2]) { - v[i] = parseInt(clip(v[i],[0,255])) + for (let i in [0, 1, 2]) { + v[i] = parseInt(mapToScale(v[i], [this.getProp('range').min, this.getProp('range').max], [0, 255])) } - v[3] = clip(v[3] != undefined ? v[3] : 1,[0,1]) + v[3] = v[3] === undefined ? 1 : mapToScale(v[3], [this.getProp('alphaRange').min, this.getProp('alphaRange').max], [0, 1], -1) c = `rgba(${v[0]}, ${v[1]}, ${v[2]}, ${v[3]})` diff --git a/src/client/widgets/scripts/script.js b/src/client/widgets/scripts/script.js index 1b067706..794b6011 100644 --- a/src/client/widgets/scripts/script.js +++ b/src/client/widgets/scripts/script.js @@ -18,7 +18,7 @@ class Script extends Widget { _script: 'script', - event: {type: 'string', value: 'value', choices: ['value', 'keyboard']}, + event: {type: 'string', value: 'value', choices: ['value', 'keyboard'], help: 'Define which events trigger the script\'s execution.'}, script: {type: 'string', value: '', help: [ 'This property is evaluated each time the widget receives a value*. Formulas are given extras variables in this context:',