docs; add widget class static description

This commit is contained in:
jean-emmanuel 2019-04-11 18:47:11 +02:00
parent 40894f22cf
commit 71902dfe37
29 changed files with 253 additions and 4 deletions

View file

@ -30,6 +30,8 @@
### fader
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="fader_style">style<a class="headerlink" href="#fader_style" title="Permanent link">#</a></h4> ||||
@ -56,6 +58,8 @@
### knob
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="knob_style">style<a class="headerlink" href="#knob_style" title="Permanent link">#</a></h4> ||||
@ -78,6 +82,8 @@
### encoder
A knob that sends a relative direction infomation instead of an absolute value.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="encoder_encoder">encoder<a class="headerlink" href="#encoder_encoder" title="Permanent link">#</a></h4> ||||
@ -92,6 +98,8 @@
### range
A fader with two heads for setting a range.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="range_style">style<a class="headerlink" href="#range_style" title="Permanent link">#</a></h4> ||||
@ -114,6 +122,8 @@
### toggle
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="toggle_toggle">toggle<a class="headerlink" href="#toggle_toggle" title="Permanent link">#</a></h4> ||||
@ -124,6 +134,8 @@
### push
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="push_push">push<a class="headerlink" href="#push_push" title="Permanent link">#</a></h4> ||||
@ -134,6 +146,8 @@
### switch
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="switch_switch">switch<a class="headerlink" href="#switch_switch" title="Permanent link">#</a></h4> ||||
@ -144,6 +158,8 @@
### dropdown
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="dropdown_dropdown">dropdown<a class="headerlink" href="#dropdown_dropdown" title="Permanent link">#</a></h4> ||||
@ -153,6 +169,8 @@
### xy
Two-dimensional slider.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="xy_style">style<a class="headerlink" href="#xy_style" title="Permanent link">#</a></h4> ||||
@ -174,6 +192,8 @@
### rgb
Color picker with optional alpha slider.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="rgb_rgb">rgb<a class="headerlink" href="#rgb_rgb" title="Permanent link">#</a></h4> ||||
@ -187,6 +207,8 @@
### multixy
Multi-point XY pad.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="multixy_style">style<a class="headerlink" href="#multixy_style" title="Permanent link">#</a></h4> ||||
@ -210,6 +232,8 @@
### matrix
Generic matrix for creating rows/columns of widgets.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="matrix_matrix">matrix<a class="headerlink" href="#matrix_matrix" title="Permanent link">#</a></h4> ||||
@ -223,6 +247,8 @@
### keyboard
Piano keyboard.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="keyboard_style">style<a class="headerlink" href="#keyboard_style" title="Permanent link">#</a></h4> ||||
@ -238,6 +264,8 @@
### patchbay
Connect inputs to outputs.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="patchbay_style">style<a class="headerlink" href="#patchbay_style" title="Permanent link">#</a></h4> ||||
@ -250,6 +278,8 @@
### plot
XY coordinates plot.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="plot_plot">plot<a class="headerlink" href="#plot_plot" title="Permanent link">#</a></h4> ||||
@ -267,6 +297,8 @@
### eq
Draws frequency response between from from an array of filter objects.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="eq_eq">eq<a class="headerlink" href="#eq_eq" title="Permanent link">#</a></h4> ||||
@ -276,9 +308,13 @@
| <h4 id="eq_origin">origin<a class="headerlink" href="#eq_origin" title="Permanent link">#</a></h4> | `number`\|<br/>`boolean` | <code>"auto"</code> | Defines the y axis origin. Set to `false` to disable it |
| <h4 id="eq_logScaleX">logScaleX<a class="headerlink" href="#eq_logScaleX" title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to use logarithmic scale for the x axis (log10) |
| <h4 id="eq_smooth">smooth<a class="headerlink" href="#eq_smooth" title="Permanent link">#</a></h4> | `boolean`\|<br/>`number` | <code>false</code> | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) |
| <h4 class="thead2" id="eq_value">value<a class="headerlink" href="#eq_value" title="Permanent link">#</a></h4> ||||
| <h4 id="eq_value">value<i class="dynamic-prop-icon" title="dynamic"></i><a class="headerlink" href="#eq_value" title="Permanent link">#</a></h4> | `array` | <code>""</code> | Each item must be an object with the following properties<br/>- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak" or "notch")<br/>- `freq`: number (filter's resonant frequency)<br/>- `q`: number (Q factor)<br/>- `gain`: number<br/>- `on`: boolean |
### visualizer
Display its value over time.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="visualizer_visualizer">visualizer<a class="headerlink" href="#visualizer_visualizer" title="Permanent link">#</a></h4> ||||
@ -291,6 +327,8 @@
### led
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="led_led">led<a class="headerlink" href="#led_led" title="Permanent link">#</a></h4> ||||
@ -299,6 +337,8 @@
### rgbled
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="rgbled_value">value<a class="headerlink" href="#rgbled_value" title="Permanent link">#</a></h4> ||||
@ -306,6 +346,8 @@
### meter
Non-interactable fader.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="meter_style">style<a class="headerlink" href="#meter_style" title="Permanent link">#</a></h4> ||||
@ -323,6 +365,8 @@
### text
Display text.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="text_text">text<a class="headerlink" href="#text_text" title="Permanent link">#</a></h4> ||||
@ -332,6 +376,8 @@
### image
Load a image (url or base64-encoded).
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="image_image">image<a class="headerlink" href="#image_image" title="Permanent link">#</a></h4> ||||
@ -345,6 +391,8 @@
### svg
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="svg_svg">svg<a class="headerlink" href="#svg_svg" title="Permanent link">#</a></h4> ||||
@ -352,6 +400,8 @@
### frame
Embed a page in a frame (local network only).
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="frame_style">style<a class="headerlink" href="#frame_style" title="Permanent link">#</a></h4> ||||
@ -365,6 +415,8 @@
### panel
Widget container.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="panel_panel">panel<a class="headerlink" href="#panel_panel" title="Permanent link">#</a></h4> ||||
@ -379,6 +431,8 @@
### strip
Widget container that display its children in a single column or row.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="strip_strip">strip<a class="headerlink" href="#strip_strip" title="Permanent link">#</a></h4> ||||
@ -393,6 +447,8 @@
### modal
A toggle button that opens a popup panel.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="modal_modal">modal<a class="headerlink" href="#modal_modal" title="Permanent link">#</a></h4> ||||
@ -410,6 +466,8 @@
### clone
Widget replication with overridable properties.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="clone_clone">clone<a class="headerlink" href="#clone_clone" title="Permanent link">#</a></h4> ||||
@ -421,6 +479,8 @@
### switcher
Store other widgets' values and recall them.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="switcher_switcher">switcher<a class="headerlink" href="#switcher_switcher" title="Permanent link">#</a></h4> ||||
@ -430,6 +490,8 @@
### crossfader
Switcher with linear interpolation slider.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="crossfader_crossfader">crossfader<a class="headerlink" href="#crossfader_crossfader" title="Permanent link">#</a></h4> ||||
@ -440,6 +502,8 @@
### input
Text input.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="input_input">input<a class="headerlink" href="#input_input" title="Permanent link">#</a></h4> ||||
@ -450,6 +514,8 @@
### keys
Keyboard binding.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="keys_keys">keys<a class="headerlink" href="#keys_keys" title="Permanent link">#</a></h4> ||||
@ -460,6 +526,8 @@
### script
Evaluates a script each time it receives a value.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="script_script">script<a class="headerlink" href="#script_script" title="Permanent link">#</a></h4> ||||
@ -468,6 +536,8 @@
### gyroscope
Device motion/orientation sensor.
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="gyroscope_gyroscope">gyroscope<a class="headerlink" href="#gyroscope_gyroscope" title="Permanent link">#</a></h4> ||||
@ -480,6 +550,8 @@
### file
File selector (server-side).
| property | type |default | description |
| --- | --- | --- | --- |
| <h4 class="thead2" id="file_input">input<a class="headerlink" href="#file_input" title="Permanent link">#</a></h4> ||||

View file

@ -51,6 +51,7 @@ for (var k in widgets.categories) {
for (var kk in category) {
var type = category[kk],
defaults = widgets.widgets[type].defaults(),
description = widgets.widgets[type].description(),
separator = false
@ -58,6 +59,8 @@ for (var k in widgets.categories) {
### ${type}
${description}
| property | type |default | description |
| --- | --- | --- | --- |`
)

View file

@ -33,6 +33,12 @@ setTimeout(()=>{
class Widget extends EventEmitter {
static description() {
return ''
}
static defaults(insert={}, except=[], push={}) {
var defaults = {

View file

@ -10,6 +10,12 @@ var excludedCloneClasses = ['widget', 'absolute-position', 'ui-resizable', 'ui-
class Clone extends Container {
static description() {
return 'Widget replication with overridable properties.'
}
static defaults() {
return super.defaults({

View file

@ -8,6 +8,12 @@ var Panel = require('./panel'),
module.exports = class Modal extends Panel {
static description() {
return 'A toggle button that opens a popup panel.'
}
static defaults() {
return Widget.defaults({

View file

@ -6,6 +6,12 @@ var Container = require('../common/container'),
class Panel extends Container {
static description() {
return 'Widget container.'
}
static defaults() {
return super.defaults({

View file

@ -3,6 +3,12 @@ var Panel = require('./panel'),
module.exports = class Strip extends Panel {
static description() {
return 'Widget container that display its children in a single column or row.'
}
static defaults() {
return Widget.defaults({

View file

@ -5,6 +5,12 @@ var Widget = require('../common/widget'),
module.exports = class Input extends Widget {
static description() {
return 'File selector (server-side).'
}
static defaults() {
return super.defaults({

View file

@ -8,6 +8,12 @@ var Widget = require('../common/widget'),
class Gyroscope extends Widget {
static description() {
return 'Device motion/orientation sensor.'
}
static defaults() {
return super.defaults({

View file

@ -4,6 +4,12 @@ var Canvas = require('../common/canvas'),
module.exports = class Input extends Canvas {
static description() {
return 'Text input.'
}
static defaults() {
return super.defaults({
@ -66,7 +72,7 @@ module.exports = class Input extends Canvas {
this.widget.insertBefore(this.input, this.canvas)
this.input.focus()
this.input.setSelectionRange(0, this.input.value.length)
}
blur(change=true) {

View file

@ -6,6 +6,12 @@ var Widget = require('../common/widget'),
class Keys extends Widget {
static description() {
return 'Keyboard binding.'
}
static defaults() {
return super.defaults({

View file

@ -7,6 +7,12 @@ var Widget = require('../common/widget'),
class Script extends Widget {
static description() {
return 'Evaluates a script each time it receives a value.'
}
static defaults() {
return super.defaults({

View file

@ -4,6 +4,12 @@ var _matrix_base = require('./_matrix_base'),
module.exports = class Keyboard extends _matrix_base {
static description() {
return 'Piano keyboard.'
}
static defaults() {
return super.defaults({

View file

@ -6,6 +6,12 @@ var _matrix_base = require('./_matrix_base'),
class Matrix extends _matrix_base {
static description() {
return 'Generic matrix for creating rows/columns of widgets.'
}
static defaults() {
return super.defaults({

View file

@ -53,6 +53,12 @@ class PatchBayNode extends Widget {
class PatchBay extends Canvas {
static description() {
return 'Connect inputs to outputs.'
}
static defaults() {
return super.defaults({

View file

@ -9,6 +9,12 @@ var xyDefaults = Xy.defaults()._props()
module.exports = class MultiXy extends Pad {
static description() {
return 'Multi-point XY pad.'
}
static defaults() {
return super.defaults({

View file

@ -10,6 +10,12 @@ var faderDefaults = Fader.defaults()._props(),
module.exports = class Rgb extends Pad {
static description() {
return 'Color picker with optional alpha slider.'
}
static defaults() {
return super.defaults({

View file

@ -8,6 +8,12 @@ var faderDefaults = Fader.defaults()._props()
module.exports = class Xy extends Pad {
static description() {
return 'Two-dimensional slider.'
}
static defaults() {
return super.defaults({

View file

@ -4,6 +4,12 @@ var {clip} = require('../utils'),
module.exports = class Eq extends _plots_base {
static description() {
return 'Draws frequency response between from from an array of filter objects.'
}
static defaults() {
return super.defaults({
@ -17,7 +23,19 @@ module.exports = class Eq extends _plots_base {
logScaleX: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (log10)'},
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
}, ['target', 'precision', 'bypass'], {})
}, ['target', 'precision', 'bypass'], {
value: {type: 'array', value: '', help: [
'Each item must be an object with the following properties',
'- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak" or "notch")',
'- `freq`: number (filter\'s resonant frequency)',
'- `q`: number (Q factor)',
'- `gain`: number',
'- `on`: boolean',
]}
})
}

View file

@ -5,6 +5,12 @@ var Widget = require('../common/widget'),
class Frame extends Widget {
static description() {
return 'Embed a page in a frame (local network only).'
}
static defaults() {
return super.defaults({

View file

@ -2,7 +2,13 @@ var Widget = require('../common/widget'),
ipc = require('../../ipc'),
html = require('nanohtml')
module.exports = class Led extends Widget {
module.exports = class Image extends Widget {
static description() {
return 'Load a image (url or base64-encoded).'
}
static defaults() {

View file

@ -3,6 +3,12 @@ var Fader = require('../sliders/fader'),
module.exports = class Meter extends Fader {
static description() {
return 'Non-interactable fader.'
}
static defaults() {
return Widget.defaults({

View file

@ -2,6 +2,12 @@ var _plots_base = require('./_plots_base')
module.exports = class Plot extends _plots_base {
static description() {
return 'XY coordinates plot.'
}
static defaults() {

View file

@ -4,6 +4,12 @@ var {iconify} = require('../../ui/utils'),
module.exports = class Text extends Widget {
static description() {
return 'Display text.'
}
static defaults() {
return super.defaults({

View file

@ -3,6 +3,12 @@ var {clip} = require('../utils'),
module.exports = class Visualizer extends _plots_base {
static description() {
return 'Display its value over time.'
}
static defaults() {
return super.defaults({

View file

@ -29,6 +29,12 @@ var DisplayKnob = class extends Knob {
module.exports = class Encoder extends Widget {
static description() {
return 'A knob that sends a relative direction infomation instead of an absolute value.'
}
static defaults() {
return super.defaults({

View file

@ -174,6 +174,12 @@ var RangeFader = class RangeFader extends Fader {
class Range extends Widget {
static description() {
return 'A fader with two heads for setting a range.'
}
static defaults() {
return super.defaults({

View file

@ -8,6 +8,12 @@ var faderDefaults = Fader.defaults()._props()
module.exports = class Crossfader extends Switcher {
static description() {
return 'Switcher with linear interpolation slider.'
}
static defaults(){
return Widget.defaults({
@ -21,7 +27,7 @@ module.exports = class Crossfader extends Switcher {
horizontal: {type: 'boolean', value: false, help: 'Set to `true` to display values horizontally'}
})
}
constructor(options) {

View file

@ -6,6 +6,12 @@ var switchDefaults = Switch.defaults()._props()
module.exports = class Switcher extends _switchers_base {
static description() {
return 'Store other widgets\' values and recall them.'
}
static defaults() {
return super.defaults({