minor fixes & stacktrace folding in terminal

This commit is contained in:
bordun 2020-03-13 16:28:43 +01:00
parent f58db44858
commit c4559315f7
11 changed files with 56 additions and 17 deletions

View file

@ -17,11 +17,11 @@ window.onerror = function(msg,url,row,col, error) {
}).join('\n')
ipc.send('errorLog', `[Renderer process error]\n${msg}\n${stringifiedStack}`)
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n${stringifiedStack}`)
}).catch(()=>{
ipc.send('errorLog', `[Renderer process error]\n${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
ipc.send('errorLog', `(ERROR, CLIENT) ${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
})

View file

@ -89,6 +89,8 @@ class UiTree extends UiWidget {
var content = this.parseWidgets(widgetManager.getWidgetById('root')[0], selectedWidgets)
if (!content) return
// morph DOM
if (this.mounted) {
morph(this.list.firstChild, content)
@ -155,6 +157,8 @@ class UiTree extends UiWidget {
parseWidgets(widget, selectedWidgets, depth = 1) {
if (!widget) return
var selected = selectedWidgets.includes(widget),
id = widget.getProp('id'),
node = html`<li class="${selected ? 'editing' : ''} ${!widget.getProp('visible') ? 'invisible' : ''}"
@ -168,7 +172,7 @@ class UiTree extends UiWidget {
if (this.expanded[id]) node.classList.add('expanded')
var sublist = node.appendChild(html`<ol style="--depth:${++depth};"></ol>`)
for (let child of widget.children) {
sublist.appendChild(this.parseWidgets(child, selectedWidgets, depth))
if (child) sublist.appendChild(this.parseWidgets(child, selectedWidgets, depth))
}
}

View file

@ -498,9 +498,6 @@ class Widget extends EventEmitter {
}
// backward compat
if (k === '_value') k = 'value'
var widgets = id == 'parent' && this.parent ?
[this.parent] : id == 'this' ? [this] :
widgetManager.getWidgetById(id)
@ -869,7 +866,7 @@ class Widget extends EventEmitter {
this.container.classList.remove('no-label')
var label = this.getProp('label') == 'auto'?
this.getProp('id'):
iconify(this.getProp('label').replace(/</g, '&lt;'))
iconify(String(this.getProp('label')).replace(/</g, '&lt;'))
this.label.innerHTML = label
this.container.appendChild(this.label)

View file

@ -65,7 +65,7 @@ module.exports = class Rgb extends Widget {
this.hue = new HueFader({props:{
...faderDefaults,
type: 'fader',
mode: 'line',
design: 'default',
label: false,
pips:false,
horizontal:false,
@ -84,6 +84,7 @@ module.exports = class Rgb extends Widget {
this.alpha = new Fader({props:{
...faderDefaults,
type: 'fader',
design: 'compact',
label:false,
pips:false,
horizontal:true,

View file

@ -17,9 +17,9 @@ module.exports = class Fader extends Slider {
_fader:'fader',
design: {type: 'string', value: 'compact', choices: ['compact', 'classic', 'round'], help: 'Design style'},
design: {type: 'string', value: 'default', choices: ['default', 'round', 'compact'], help: 'Design style'},
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'},
pips: {type: 'boolean', value: false, help: 'Set to `true` to show range breakpoints (ignored if `design` is `compact`)'},
dashed: {type: 'boolean', value: false, help: 'Set to `true` to display a dashed gauge'},
gradient: {type: 'array|object', value: [], help: [
'When set, the meter\'s gauge will be filled with a linear color gradient',
@ -162,7 +162,7 @@ module.exports = class Fader extends Slider {
super.cacheCanvasStyle(style)
if (this.getProp('pips')) this.drawPips()
if (this.getProp('pips') && this.getProp('design') !== 'compact') this.drawPips()
}
@ -253,7 +253,7 @@ module.exports = class Fader extends Slider {
this.clearRect = [0, 0, width, height]
} else if (this.getProp('design') === 'classic') {
} else if (this.getProp('design') === 'default') {
if (this.cssVars.alphaStroke) {
@ -300,7 +300,7 @@ module.exports = class Fader extends Slider {
this.ctx.fillStyle = this.cssVars.colorFill
this.ctx.beginPath()
this.ctx.arc(m, d, 10 * PXSCALE, 0, 2 * Math.PI)
this.ctx.arc(m, d, 9 * PXSCALE, 0, 2 * Math.PI)
this.ctx.fill()
}
@ -308,7 +308,7 @@ module.exports = class Fader extends Slider {
}
if (this.getProp('pips')) {
if (this.getProp('pips') && !compact) {
this.ctx.globalAlpha = 1
this.ctx.drawImage(this.pips, 0, 0);
if (!compact) this.clearRect = [this.clearRect, [m + 10 * PXSCALE, 0, 10 * PXSCALE + this.pipsTextSize, height]]

View file

@ -16,9 +16,18 @@ class Terminal {
})
ipcRenderer.on('stderr', (e, msg)=>{
if (msg.includes('\n at') && msg.split('\n at').length > 2) {
msg = msg.replace('\n at', '<div class="trace"><div class="trace-button"></div> at') + '</div>'
}
this.log(ansiHTML(msg), 'error')
})
this.content.addEventListener('click', (e)=>{
if (e.target.classList.contains('trace-button')) {
e.target.parentNode.classList.toggle('show')
}
})
}
log(message, iclass = '') {

View file

@ -157,6 +157,30 @@ osc-settings-checkbox, osc-settings-reset, osc-settings-file {
opacity: 0.75;
}
.trace {
position: relative;
height: 18rem;
overflow: hidden;
&.show {
height: auto;
.trace-button:before {
content: "\f078";
}
}
}
.trace-button {
&:before {
content: "\f054";
font-size: 10rem;
font-family: FontAwesome;
}
position: absolute;
left: 0;
margin-top: -1rem;
cursor: pointer;
user-select: none;
}
a {
text-decoration: underline;
cursor: pointer;

View file

@ -52,7 +52,8 @@ $padding: 8rem;
overflow: hidden;
}
> i {
margin-right: 5rem;
display: block;
margin-right: 10rem;
}
&.closable {
padding-right: 0;

View file

@ -27,7 +27,7 @@
text-align: left;
}
&.design-classic {
&.design-default {
--widget-padding: 10rem;
--alpha-stroke: 0.5;
--alpha-fill-off: 0.25;

View file

@ -59,9 +59,12 @@ module.exports = {
// add session to history
recentSessions.unshift(path.resolve(data))
// remove doubles from history
recentSessions = recentSessions.reverse()
recentSessions = recentSessions.filter(function(elem, index, self) {
return index == self.indexOf(elem)
})
recentSessions = recentSessions.reverse()
// history size limit
if (recentSessions.length > 10) recentSessions = recentSessions.slice(0, 10)

View file

@ -72,7 +72,7 @@ module.exports = function(options={}) {
// already registered in app menu on macOs
// ISSUE seems to bind ctrl+z as well (FR keyboard ?)
shortcut.register(window,'CmdOrCtrl+W',function(){
window.close()
// window.close()
})
}