widgets: clean label removal and lint

This commit is contained in:
bordun 2020-04-23 19:42:53 +02:00
parent 61630803e4
commit a3e49f1bcd
3 changed files with 4 additions and 37 deletions

View file

@ -6,7 +6,6 @@ var EventEmitter = require('../../events/event-emitter'),
Vm = require('../vm'),
vm = new Vm(),
scopeCss = require('scope-css'),
{iconify} = require('../../ui/utils'),
resize = require('../../events/resize'),
OscReceiver = require('./osc-receiver'),
{deepCopy, deepEqual, isJSON} = require('../../utils'),
@ -52,11 +51,6 @@ class Widget extends EventEmitter {
type: {type: 'string', value: 'auto', help: ''},
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.' },
// 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`',
// ]},
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.'},
@ -214,8 +208,7 @@ class Widget extends EventEmitter {
this.container = html`
<div class="widget ${options.props.type}-container" id="${this.hash}" data-widget="${this.hash}"></div>
`
// this.label = html`<label></label>`
// if (this.getProp('label') !== false) this.container.appendChild(this.label)
if (this.widget) this.container.appendChild(this.widget)
this.container._widget_instance = this
@ -797,13 +790,6 @@ class Widget extends EventEmitter {
this.container.classList.toggle('no-interaction', !this.getProp('interaction'))
return
// case 'label':
// this.setContainerStyles(['label'])
// if (oldPropValue === false || this.getProp('label') === false) {
// resize.check(this.container)
// }
// return
case 'css': {
this.setContainerStyles(['css'])
var re = /width|height|display|margin|padding|flex/
@ -854,7 +840,7 @@ class Widget extends EventEmitter {
}
setContainerStyles(styles = ['geometry', 'label', 'css', 'visibility']) {
setContainerStyles(styles = ['geometry', 'css', 'visibility']) {
if (styles.includes('geometry')) {
@ -884,24 +870,6 @@ class Widget extends EventEmitter {
}
// if (styles.includes('label')) {
//
// // label
// if (this.getProp('label') === false) {
// this.container.classList.add('no-label')
// this.label.innerHTML = ''
// } else {
// this.container.classList.remove('no-label')
// var label = this.getProp('label') == 'auto'?
// this.getProp('id'):
// iconify(String(this.getProp('label')).replace(/</g, '&lt;'))
//
// this.label.innerHTML = label
// this.container.appendChild(this.label)
// }
//
// }
if (styles.includes('css')) {
// css
@ -1063,7 +1031,6 @@ Widget.cssVariables = [
Widget.dynamicProps = [
'visible',
'label',
'interaction',
'top',

View file

@ -267,6 +267,7 @@ class Modal extends Panel {
}
Modal.dynamicProps = Modal.prototype.constructor.dynamicProps.concat(
'label',
'popupLabel'
)

View file

@ -1,8 +1,7 @@
var Panel = require('./panel'),
Widget = require('../common/widget'),
resize = require('../../events/resize'),
{iconify} = require('../../ui/utils'),
html = require('nanohtml')
{iconify} = require('../../ui/utils')
module.exports = class Tab extends Panel {