diff --git a/src/client/app/widgets/buttons/dropdown.js b/src/client/app/widgets/buttons/dropdown.js
index 6a48aa5c..c8d56ebc 100644
--- a/src/client/app/widgets/buttons/dropdown.js
+++ b/src/client/app/widgets/buttons/dropdown.js
@@ -22,7 +22,7 @@ class Dropdown extends Widget {
constructor(options) {
- super({...options, html: '
'})
+ super({...options, html: html``})
this.select = this.widget.appendChild(html``)
diff --git a/src/client/app/widgets/buttons/push.js b/src/client/app/widgets/buttons/push.js
index 5dc008f4..cc124dc5 100644
--- a/src/client/app/widgets/buttons/push.js
+++ b/src/client/app/widgets/buttons/push.js
@@ -1,5 +1,6 @@
var Widget = require('../common/widget'),
- osc = require('../../osc')
+ osc = require('../../osc'),
+ html = require('nanohtml')
class Push extends Widget {
@@ -26,7 +27,7 @@ class Push extends Widget {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
this.state = 0
this.active = 0
diff --git a/src/client/app/widgets/buttons/switch.js b/src/client/app/widgets/buttons/switch.js
index 29fd5b92..cf085eea 100644
--- a/src/client/app/widgets/buttons/switch.js
+++ b/src/client/app/widgets/buttons/switch.js
@@ -23,7 +23,7 @@ module.exports = class Switch extends Widget {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
if (this.getProp('horizontal')) this.widget.classList.add('horizontal')
diff --git a/src/client/app/widgets/buttons/toggle.js b/src/client/app/widgets/buttons/toggle.js
index 1e0b059b..c87c6760 100644
--- a/src/client/app/widgets/buttons/toggle.js
+++ b/src/client/app/widgets/buttons/toggle.js
@@ -1,5 +1,6 @@
var Widget = require('../common/widget'),
- doubletab = require('../mixins/double_tap')
+ doubletab = require('../mixins/double_tap'),
+ html = require('nanohtml')
class Toggle extends Widget {
@@ -26,7 +27,7 @@ class Toggle extends Widget {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
this.state = 0
this.active = false
diff --git a/src/client/app/widgets/common/widget.js b/src/client/app/widgets/common/widget.js
index 7a2ccb69..ba996370 100644
--- a/src/client/app/widgets/common/widget.js
+++ b/src/client/app/widgets/common/widget.js
@@ -132,7 +132,7 @@ class Widget extends EventEmitter {
super()
- this.widget = DOM.create(options.html)
+ this.widget = options.html
this.props = options.props
this.errors = {}
this.parsers = {}
diff --git a/src/client/app/widgets/containers/clone.js b/src/client/app/widgets/containers/clone.js
index a3d75e88..b8e50514 100644
--- a/src/client/app/widgets/containers/clone.js
+++ b/src/client/app/widgets/containers/clone.js
@@ -3,7 +3,8 @@ var Container = require('../common/container'),
resize = require('../../events/resize'),
parser = require('../../parser'),
{deepCopy, deepEqual} = require('../../utils'),
- {diff, diffToWidget} = require('../../editor/diff')
+ {diff, diffToWidget} = require('../../editor/diff'),
+ html = require('nanohtml')
var excludedCloneClasses = ['widget', 'absolute-position', 'ui-resizable', 'ui-draggable', 'not-editable']
@@ -30,7 +31,7 @@ class Clone extends Container {
options.props.label = ''
options.props.variables = '@{parent.variables}'
- super({...options, html: ''})
+ super({...options, html: html``})
this.cloneLock = false
this.cloneTarget = null
diff --git a/src/client/app/widgets/containers/panel.js b/src/client/app/widgets/containers/panel.js
index e24ec3d5..3b06a189 100644
--- a/src/client/app/widgets/containers/panel.js
+++ b/src/client/app/widgets/containers/panel.js
@@ -35,7 +35,7 @@ class Panel extends Container {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
if (this.getProp('scroll') === false) this.widget.classList.add('noscroll')
if (this.getProp('border') === false) this.container.classList.add('noborder')
diff --git a/src/client/app/widgets/inputs/gyroscope.js b/src/client/app/widgets/inputs/gyroscope.js
index dfa3a27b..172ae988 100644
--- a/src/client/app/widgets/inputs/gyroscope.js
+++ b/src/client/app/widgets/inputs/gyroscope.js
@@ -1,6 +1,6 @@
var Widget = require('../common/widget'),
GyroNorm = require('gyronorm/dist/gyronorm.complete.min.js'),
- {iconify} = require('../../ui/utils'),
+ {icon} = require('../../ui/utils'),
{clip} = require('../utils')
class Gyroscope extends Widget {
@@ -41,9 +41,9 @@ class Gyroscope extends Widget {
constructor(options) {
- var html = `
+ var html = html`
- ${iconify('^compass')}
+ ${raw(icon('compass'))}
`
diff --git a/src/client/app/widgets/inputs/input.js b/src/client/app/widgets/inputs/input.js
index c76eb22d..5bf6f40a 100644
--- a/src/client/app/widgets/inputs/input.js
+++ b/src/client/app/widgets/inputs/input.js
@@ -21,13 +21,11 @@ module.exports = class Input extends Canvas {
constructor(options) {
- var htmlx = `
+ super({...options, html: html`
- `
-
- super({...options, html: htmlx})
+ `})
this.value = ''
this.stringValue = ''
diff --git a/src/client/app/widgets/inputs/keys.js b/src/client/app/widgets/inputs/keys.js
index 03616deb..29b7a60f 100644
--- a/src/client/app/widgets/inputs/keys.js
+++ b/src/client/app/widgets/inputs/keys.js
@@ -1,5 +1,5 @@
var Widget = require('../common/widget'),
- {iconify} = require('../../ui/utils'),
+ {icon} = require('../../ui/utils'),
keyboardJS = require('keyboardjs'),
html = require('nanohtml')
@@ -30,13 +30,11 @@ class Keys extends Widget {
constructor(options) {
- var html = `
+ super({...options, html: html`
- ${iconify('^keyboard')}
+ ${raw(icon('keyboard'))}
- `
-
- super({...options, html: html})
+ `})
if (this.getProp('binding')) {
diff --git a/src/client/app/widgets/inputs/script.js b/src/client/app/widgets/inputs/script.js
index 1e8f4826..5b9121fc 100644
--- a/src/client/app/widgets/inputs/script.js
+++ b/src/client/app/widgets/inputs/script.js
@@ -1,6 +1,7 @@
var Widget = require('../common/widget'),
widgetManager = require('../../managers/widgets'),
- {iconify} = require('../../ui/utils')
+ {icon} = require('../../ui/utils'),
+ html = require('nanohtml')
class Script extends Widget {
@@ -28,13 +29,11 @@ class Script extends Widget {
constructor(options) {
- var html = `
+ super({...options, html: html`
- ${iconify('^code')}
+ ${raw(icon('code'))}
- `
-
- super({...options, html: html})
+ `})
}
diff --git a/src/client/app/widgets/maths/formula.js b/src/client/app/widgets/maths/formula.js
index 380bcd9d..a3a9c4ca 100644
--- a/src/client/app/widgets/maths/formula.js
+++ b/src/client/app/widgets/maths/formula.js
@@ -1,7 +1,8 @@
var Widget = require('../common/widget'),
widgetManager = require('../../managers/widgets'),
{math} = require('../utils'),
- Input = require('../inputs/input')
+ Input = require('../inputs/input'),
+ html = require('nanohtml')
module.exports = class Formula extends Widget {
@@ -22,11 +23,10 @@ module.exports = class Formula extends Widget {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
- super({...options, html: html})
+ `})
this.formulaString = String(this.getProp('formula'))
diff --git a/src/client/app/widgets/matrices/_matrix_base.js b/src/client/app/widgets/matrices/_matrix_base.js
index b2e428a0..49c65839 100644
--- a/src/client/app/widgets/matrices/_matrix_base.js
+++ b/src/client/app/widgets/matrices/_matrix_base.js
@@ -1,12 +1,13 @@
var Container = require('../common/container'),
- {enableTraversingGestures} = require('../../events/drag')
+ {enableTraversingGestures} = require('../../events/drag'),
+ html = require('nanohtml')
module.exports = class _matrix_base extends Container {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
this.value = []
diff --git a/src/client/app/widgets/pads/pad.js b/src/client/app/widgets/pads/pad.js
index 8294d5c5..5e693fa3 100644
--- a/src/client/app/widgets/pads/pad.js
+++ b/src/client/app/widgets/pads/pad.js
@@ -1,18 +1,17 @@
-var Canvas = require('../common/canvas')
+var Canvas = require('../common/canvas'),
+ html = require('nanohtml')
module.exports = class Pad extends Canvas {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
-
- super({...options, html: html})
+ `})
this.wrapper = DOM.get(this.widget, '.wrapper')[0]
diff --git a/src/client/app/widgets/plots/_plots_base.js b/src/client/app/widgets/plots/_plots_base.js
index fe65523e..fe9fbb0e 100644
--- a/src/client/app/widgets/plots/_plots_base.js
+++ b/src/client/app/widgets/plots/_plots_base.js
@@ -1,17 +1,16 @@
var {mapToScale} = require('../utils'),
- Canvas = require('../common/canvas')
+ Canvas = require('../common/canvas'),
+ html = require('nanohtml')
module.exports = class _plots_base extends Canvas {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
-
- super({...options, html: html})
+ `})
this.value = []
this.rangeX = this.getProp('rangeX') || {min:0,max:1}
diff --git a/src/client/app/widgets/plots/frame.js b/src/client/app/widgets/plots/frame.js
index aac4402b..242ac719 100644
--- a/src/client/app/widgets/plots/frame.js
+++ b/src/client/app/widgets/plots/frame.js
@@ -30,7 +30,7 @@ class Frame extends Widget {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
if (!this.getProp('border')) this.container.classList.add('noborder')
diff --git a/src/client/app/widgets/plots/image.js b/src/client/app/widgets/plots/image.js
index 5a0b6ea0..4114c0b4 100644
--- a/src/client/app/widgets/plots/image.js
+++ b/src/client/app/widgets/plots/image.js
@@ -1,5 +1,6 @@
var Widget = require('../common/widget'),
- ipc = require('../../ipc')
+ ipc = require('../../ipc'),
+ html = require('nanohtml')
module.exports = class Led extends Widget {
@@ -31,11 +32,7 @@ module.exports = class Led extends Widget {
constructor(options) {
- var html = `
-
- `
-
- super({...options, html: html})
+ super({...options, html: html``})
if (!this.getProp('border')) this.container.classList.add('noborder')
diff --git a/src/client/app/widgets/plots/led.js b/src/client/app/widgets/plots/led.js
index 04269c82..3b0b6540 100644
--- a/src/client/app/widgets/plots/led.js
+++ b/src/client/app/widgets/plots/led.js
@@ -1,5 +1,6 @@
var {mapToScale} = require('../utils'),
- Widget = require('../common/widget')
+ Widget = require('../common/widget'),
+ html = require('nanohtml')
module.exports = class Led extends Widget {
@@ -24,12 +25,7 @@ module.exports = class Led extends Widget {
delete options.props.widgetId
}
- var html = `
-
-
- `
-
- super({...options, html: html})
+ super({...options, html: html``})
this.setValue(this.getProp('range').min)
diff --git a/src/client/app/widgets/plots/rgbled.js b/src/client/app/widgets/plots/rgbled.js
index 56c4fe7b..6bae6abe 100644
--- a/src/client/app/widgets/plots/rgbled.js
+++ b/src/client/app/widgets/plots/rgbled.js
@@ -1,5 +1,6 @@
var Widget = require('../common/widget'),
- {clip} = require('../utils')
+ {clip} = require('../utils'),
+ html = require('nanohtml')
module.exports = class Rbgled extends Widget {
@@ -25,12 +26,10 @@ module.exports = class Rbgled extends Widget {
delete options.props.widgetId
}
- var html = `
+ super({...options, html: html`
- `
-
- super({...options, html: html})
+ `})
this.setValue([0,0,0,0])
diff --git a/src/client/app/widgets/plots/svg.js b/src/client/app/widgets/plots/svg.js
index a5114131..fe1b8839 100644
--- a/src/client/app/widgets/plots/svg.js
+++ b/src/client/app/widgets/plots/svg.js
@@ -24,13 +24,11 @@ class Svg extends Widget {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
-
- super({...options, html: html})
+ `})
this.height = undefined
this.width = undefined
diff --git a/src/client/app/widgets/plots/text.js b/src/client/app/widgets/plots/text.js
index 28e97363..f332e7f4 100644
--- a/src/client/app/widgets/plots/text.js
+++ b/src/client/app/widgets/plots/text.js
@@ -1,5 +1,6 @@
var {iconify} = require('../../ui/utils'),
- Widget = require('../common/widget')
+ Widget = require('../common/widget'),
+ html = require('nanohtml')
module.exports = class Text extends Widget {
@@ -27,7 +28,7 @@ module.exports = class Text extends Widget {
options.props.value = '@{' + options.props.widgetId + '}'
delete options.props.widgetId
}
- super({...options, html: ''})
+ super({...options, html: html``})
if (this.getProp('vertical')) this.widget.classList.add('vertical')
if (this.getProp('align') === 'left') this.widget.classList.add('left')
diff --git a/src/client/app/widgets/sliders/encoder.js b/src/client/app/widgets/sliders/encoder.js
index c74f7333..bced97cd 100644
--- a/src/client/app/widgets/sliders/encoder.js
+++ b/src/client/app/widgets/sliders/encoder.js
@@ -1,7 +1,8 @@
var {clip} = require('../utils'),
Knob = require('./knob'),
Widget = require('../common/widget'),
- doubletab = require('../mixins/double_tap')
+ doubletab = require('../mixins/double_tap'),
+ html = require('nanohtml')
@@ -58,13 +59,12 @@ module.exports = class Encoder extends Widget {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
- super({...options, html: html})
+ `})
this.wrapper = DOM.get(this.widget, '.wrapper')[0]
this.ticks = Math.abs(parseInt(this.getProp('ticks')))
diff --git a/src/client/app/widgets/sliders/fader.js b/src/client/app/widgets/sliders/fader.js
index 0d96022b..84365e3d 100644
--- a/src/client/app/widgets/sliders/fader.js
+++ b/src/client/app/widgets/sliders/fader.js
@@ -112,26 +112,28 @@ module.exports = class Fader extends Slider {
this.widget.classList.add('has-pips')
- var pips = this.wrapper.appendChild(html``)
+
var pipTexts = {}
for (var k in this.rangeKeys) {
pipTexts[this.rangeKeys[k]]=this.rangeLabels[k]
}
- var pipsInner = ''
+ var pips = html``
for (var i=0;i<=100;i++) {
if (pipTexts[i]==undefined) continue
var pos = this.getProp('horizontal')?'left':'bottom'
- var piptext = `${Math.abs(pipTexts[i])>=1000?pipTexts[i]/1000+'k':pipTexts[i]}`
+ pips.appendChild(html`
+
+ ${Math.abs(pipTexts[i])>=1000?pipTexts[i]/1000+'k':pipTexts[i]}
+
+ `)
- var add = `
- ${piptext}
- `
- pipsInner = pipsInner + add
}
- pips.innerHTML = pipsInner
+
+ this.wrapper.appendChild(pips)
+
}
diff --git a/src/client/app/widgets/sliders/range.js b/src/client/app/widgets/sliders/range.js
index 52bfc944..685129cd 100644
--- a/src/client/app/widgets/sliders/range.js
+++ b/src/client/app/widgets/sliders/range.js
@@ -2,7 +2,8 @@ var {clip} = require('../utils'),
Widget = require('../common/widget'),
Fader = require('./fader'),
Input = require('../inputs/input'),
- touchstate = require('../mixins/touch_state')
+ touchstate = require('../mixins/touch_state'),
+ html = require('nanohtml')
var faderDefaults = Fader.defaults()._props()
@@ -211,13 +212,11 @@ module.exports = class Range extends Widget {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
-
- super({...options, html: html})
+ `})
this.wrapper = DOM.get(this.widget, '.wrapper')[0]
diff --git a/src/client/app/widgets/sliders/slider.js b/src/client/app/widgets/sliders/slider.js
index 82f9fa39..4340967e 100644
--- a/src/client/app/widgets/sliders/slider.js
+++ b/src/client/app/widgets/sliders/slider.js
@@ -2,21 +2,20 @@ var {clip, mapToScale} = require('../utils'),
Canvas = require('../common/canvas'),
touchstate = require('../mixins/touch_state'),
doubletab = require('../mixins/double_tap'),
- Input = require('../inputs/input')
+ Input = require('../inputs/input'),
+ html = require('nanohtml')
class Slider extends Canvas {
constructor(options) {
- var html = `
+ super({...options, html: html`
- `
-
- super({...options, html: html})
+ `})
this.wrapper = DOM.get(this.widget, '.wrapper')[0]
diff --git a/src/client/app/widgets/switchers/switcher.js b/src/client/app/widgets/switchers/switcher.js
index e5a8516c..87a84613 100644
--- a/src/client/app/widgets/switchers/switcher.js
+++ b/src/client/app/widgets/switchers/switcher.js
@@ -1,5 +1,6 @@
var _switchers_base = require('./_switchers_base'),
- Switch = require('../buttons/switch')
+ Switch = require('../buttons/switch'),
+ html = require('nanohtml')
var switchDefaults = Switch.defaults()._props()
@@ -27,7 +28,7 @@ module.exports = class Switcher extends _switchers_base {
constructor(options) {
- super({...options, html: ''})
+ super({...options, html: html``})
if (this.getProp('horizontal')) this.widget.classList.add('horizontal')