editor: continue embed doc

This commit is contained in:
jean-emmanuel 2018-08-30 14:47:25 +02:00
parent 5baf03d99f
commit 827ec01515
8 changed files with 33 additions and 20 deletions

View file

@ -9,6 +9,8 @@
- **new** `gyroscope` widget
- **new** `frame` widget
- **breaking change** in `panel`: dropped Visual Format Language support (`layout` and `spacing` properties)
- editor
- widget property names can be clicked to show documentation
- misc
- the client app can be translated (https://github.com/jean-emmanuel/open-stage-control/issues/302)

View file

@ -183,20 +183,21 @@ module.exports = function editField(editor, widget, propName, defaultValue){
label.addEventListener('fast-click', ()=>{
var htmlHelp = Array.isArray(defaultValue.help) ? defaultValue.help.join('<br/>') : defaultValue.help
htmlHelp = htmlHelp.replace(/`([^`]*)`/g, '<pre>$1</pre>')
htmlHelp = htmlHelp ? '<p class="help">' + htmlHelp.replace(/`([^`]*)`/g, '<code>$1</code>') + '</p>' : ''
var htmlError = error ? `<p class="error">${error}</p><br/></br>` : ''
var htmlError = error ? `<p class="error">${error}</p>` : ''
new Popup({closable: true, title: propName, content: `
<div class="editor-help">
Type: <pre>${defaultValue.type}</pre><br/>
Default: <pre>${defaultValue.value}</pre><br/><br/>
Dynamic: <pre>${dynamic ? 'true' : 'false'}</pre><br/><br/>
<p>Type: <code>${defaultValue.type}</code></p>
<p>Default: <code>${JSON.stringify(defaultValue.value)}</code></p>
<p>Dynamic: <code>${dynamic ? 'true' : 'false'}</code></p>
${htmlError}
<div class="usage">${htmlHelp}</div>
${htmlHelp}
</div>
`})
})

View file

@ -110,7 +110,7 @@ class Widget extends EventEmitter {
alterDefaults[m] = push[m]
}
alterDefaults._props = function() {
alterDefaults._props = function() {
var props = {}
for (var k in this) {
if (k[0] !== '_') {

View file

@ -21,9 +21,11 @@ class Panel extends Widget {
widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously.'},
tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A panel cannot contain widgets and tabs simultaneously'},
_value: 'value (tab selection)',
_osc:'osc (tab selection)'
value: {type: 'integer', value: '', help: [
'Defines currently opened tab in the widget',
'A a tab can be opened by setting its parent\'s value'
]},
})

View file

@ -14,9 +14,11 @@ module.exports = class Root extends Panel {
tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object'},
id: {type: 'string', value: 'root', help: 'Widgets sharing the same id will act as clones and update each other\'s value(s) without sending extra osc messages' },
_value: 'value (tab selection)',
_osc:'osc (tab selection)'
value: {type: 'integer', value: '', help: [
'Defines currently opened tab in the widget',
'A a tab can be opened by setting its parent\'s value'
]},
})
}

View file

@ -14,9 +14,10 @@ module.exports = class Tab extends Panel {
widgets: {type: 'array', value: [], help: 'Each element of the array must be a widget object. A tab cannot contain widgets and tabs simultaneously'},
tabs: {type: 'array', value: [], help: 'Each element of the array must be a tab object. A tab cannot contain widgets and tabs simultaneously'},
_value: 'value (tab selection)',
_osc:'osc (tab selection)'
value: {type: 'integer', value: '', help: [
'Defines currently opened tab in the widget',
'A a tab can be opened by setting its parent\'s value'
]},
})

View file

@ -25,7 +25,7 @@ module.exports = class Meter extends Fader {
'- `--color-gauge: color;`',
'- `--color-knob: color;`',
'- `--color-pips: color;`',
`- '--gauge-opacity: number;'`
'- `--gauge-opacity: number;`'
]},
})

View file

@ -463,17 +463,22 @@
.editor-help {
.error {
color: red
color: red;
margin-top: 10rem;
}
em {
font-style: italic;
}
pre {
code {
color: var(--color-accent);
padding: 2rem 3rem;
background: rgba(black, 0.2);
display: inline-block;
user-select: auto;
cursor: auto;
::selection{/* reset */}
}
.usage {
.help {
margin-top: 10rem;
}
}