ui progress
This commit is contained in:
parent
42c99aaece
commit
1fadea7a6b
37 changed files with 773 additions and 788 deletions
|
|
@ -1,5 +1,4 @@
|
|||
var editField = require('./edit-field'),
|
||||
{updateWidget, incrementWidget} = require('./data-workers'),
|
||||
var {updateWidget, incrementWidget} = require('./data-workers'),
|
||||
keyboardJS = require('keyboardjs'),
|
||||
{diff, diffToWidget} = require('./diff'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
require('./stacktrace')
|
||||
require('./globals')
|
||||
|
||||
var {loading} = require('./ui/utils'),
|
||||
var uiLoading = require('./ui/ui-loading'),
|
||||
locales = require('./locales')
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(event) {
|
||||
|
||||
DOM.init()
|
||||
|
||||
LOADING = loading(locales('loading_server'))
|
||||
LOADING = uiLoading(locales('loading_server'))
|
||||
|
||||
setTimeout(()=>{
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ var utils = require('../ui/utils'),
|
|||
locales = require('../locales'),
|
||||
{deepCopy} = require('../utils'),
|
||||
sidepanel = require('../ui/sidepanel'),
|
||||
UiModal = require('../ui/ui-modal'),
|
||||
notifications = require('../ui/notifications'),
|
||||
{TRAVERSING_SAMEWIDGET} = require('../events/utils'),
|
||||
raw = require('nanohtml/raw'),
|
||||
|
|
@ -82,7 +83,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
error: function(data){
|
||||
new utils.Popup({title: raw(utils.icon('exclamation-triangle') + ' ' + locales('error')), content: raw(data), closable:true})
|
||||
new UiModal({title: raw(utils.icon('exclamation-triangle') + ' ' + locales('error')), content: raw(data), closable:true})
|
||||
},
|
||||
|
||||
reloadCss: function(){
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
var ipc = require('../ipc/'),
|
||||
parser = require('../parser'),
|
||||
editor = require('../editor/'),
|
||||
lobby = require('../ui/lobby'),
|
||||
{loading, icon, Popup, upload, remoteBrowse} = require('../ui/utils'),
|
||||
{icon} = require('../ui/utils'),
|
||||
UiModal = require('../ui/ui-modal'),
|
||||
UiModal = require('../ui/ui-modal'),
|
||||
uiLobby = require('../ui/ui-lobby'),
|
||||
uiFilebrowser = require('../ui/ui-filebrowser'),
|
||||
uiFileupload = require('../ui/ui-fileupload'),
|
||||
uiLoading = require('../ui/ui-loading'),
|
||||
{saveAs} = require('file-saver'),
|
||||
widgetManager = require('./widgets'),
|
||||
html = require('nanohtml'),
|
||||
|
|
@ -32,7 +37,7 @@ var SessionManager = class SessionManager {
|
|||
this.lock = true
|
||||
|
||||
var container = DOM.get('#osc-container')[0],
|
||||
loader = loading(locales('loading_session'))
|
||||
loader = uiLoading(locales('loading_session'))
|
||||
|
||||
setTimeout(()=>{
|
||||
try {
|
||||
|
|
@ -55,7 +60,7 @@ var SessionManager = class SessionManager {
|
|||
|
||||
} catch (err) {
|
||||
loader.close()
|
||||
new Popup({title: locales('session_parsingerror'), content: err.message, icon: 'exclamation-triangle', closable:true})
|
||||
new UiModal({title: locales('session_parsingerror'), content: err.message, icon: 'exclamation-triangle', closable:true})
|
||||
this.lock = false
|
||||
ipc.send('sessionSetPath', {path: this.sessionPath})
|
||||
throw err
|
||||
|
|
@ -77,7 +82,7 @@ var SessionManager = class SessionManager {
|
|||
DOM.dispatchEvent(window, 'resize')
|
||||
|
||||
setTimeout(()=>{
|
||||
lobby.close()
|
||||
uiLobby.close()
|
||||
loader.close()
|
||||
container.classList.add('show')
|
||||
this.lock = false
|
||||
|
|
@ -109,7 +114,7 @@ var SessionManager = class SessionManager {
|
|||
|
||||
if (!this.session || READ_ONLY) return
|
||||
|
||||
remoteBrowse({extension: 'json', save:true, directory: this.lastDir}, (path)=>{
|
||||
uiFilebrowser({extension: 'json', save:true, directory: this.lastDir}, (path)=>{
|
||||
this.lastDir = path[0]
|
||||
this.save(path)
|
||||
})
|
||||
|
|
@ -142,7 +147,7 @@ var SessionManager = class SessionManager {
|
|||
path = path.substr(0,Math.floor((path.length)/2)-(length-max)/2) + '...' + path.substr(Math.ceil((path.length)/2)+(length-max)/2, path.length)
|
||||
}
|
||||
|
||||
lobby.list.appendChild(html`
|
||||
uiLobby.list.appendChild(html`
|
||||
<a href="#" tabIndex="0" class="btn load" data-session="${data[i]}">
|
||||
${file} <em style="opacity:0.45">(${path})</em>
|
||||
${READ_ONLY? '' : html`<span>${raw(icon('times'))}</span>`}
|
||||
|
|
@ -151,21 +156,21 @@ var SessionManager = class SessionManager {
|
|||
|
||||
}
|
||||
|
||||
lobby.list.addEventListener('click', function(e){
|
||||
uiLobby.list.addEventListener('click', function(e){
|
||||
e.preventDefault()
|
||||
if (e.target.hasAttribute('data-session')) {
|
||||
ipc.send('sessionOpen',{path:e.target.getAttribute('data-session')})
|
||||
} else if (!READ_ONLY && e.target.tagName == 'SPAN') {
|
||||
ipc.send('sessionRemoveFromHistory',e.target.parentNode.getAttribute('data-session'))
|
||||
lobby.list.removeChild(e.target.parentNode)
|
||||
uiLobby.list.removeChild(e.target.parentNode)
|
||||
}
|
||||
})
|
||||
|
||||
if (!READ_ONLY) {
|
||||
|
||||
var brw = lobby.footer.appendChild(html`<a href="#" tabindex="0" class="btn browse">${raw(icon('folder-open'))} ${locales('session_browse')}</a>`)
|
||||
var imp = lobby.footer.appendChild(html`<a href="#" tabindex="0" class="btn import">${raw(icon('upload'))} ${locales('editor_import')}</a>`)
|
||||
var nws = lobby.footer.appendChild(html`<a href="#" tabindex="0" class="btn new">${raw(icon('file'))} ${locales('session_new')}</a>`)
|
||||
var brw = uiLobby.footer.appendChild(html`<a href="#" tabindex="0" class="btn browse">${raw(icon('folder-open'))} ${locales('session_browse')}</a>`)
|
||||
var imp = uiLobby.footer.appendChild(html`<a href="#" tabindex="0" class="btn import">${raw(icon('upload'))} ${locales('editor_import')}</a>`)
|
||||
var nws = uiLobby.footer.appendChild(html`<a href="#" tabindex="0" class="btn new">${raw(icon('file'))} ${locales('session_new')}</a>`)
|
||||
|
||||
brw.addEventListener('click', (e)=>{
|
||||
this.browse()
|
||||
|
|
@ -181,12 +186,12 @@ var SessionManager = class SessionManager {
|
|||
|
||||
}
|
||||
|
||||
DOM.addEventListener(lobby.html, 'mousedown touchstart', function(e){
|
||||
DOM.addEventListener(uiLobby.container, 'mousedown touchstart', function(e){
|
||||
if (e.type == 'mousedown') e.preventDefault()
|
||||
e.target.blur()
|
||||
})
|
||||
|
||||
lobby.open()
|
||||
uiLobby.open()
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +208,7 @@ var SessionManager = class SessionManager {
|
|||
|
||||
if (READ_ONLY) return
|
||||
|
||||
remoteBrowse({extension: 'json', directory: this.lastDir}, (path)=>{
|
||||
uiFilebrowser({extension: 'json', directory: this.lastDir}, (path)=>{
|
||||
if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return
|
||||
this.lastDir = path[0]
|
||||
ipc.send('sessionOpen',{path:path})
|
||||
|
|
@ -215,12 +220,12 @@ var SessionManager = class SessionManager {
|
|||
|
||||
if (READ_ONLY) return
|
||||
|
||||
upload('.json', (path, result)=>{
|
||||
uiFileupload('.json', (path, result)=>{
|
||||
var session
|
||||
try {
|
||||
session = JSON.parse(result)
|
||||
} catch (err) {
|
||||
new Popup({title: locales('session_parsingerror'), content: err, icon: 'exclamation-triangle', closable:true})
|
||||
new UiModal({title: locales('session_parsingerror'), content: err, icon: 'exclamation-triangle', closable:true})
|
||||
}
|
||||
if (editor.unsavedSession && !confirm(locales('session_unsaved'))) return
|
||||
if (session) sessionManager.load(session, ()=>{
|
||||
|
|
@ -228,7 +233,7 @@ var SessionManager = class SessionManager {
|
|||
})
|
||||
|
||||
}, ()=>{
|
||||
new Popup({title: locales('error'), content: locales('session_uploaderror'), icon: 'exclamation-triangle', closable:true})
|
||||
new UiModal({title: locales('error'), content: locales('session_uploaderror'), icon: 'exclamation-triangle', closable:true})
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var ipc = require('../ipc'),
|
||||
widgetManager = require('./widgets'),
|
||||
{upload, remoteBrowse} = require('../ui/utils'),
|
||||
uiFilebrowser = require('../ui/ui-filebrowser'),
|
||||
uiFileupload = require('../ui/ui-fileupload'),
|
||||
notifications = require('../ui/notifications'),
|
||||
{saveAs} = require('file-saver'),
|
||||
locales = require('../locales'),
|
||||
|
|
@ -103,7 +104,7 @@ var StateManager = class StateManager {
|
|||
|
||||
saveAs() {
|
||||
|
||||
remoteBrowse({extension: 'state', save:true, directory: this.lastDir}, (path)=>{
|
||||
uiFilebrowser({extension: 'state', save:true, directory: this.lastDir}, (path)=>{
|
||||
this.lastDir = path[0]
|
||||
this.save(path)
|
||||
})
|
||||
|
|
@ -112,7 +113,7 @@ var StateManager = class StateManager {
|
|||
|
||||
browse() {
|
||||
|
||||
remoteBrowse({extension: 'state', directory: this.lastDir}, (path)=>{
|
||||
uiFilebrowser({extension: 'state', directory: this.lastDir}, (path)=>{
|
||||
this.lastDir = path[0]
|
||||
ipc.send('stateOpen',{path: path})
|
||||
})
|
||||
|
|
@ -162,7 +163,7 @@ var StateManager = class StateManager {
|
|||
|
||||
import() {
|
||||
|
||||
upload('.state', (path, result)=>{
|
||||
uiFileupload('.state', (path, result)=>{
|
||||
this.load(result, true)
|
||||
}, (e)=>{
|
||||
this.loadError()
|
||||
|
|
@ -194,7 +195,7 @@ var StateManager = class StateManager {
|
|||
|
||||
if (!path) return
|
||||
this.statePath = path
|
||||
|
||||
|
||||
}
|
||||
|
||||
pushValueState(id, value) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
var screenfull = require('screenfull'),
|
||||
{Popup} = require('./utils'),
|
||||
UiModal = require('./ui-modal'),
|
||||
locales = require('../locales')
|
||||
|
||||
var fullscreen
|
||||
|
|
@ -21,7 +21,7 @@ if (screenfull.isEnabled) {
|
|||
|
||||
toggle(){
|
||||
|
||||
new Popup({
|
||||
new UiModal({
|
||||
title: locales('fs_unnavailable'),
|
||||
content: locales('fs_addtohome'),
|
||||
closable: true
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
require('./zoom')
|
||||
require('./lobby').create()
|
||||
// require('./lobby').create()
|
||||
// require('./sidepanel')
|
||||
require('../events/click')
|
||||
require('./ios')
|
||||
require('./notifications')
|
||||
require('./ui-workspace')
|
||||
// require('./ui-sidepanel')
|
||||
|
||||
var UiModal = require('./ui-modal')
|
||||
|
||||
module.exports = {
|
||||
|
||||
uiModal: new UiModal({selector: 'osc-modal-container'})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
var html = require('nanohtml')
|
||||
|
||||
class Lobby {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.state = 0
|
||||
|
||||
}
|
||||
|
||||
create() {
|
||||
|
||||
this.html = html`
|
||||
<div id="lobby">
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
${PACKAGE.productName}
|
||||
</div>
|
||||
<div class="list"></div>
|
||||
<div class="footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
this.main = DOM.get(this.html, '.main')[0]
|
||||
this.list = DOM.get(this.html, '.list')[0]
|
||||
this.footer = DOM.get(this.html, '.footer')[0]
|
||||
|
||||
}
|
||||
|
||||
open() {
|
||||
if (this.state) return
|
||||
this.state = 1
|
||||
document.body.appendChild(this.html)
|
||||
setTimeout(()=>{
|
||||
this.main.classList.add('show')
|
||||
})
|
||||
}
|
||||
|
||||
close() {
|
||||
if (!this.state) return
|
||||
this.state = 0
|
||||
this.main.classList.remove('show')
|
||||
document.body.removeChild(this.html)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var lobby = new Lobby()
|
||||
|
||||
module.exports = lobby
|
||||
|
|
@ -144,8 +144,8 @@ class UiDragResize extends UiWidget {
|
|||
|
||||
var handlesVisibility = [
|
||||
!(widget instanceof Tab) && widget.parent.getProp('layout') === 'default', // nw
|
||||
widget.parent.getProp('layout') !== 'vertical', // e
|
||||
widget.parent.getProp('layout') !== 'horizontal', // s
|
||||
widget.parent.getProp('layout').match(/horizontal|default/), // e
|
||||
widget.parent.getProp('layout').match(/vertical|default/), // s
|
||||
]
|
||||
handlesVisibility.push(handlesVisibility[1] && handlesVisibility[2]) // se
|
||||
|
||||
|
|
|
|||
206
src/client/ui/ui-filebrowser.js
Normal file
206
src/client/ui/ui-filebrowser.js
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
var locales = require('../locales'),
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
ipc = require('../ipc'),
|
||||
doubleClick = require('../events/double-click'),
|
||||
{icon} = require('./utils'),
|
||||
UiModal = require('./ui-modal')
|
||||
|
||||
|
||||
module.exports = function UiFilebrowser(options, callback) {
|
||||
|
||||
var save = options.save,
|
||||
saveInputFocus = undefined
|
||||
|
||||
var popup = new UiModal({
|
||||
closable: true,
|
||||
title: locales(save ? 'remotesave_save' : 'remotesave_open'),
|
||||
hide: true
|
||||
})
|
||||
|
||||
var container = DOM.get(popup.container, '.popup-content')[0],
|
||||
browser = html`<div class="file-browser"></div>`,
|
||||
ariane = html`<div class="ariane"></div>`,
|
||||
list = html`<form class="file-list"></form>`,
|
||||
saveInput = html`<input type="text" class="save-as no-keybinding" placeholder="${options.extension ? '*.' + options.extension : ''}" ${options.save ? '' : 'disabled'}/>`,
|
||||
actions = html`
|
||||
<div class="file-actions">
|
||||
${saveInput}
|
||||
<div class="btn cancel">${raw(icon('times'))} Cancel</div>
|
||||
${
|
||||
save ?
|
||||
html`<div class="btn submit save">${raw(icon('save'))} Save</div>` :
|
||||
html`<div class="btn submit open">${raw(icon('folder-open'))} Open</div>`
|
||||
}
|
||||
</div>
|
||||
`
|
||||
|
||||
var files = [],
|
||||
path = ''
|
||||
|
||||
var extRe = options.extension ? new RegExp('.*\\.' + options.extension + '$') : /.*/
|
||||
|
||||
if (save) {
|
||||
saveInput.addEventListener('change', ()=>{
|
||||
if (!saveInput.value.match(extRe)) saveInput.value += '.' + options.extension
|
||||
})
|
||||
saveInput.addEventListener('focus', ()=>{
|
||||
saveInputFocus = true
|
||||
})
|
||||
list.addEventListener('change', ()=>{
|
||||
saveInputFocus = false
|
||||
var choice = DOM.get(list, ':checked')[0]
|
||||
if (choice && choice.classList.contains('file')) {
|
||||
saveInput.value = choice.value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
doubleClick(list, submit, {click: true})
|
||||
|
||||
function submit(){
|
||||
|
||||
var choice = DOM.get(list, ':checked')[0]
|
||||
|
||||
if (!choice && (!save || !saveInput.value) && !options.loadDir) return
|
||||
|
||||
if (choice && choice.classList.contains('folder') && (!save || !saveInputFocus)) {
|
||||
ipc.send('listDir', {path: [path, choice.value]})
|
||||
} else {
|
||||
if (save) {
|
||||
if (files.some(x=>x.name===saveInput.value)) {
|
||||
if (!confirm(locales('remotesave_overwrite'))) return
|
||||
}
|
||||
callback([path, saveInput.value])
|
||||
popup.close()
|
||||
} else {
|
||||
callback([path, choice ? choice.value : ''])
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
actions.addEventListener('click', (e)=>{
|
||||
if (e.target.classList.contains('submit')) {
|
||||
submit()
|
||||
} else if ((e.target.classList.contains('cancel'))){
|
||||
popup.close()
|
||||
}
|
||||
})
|
||||
|
||||
function keyDownHandler(e){
|
||||
|
||||
if (e.keyCode === 13) {
|
||||
if (save) {
|
||||
document.addEventListener('keyup', keyUpHandler)
|
||||
} else {
|
||||
submit()
|
||||
}
|
||||
} else if (e.target === saveInput) {
|
||||
return
|
||||
} else if (e.keyCode === 8) {
|
||||
list.childNodes[0].firstElementChild.checked = true
|
||||
submit()
|
||||
} else if (e.key.length === 1) {
|
||||
var letter = e.key.toLowerCase(),
|
||||
current = DOM.get(list, ':checked')[0],
|
||||
minIndex = -1,
|
||||
index = -1
|
||||
|
||||
if (current) minIndex = DOM.index(current.parentNode)
|
||||
|
||||
for (let i in files) {
|
||||
if (files[i].name[0].toLowerCase() === letter && !list.childNodes[i].firstElementChild.checked) {
|
||||
if (index === -1) index = i
|
||||
if (minIndex !== -1 && i < minIndex) continue
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (index !== -1) {
|
||||
list.childNodes[index].firstElementChild.click()
|
||||
list.childNodes[index].firstElementChild.focus()
|
||||
}
|
||||
}
|
||||
}
|
||||
function keyUpHandler(e){
|
||||
|
||||
if (e.keyCode === 13) {
|
||||
setTimeout(submit, 100)
|
||||
document.removeEventListener('keyup', keyUpHandler)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', keyDownHandler)
|
||||
|
||||
ipc.on('listDir', (data)=>{
|
||||
|
||||
ariane.textContent = path = data.path
|
||||
|
||||
files = data.files.filter(x=>x.folder || x.name.match(extRe))
|
||||
|
||||
|
||||
function alphaSort(a, b){
|
||||
// convert to strings and force lowercase
|
||||
a = typeof a.name === 'string' ? a.name.toLowerCase() : a.name.toString()
|
||||
b = typeof b.name === 'string' ? b.name.toLowerCase() : b.name.toString()
|
||||
return a.localeCompare(b)
|
||||
}
|
||||
|
||||
var fo = files.filter(x=>x.folder),
|
||||
fi = files.filter(x=>!x.folder)
|
||||
|
||||
fo.sort(alphaSort)
|
||||
fi.sort(alphaSort)
|
||||
|
||||
files = fo.concat(fi)
|
||||
|
||||
files.unshift({
|
||||
name: '..',
|
||||
folder: true
|
||||
})
|
||||
|
||||
|
||||
browser.removeChild(list)
|
||||
list.innerHTML = ''
|
||||
for (let i in files) {
|
||||
var file = files[i]
|
||||
list.appendChild(html`
|
||||
<div class="file">
|
||||
<input type="radio" value="${file.name}" name="file" class="${file.folder ? 'folder' : 'file'}"/>
|
||||
<div class="label"><span>${raw(icon(file.folder ? 'folder' : 'osc'))} ${file.name}</span></div>
|
||||
</div>
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
browser.insertBefore(list, actions)
|
||||
|
||||
|
||||
if (save && saveInputFocus === undefined) {
|
||||
saveInput.focus()
|
||||
} else {
|
||||
list.childNodes[0].firstElementChild.focus()
|
||||
}
|
||||
|
||||
}, {context: popup})
|
||||
|
||||
popup.on('close', ()=>{
|
||||
ipc.off('listDir', null, popup)
|
||||
document.removeEventListener('keydown', keyDownHandler)
|
||||
document.removeEventListener('keyup', keyUpHandler)
|
||||
})
|
||||
|
||||
browser.appendChild(ariane)
|
||||
browser.appendChild(list)
|
||||
browser.appendChild(actions)
|
||||
container.appendChild(browser)
|
||||
|
||||
ipc.send('listDir', {extension: options.extension, path: options.directory ? [options.directory] : null})
|
||||
|
||||
popup.open()
|
||||
|
||||
}
|
||||
40
src/client/ui/ui-fileupload.js
Normal file
40
src/client/ui/ui-fileupload.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
var locales = require('../locales'),
|
||||
uiLoading = require('./ui-loading'),
|
||||
html = require('nanohtml'),
|
||||
SINGLETON = null,
|
||||
CONTAINER = null
|
||||
|
||||
module.exports = function uiFileUpload(types, ok, error) {
|
||||
|
||||
if (!CONTAINER) CONTAINER = DOM.get('osc-modal-container')[0]
|
||||
|
||||
if (SINGLETON) CONTAINER.removeChild(uploadSingleton)
|
||||
|
||||
SINGLETON = html`<input type="file" accept="${types}" style="position:absolute;opacity:0;pointer-events:none;"/>`
|
||||
|
||||
CONTAINER.appendChild(SINGLETON)
|
||||
|
||||
SINGLETON.addEventListener('change',function(e){
|
||||
|
||||
|
||||
var reader = new FileReader(),
|
||||
file = e.target.files[0],
|
||||
loader = uiLoading(locales('loading_upload'))
|
||||
|
||||
reader.onerror = reader.onabort = function() {
|
||||
loader.close()
|
||||
error()
|
||||
}
|
||||
|
||||
reader.onload = function(e) {
|
||||
loader.close()
|
||||
ok(file.path, e.target.result)
|
||||
}
|
||||
|
||||
reader.readAsText(file, 'utf-8')
|
||||
|
||||
})
|
||||
|
||||
SINGLETON.click()
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ var UiWidget = require('./ui-widget'),
|
|||
{categories} = require('../widgets/'),
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
{icon, Popup} = require('../ui/utils'),
|
||||
{icon} = require('../ui/utils'),
|
||||
chroma = require('chroma-js')
|
||||
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ class UiInspectorField extends UiWidget {
|
|||
this.container = html`<osc-inspector-field></osc-inspector-field>`
|
||||
this.label = this.container.appendChild(html`<label>${this.name}</label>`)
|
||||
|
||||
if (this.name === 'type') this.createTypeSelect()
|
||||
if (this.name === 'type' || this.name === 'widgetType') this.createTypeSelect()
|
||||
else this.createInput()
|
||||
|
||||
}
|
||||
|
|
|
|||
12
src/client/ui/ui-loading.js
Normal file
12
src/client/ui/ui-loading.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
var html = require('nanohtml'),
|
||||
UiModal = require('./ui-modal')
|
||||
|
||||
module.exports = function uiLoading(title) {
|
||||
|
||||
return new UiModal({
|
||||
title: title,
|
||||
content: html`<p><div class="spinner"></div></p>`,
|
||||
closable: false
|
||||
})
|
||||
|
||||
}
|
||||
44
src/client/ui/ui-lobby.js
Normal file
44
src/client/ui/ui-lobby.js
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
var html = require('nanohtml'),
|
||||
UiModal = require('./ui-modal')
|
||||
|
||||
class UiLobby {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.state = 0
|
||||
|
||||
this.container = html`
|
||||
<div class="lobby">
|
||||
<div class="list"></div>
|
||||
<div class="footer"></div>
|
||||
</div>
|
||||
`
|
||||
|
||||
this.list = DOM.get(this.container, '.list')[0]
|
||||
this.footer = DOM.get(this.container, '.footer')[0]
|
||||
|
||||
this.modal = new UiModal({
|
||||
content: this.container,
|
||||
closable: false,
|
||||
title: `${PACKAGE.productName} v${PACKAGE.version}`
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
open() {
|
||||
|
||||
this.modal.open()
|
||||
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
this.modal.close()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var uiLobby = new UiLobby()
|
||||
|
||||
module.exports = uiLobby
|
||||
|
|
@ -1,97 +1,100 @@
|
|||
var UiWidget = require('./ui-widget'),
|
||||
{icon} = require('./utils'),
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
{iconify} = require('../ui/utils')
|
||||
|
||||
|
||||
class UiModalWindow {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
this.container = html`
|
||||
<osc-modal-window class="${options.class || ''}">
|
||||
<inner>
|
||||
${options.content}
|
||||
</inner>
|
||||
</osc-modal-window>
|
||||
`
|
||||
|
||||
if (options.label) {
|
||||
this.container.appendChild(html`<label>${raw(iconify(options.label))}</label>`)
|
||||
}
|
||||
|
||||
this.opened = false
|
||||
}
|
||||
|
||||
open(z) {
|
||||
|
||||
this.opened = true
|
||||
this.container.classList.add('on')
|
||||
this.container.style.zIndex = z
|
||||
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
this.opened = false
|
||||
this.container.classList.remove('on')
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
SINGLETON = null,
|
||||
CONTAINER = null
|
||||
|
||||
class UiModal extends UiWidget {
|
||||
|
||||
constructor(options) {
|
||||
constructor(options) {
|
||||
|
||||
super(options)
|
||||
super(options)
|
||||
|
||||
this.modals = {}
|
||||
this.openedModals = []
|
||||
if (!CONTAINER) CONTAINER = DOM.get('osc-modal-container')[0]
|
||||
|
||||
}
|
||||
if (options.closable) {
|
||||
|
||||
create(id, options) {
|
||||
if (SINGLETON) SINGLETON.close()
|
||||
SINGLETON = this
|
||||
|
||||
if (this.modals[id]) this.destroy(id)
|
||||
}
|
||||
|
||||
this.modals[id] = new UiModalWindow(options)
|
||||
this.container.appendChild(this.modals[id].container)
|
||||
this.escKey = options.closable || options.escKey
|
||||
this.enterKey = options.enterKey
|
||||
this.state = 0
|
||||
|
||||
this.container = html`
|
||||
<div class="popup show">
|
||||
<div class="popup-wrapper">
|
||||
<div class="popup-title ${options.closable? 'closable' : ''}">
|
||||
<span class="title">
|
||||
${options.icon ? raw(icon(options.icon)) : ''}
|
||||
${options.title}
|
||||
</span>
|
||||
${options.closable? html`<span class="closer">${raw(icon('times'))}</span>` : ''}
|
||||
</div>
|
||||
<div class="popup-content">
|
||||
${options.content}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
if (options.closable) {
|
||||
var closer = DOM.get(this.container, '.popup-title .closer')[0]
|
||||
this.container.addEventListener('fast-click',(e)=>{
|
||||
if (e.target === this.container || e.target === closer) {
|
||||
e.detail.preventOriginalEvent = true
|
||||
this.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (this.escKey) {
|
||||
this.escKeyHandler = ((e)=>{
|
||||
if (e.keyCode==27) this.close()
|
||||
}).bind(this)
|
||||
}
|
||||
|
||||
if (this.enterKey) {
|
||||
this.enterKeyHandler = ((e)=>{
|
||||
if (e.keyCode == 13) this.enterKey.call(this, e)
|
||||
}).bind(this)
|
||||
}
|
||||
|
||||
if (!options.hide) this.open()
|
||||
|
||||
|
||||
}
|
||||
|
||||
destroy(id) {
|
||||
|
||||
if (!this.modals[id]) return
|
||||
|
||||
this.close(id)
|
||||
this.container.removeChild(this.modals[id].container)
|
||||
delete this.modals[id]
|
||||
}
|
||||
|
||||
open(id) {
|
||||
|
||||
if (!this.modals[id]) return
|
||||
if (this.openedModals.includes(id)) this.close(id)
|
||||
|
||||
this.openedModals.push(id)
|
||||
|
||||
this.modals[id].open(this.openedModals.length)
|
||||
|
||||
}
|
||||
|
||||
close(id) {
|
||||
|
||||
if (!this.modals[id] || !this.openedModals.includes(id)) return
|
||||
|
||||
this.openedModals.splice(this.openedModals.indexOf(id), 1)
|
||||
this.modals[id].close()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
close() {
|
||||
|
||||
if (!this.state) return
|
||||
this.state = 0
|
||||
|
||||
if (this.escKey) document.removeEventListener('keydown', this.escKeyHandler)
|
||||
if (this.enterKey) document.removeEventListener('keydown', this.enterKeyHandler)
|
||||
CONTAINER.removeChild(this.container)
|
||||
|
||||
this.trigger('close')
|
||||
|
||||
}
|
||||
|
||||
open() {
|
||||
|
||||
if (this.state) return
|
||||
this.state = 1
|
||||
|
||||
if (this.escKey) document.addEventListener('keydown', this.escKeyHandler)
|
||||
if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler)
|
||||
CONTAINER.appendChild(this.container)
|
||||
|
||||
this.trigger('open')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = UiModal
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@ var UiWidget = require('./ui-widget'),
|
|||
doubleClick = require('../events/double-click'),
|
||||
Sortable = require('sortablejs'),
|
||||
morph = require('nanomorph'),
|
||||
Panel, widgetManager
|
||||
Panel, Matrix, widgetManager
|
||||
|
||||
class UiTree extends UiWidget {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
Panel = require('../widgets/containers/panel')
|
||||
Matrix = require('../widgets/containers/matrix')
|
||||
widgetManager = require('../managers/widgets')
|
||||
|
||||
super(options)
|
||||
|
|
@ -139,7 +140,7 @@ class UiTree extends UiWidget {
|
|||
data-id="${id}"">
|
||||
${id}</li>`
|
||||
|
||||
if (widget instanceof Panel) {
|
||||
if (widget instanceof Panel && !(widget instanceof Matrix)) {
|
||||
node.insertBefore(html`<span class="toggle no-widget-select"></span>`, node.childNodes[0])
|
||||
node.classList.add('container')
|
||||
if (this.expanded[id]) node.classList.add('expanded')
|
||||
|
|
|
|||
|
|
@ -9,342 +9,14 @@ var popupSingleton = null,
|
|||
|
||||
module.exports = {
|
||||
|
||||
Popup: class Popup extends EventEmitter {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
super()
|
||||
|
||||
if (options.closable) {
|
||||
|
||||
if (popupSingleton) {
|
||||
popupSingleton.close()
|
||||
popupSingleton = null
|
||||
}
|
||||
|
||||
popupSingleton = this
|
||||
|
||||
}
|
||||
|
||||
this.closable = options.closable
|
||||
this.escKey = options.closable || options.escKey
|
||||
this.enterKey = options.enterKey
|
||||
this.content = options.content
|
||||
this.title = options.title
|
||||
this.state = 0
|
||||
|
||||
this.html = html`
|
||||
<div class="popup show">
|
||||
<div class="popup-wrapper">
|
||||
<div class="popup-title ${this.closable? 'closable' : ''}">
|
||||
<span class="title">
|
||||
${options.icon ? raw(module.exports.icon(options.icon)) : ''}
|
||||
${this.title}
|
||||
</span>
|
||||
${this.closable? html`<span class="closer">${raw(module.exports.icon('times'))}</span>` : ''}
|
||||
</div>
|
||||
<div class="popup-content">
|
||||
${this.content}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
if (this.closable) {
|
||||
var closer = DOM.get(this.html, '.popup-title .closer')[0]
|
||||
this.html.addEventListener('fast-click',(e)=>{
|
||||
if (e.target === this.html || e.target === closer) {
|
||||
e.detail.preventOriginalEvent = true
|
||||
this.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (this.escKey) {
|
||||
this.escKeyHandler = ((e)=>{
|
||||
if (e.keyCode==27) this.close()
|
||||
}).bind(this)
|
||||
}
|
||||
|
||||
if (this.enterKey) {
|
||||
this.enterKeyHandler = ((e)=>{
|
||||
if (e.keyCode == 13) this.enterKey.call(this, e)
|
||||
}).bind(this)
|
||||
}
|
||||
|
||||
if (!options.hide) this.open()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
close() {
|
||||
|
||||
if (!this.state) return
|
||||
this.state = 0
|
||||
|
||||
if (this.escKey) document.removeEventListener('keydown', this.escKeyHandler)
|
||||
if (this.enterKey) document.removeEventListener('keydown', this.enterKeyHandler)
|
||||
document.body.removeChild(this.html)
|
||||
|
||||
this.trigger('close')
|
||||
|
||||
}
|
||||
|
||||
open() {
|
||||
|
||||
if (this.state) return
|
||||
this.state = 1
|
||||
|
||||
if (this.escKey) document.addEventListener('keydown', this.escKeyHandler)
|
||||
if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler)
|
||||
document.body.appendChild(this.html)
|
||||
|
||||
this.trigger('open')
|
||||
}
|
||||
},
|
||||
|
||||
loading: function(title){
|
||||
return new module.exports.Popup({
|
||||
title: title,
|
||||
content: html`<p><div class="spinner"></div></p>`,
|
||||
closable: false
|
||||
})
|
||||
},
|
||||
icon: function(i) {
|
||||
return `<i class="fa fa-fw fa-${i}"></i>`
|
||||
},
|
||||
iconify:function(string){
|
||||
return String(string).replace(/\^[^\s]*/g,(x)=>{return module.exports.icon(x.substring(1))})
|
||||
},
|
||||
upload: function(types, ok, error) {
|
||||
|
||||
if (uploadSingleton) document.body.removeChild(uploadSingleton)
|
||||
|
||||
uploadSingleton = html`<input type="file" accept="${types}" style="position:absolute;opacity:0;pointer-events:none;"/>`
|
||||
document.body.appendChild(uploadSingleton)
|
||||
|
||||
uploadSingleton.addEventListener('change',function(e){
|
||||
|
||||
|
||||
var reader = new FileReader(),
|
||||
file = e.target.files[0],
|
||||
loader = module.exports.loading(locales('loading_upload'))
|
||||
|
||||
reader.onerror = reader.onabort = function() {
|
||||
loader.close()
|
||||
error()
|
||||
}
|
||||
|
||||
reader.onload = function(e) {
|
||||
loader.close()
|
||||
ok(file.path, e.target.result)
|
||||
}
|
||||
|
||||
reader.readAsText(file, 'utf-8')
|
||||
|
||||
})
|
||||
|
||||
uploadSingleton.click()
|
||||
|
||||
},
|
||||
remoteBrowse: function(options, callback) {
|
||||
|
||||
var save = options.save,
|
||||
saveInputFocus = undefined
|
||||
|
||||
var popup = new module.exports.Popup({
|
||||
closable: true,
|
||||
title: locales(save ? 'remotesave_save' : 'remotesave_open'),
|
||||
hide: true
|
||||
})
|
||||
|
||||
var container = DOM.get(popup.html, '.popup-content')[0],
|
||||
browser = html`<div class="file-browser"></div>`,
|
||||
ariane = html`<div class="ariane"></div>`,
|
||||
list = html`<form class="file-list"></form>`,
|
||||
saveInput = html`<input type="text" class="save-as no-keybinding" placeholder="${options.extension ? '*.' + options.extension : ''}" ${options.save ? '' : 'disabled'}/>`,
|
||||
actions = html`
|
||||
<div class="file-actions">
|
||||
${saveInput}
|
||||
<div class="btn cancel">${raw(module.exports.icon('times'))} Cancel</div>
|
||||
${
|
||||
save ?
|
||||
html`<div class="btn submit save">${raw(module.exports.icon('save'))} Save</div>` :
|
||||
html`<div class="btn submit open">${raw(module.exports.icon('folder-open'))} Open</div>`
|
||||
}
|
||||
</div>
|
||||
`
|
||||
|
||||
var files = [],
|
||||
path = ''
|
||||
|
||||
var extRe = options.extension ? new RegExp('.*\\.' + options.extension + '$') : /.*/
|
||||
|
||||
if (save) {
|
||||
saveInput.addEventListener('change', ()=>{
|
||||
if (!saveInput.value.match(extRe)) saveInput.value += '.' + options.extension
|
||||
})
|
||||
saveInput.addEventListener('focus', ()=>{
|
||||
saveInputFocus = true
|
||||
})
|
||||
list.addEventListener('change', ()=>{
|
||||
saveInputFocus = false
|
||||
var choice = DOM.get(list, ':checked')[0]
|
||||
if (choice && choice.classList.contains('file')) {
|
||||
saveInput.value = choice.value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
doubleTap(list, submit, {click: true})
|
||||
|
||||
function submit(){
|
||||
|
||||
var choice = DOM.get(list, ':checked')[0]
|
||||
|
||||
if (!choice && (!save || !saveInput.value) && !options.loadDir) return
|
||||
|
||||
if (choice && choice.classList.contains('folder') && (!save || !saveInputFocus)) {
|
||||
ipc.send('listDir', {path: [path, choice.value]})
|
||||
} else {
|
||||
if (save) {
|
||||
if (files.some(x=>x.name===saveInput.value)) {
|
||||
if (!confirm(locales('remotesave_overwrite'))) return
|
||||
}
|
||||
callback([path, saveInput.value])
|
||||
popup.close()
|
||||
} else {
|
||||
callback([path, choice ? choice.value : ''])
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
actions.addEventListener('click', (e)=>{
|
||||
if (e.target.classList.contains('submit')) {
|
||||
submit()
|
||||
} else if ((e.target.classList.contains('cancel'))){
|
||||
popup.close()
|
||||
}
|
||||
})
|
||||
|
||||
function keyDownHandler(e){
|
||||
|
||||
if (e.keyCode === 13) {
|
||||
if (save) {
|
||||
document.addEventListener('keyup', keyUpHandler)
|
||||
} else {
|
||||
submit()
|
||||
}
|
||||
} else if (e.target === saveInput) {
|
||||
return
|
||||
} else if (e.keyCode === 8) {
|
||||
list.childNodes[0].firstElementChild.checked = true
|
||||
submit()
|
||||
} else if (e.key.length === 1) {
|
||||
var letter = e.key.toLowerCase(),
|
||||
current = DOM.get(list, ':checked')[0],
|
||||
minIndex = -1,
|
||||
index = -1
|
||||
|
||||
if (current) minIndex = DOM.index(current.parentNode)
|
||||
|
||||
for (let i in files) {
|
||||
if (files[i].name[0].toLowerCase() === letter && !list.childNodes[i].firstElementChild.checked) {
|
||||
if (index === -1) index = i
|
||||
if (minIndex !== -1 && i < minIndex) continue
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (index !== -1) {
|
||||
list.childNodes[index].firstElementChild.click()
|
||||
list.childNodes[index].firstElementChild.focus()
|
||||
}
|
||||
}
|
||||
}
|
||||
function keyUpHandler(e){
|
||||
|
||||
if (e.keyCode === 13) {
|
||||
setTimeout(submit, 100)
|
||||
document.removeEventListener('keyup', keyUpHandler)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', keyDownHandler)
|
||||
|
||||
ipc.on('listDir', (data)=>{
|
||||
|
||||
ariane.textContent = path = data.path
|
||||
|
||||
files = data.files.filter(x=>x.folder || x.name.match(extRe))
|
||||
|
||||
|
||||
function alphaSort(a, b){
|
||||
// convert to strings and force lowercase
|
||||
a = typeof a.name === 'string' ? a.name.toLowerCase() : a.name.toString()
|
||||
b = typeof b.name === 'string' ? b.name.toLowerCase() : b.name.toString()
|
||||
return a.localeCompare(b)
|
||||
}
|
||||
|
||||
var fo = files.filter(x=>x.folder),
|
||||
fi = files.filter(x=>!x.folder)
|
||||
|
||||
fo.sort(alphaSort)
|
||||
fi.sort(alphaSort)
|
||||
|
||||
files = fo.concat(fi)
|
||||
|
||||
files.unshift({
|
||||
name: '..',
|
||||
folder: true
|
||||
})
|
||||
|
||||
|
||||
browser.removeChild(list)
|
||||
list.innerHTML = ''
|
||||
for (let i in files) {
|
||||
var file = files[i]
|
||||
list.appendChild(html`
|
||||
<div class="file">
|
||||
<input type="radio" value="${file.name}" name="file" class="${file.folder ? 'folder' : 'file'}"/>
|
||||
<div class="label"><span>${raw(module.exports.icon(file.folder ? 'folder' : 'osc'))} ${file.name}</span></div>
|
||||
</div>
|
||||
`)
|
||||
}
|
||||
|
||||
|
||||
browser.insertBefore(list, actions)
|
||||
|
||||
|
||||
if (save && saveInputFocus === undefined) {
|
||||
saveInput.focus()
|
||||
} else {
|
||||
list.childNodes[0].firstElementChild.focus()
|
||||
}
|
||||
|
||||
}, {context: popup})
|
||||
|
||||
popup.on('close', ()=>{
|
||||
ipc.off('listDir', null, popup)
|
||||
document.removeEventListener('keydown', keyDownHandler)
|
||||
document.removeEventListener('keyup', keyUpHandler)
|
||||
})
|
||||
|
||||
browser.appendChild(ariane)
|
||||
browser.appendChild(list)
|
||||
browser.appendChild(actions)
|
||||
container.appendChild(browser)
|
||||
|
||||
ipc.send('listDir', {extension: options.extension, path: options.directory ? [options.directory] : null})
|
||||
|
||||
popup.open()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@ class Menu extends Widget {
|
|||
layout: {type: 'string', value: 'circular', choices: ['circular', 'horizontal', 'vertical', 'grid'], help: [
|
||||
'Defines whether the menu\'s layout should be rendered in a circle or in a box'
|
||||
]},
|
||||
columns: {type: 'number', value: '', help: [
|
||||
'If `layout` is `grid`, defines the number of columns'
|
||||
]},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
toggle: {type: 'boolean', value: false, help: 'Set to `true` to make the menu stay opened after mouse/touch release'},
|
||||
doubleTap: {type: 'boolean', value: false, help: 'Set to `true` to make the menu require a double tap to be opened instead of a single tap'},
|
||||
values: {type: 'array|object', value: [1, 2, 3], help: [
|
||||
|
|
@ -241,7 +239,11 @@ class Menu extends Widget {
|
|||
this.container.classList.toggle('circular', layout === 'circular')
|
||||
this.container.classList.toggle('grid', layout === 'grid')
|
||||
this.container.classList.toggle('vertical', layout === 'vertical')
|
||||
this.container.style.setProperty('--grid-columns', this.getProp('columns') === '' ? parseInt(this.values.length / 2) : parseInt(this.getProp('columns')))
|
||||
|
||||
if (layout === 'grid') {
|
||||
var template = this.getProp('gridTemplate') || Math.round(this.values.length / 2)
|
||||
this.menu.style.gridTemplate = template === parseInt(template) ? `none / repeat(${template}, 1fr)` : template
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
var _matrix_base = require('./_matrix_base'),
|
||||
var Panel = require('./panel'),
|
||||
Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties'),
|
||||
parser = require('../../parser'),
|
||||
{deepCopy} = require('../../utils')
|
||||
{deepCopy} = require('../../utils'),
|
||||
html = require('nanohtml'),
|
||||
{enableTraversingGestures, disableTraversingGestures} = require('../../events/drag')
|
||||
|
||||
|
||||
|
||||
class Matrix extends _matrix_base {
|
||||
class Matrix extends StaticProperties(Panel, {scroll: false}) {
|
||||
|
||||
static description() {
|
||||
|
||||
|
|
@ -14,16 +18,16 @@ class Matrix extends _matrix_base {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
return Widget.defaults({
|
||||
|
||||
_matrix: 'matrix',
|
||||
|
||||
widgetType: {type: 'string', value: 'toggle', help: 'Defines the type of the widgets in the matrix'},
|
||||
matrix: {type: 'array', value: [2,2], help: 'Defines the number of columns and and rows in the matrix'},
|
||||
layout: {type: 'string', value: 'horizontal', choices: ['horizontal', 'vertical', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'},
|
||||
start: {type: 'integer', value: 0, help: 'First widget\'s index'},
|
||||
spacing: {type: 'integer', value: 0, help: 'Adds space between widgets'},
|
||||
traversing: {type: 'boolean', value: true, help: 'Set to `false` to disable traversing gestures'},
|
||||
border: {type: 'boolean', value: true, help: 'Set to `false` to disables the widgets\' borders'},
|
||||
props: {type: 'object', value: {}, help: [
|
||||
'Defines a set of property to override the widgets\' defaults.',
|
||||
'Formulas in this field are resolved with an extra variable representing each widget\'s index: `$`',
|
||||
|
|
@ -36,7 +40,9 @@ class Matrix extends _matrix_base {
|
|||
|
||||
constructor(options) {
|
||||
|
||||
super(options)
|
||||
super({...options, html: html`<div class="panel"></div>`})
|
||||
|
||||
this.value = []
|
||||
|
||||
this.on('change',(e)=>{
|
||||
|
||||
|
|
@ -61,17 +67,13 @@ class Matrix extends _matrix_base {
|
|||
|
||||
})
|
||||
|
||||
this.widget.style.setProperty('--columns', this.getProp('matrix')[0])
|
||||
this.widget.style.setProperty('--rows', this.getProp('matrix')[1])
|
||||
this.widget.style.setProperty('--spacing', this.getProp('spacing') + 'rem')
|
||||
|
||||
if (this.getProp('borders') === false) this.widget.classList.add('noborders')
|
||||
|
||||
this.start = parseInt(this.getProp('start'))
|
||||
|
||||
if (parser.widgets[this.getProp('widgetType')]) {
|
||||
|
||||
for (let i = 0; i < this.getProp('matrix')[0] * this.getProp('matrix')[1]; i++) {
|
||||
for (let i = 0; i < this.getProp('quantity'); i++) {
|
||||
|
||||
var props = this.resolveProp('props', undefined, false, false, false, {'$':i + this.start})
|
||||
var data = this.defaultProps(i + this.start)
|
||||
|
|
@ -99,6 +101,8 @@ class Matrix extends _matrix_base {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
defaultProps(i) {
|
||||
|
|
@ -26,7 +26,8 @@ class Modal extends Panel {
|
|||
popupHeight: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
|
||||
popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
|
||||
popupTop: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal'], help:''},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ class Panel extends Container() {
|
|||
|
||||
_panel:'panel',
|
||||
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal'], help:''},
|
||||
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
|
||||
|
|
@ -45,9 +46,13 @@ class Panel extends Container() {
|
|||
|
||||
super({...options, html: html`<div class="panel"></div>`})
|
||||
|
||||
if (this.getProp('scroll') === false) this.container.classList.add('noscroll')
|
||||
this.container.classList.toggle('noscroll', this.getProp('scroll') === false)
|
||||
this.container.classList.add('layout-' + this.getProp('layout'))
|
||||
|
||||
if (this.getProp('layout') === 'grid') {
|
||||
var template = this.getProp('gridTemplate') || 2
|
||||
this.widget.style.gridTemplate = template === parseInt(template) ? `none / repeat(${template}, 1fr)` : template
|
||||
}
|
||||
|
||||
if (this.getProp('tabs') && this.getProp('tabs').length) {
|
||||
|
||||
|
|
@ -62,11 +67,12 @@ class Panel extends Container() {
|
|||
|
||||
|
||||
|
||||
this.value = -1
|
||||
this.tabs = []
|
||||
|
||||
if (this.getProp('tabs') && this.getProp('tabs').length) {
|
||||
|
||||
this.value = -1
|
||||
|
||||
this.navigation = this.widget.appendChild(html`<div class="navigation"></div>`)
|
||||
|
||||
this.children = options.children || new Array(this.getProp('tabs').length)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
var Panel = require('./panel'),
|
||||
Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties'),
|
||||
resize = require('../../events/resize')
|
||||
|
||||
module.exports = class Tab extends StaticProperties(Panel, {scroll: true}) {
|
||||
module.exports = class Tab extends Panel {
|
||||
|
||||
static description() {
|
||||
|
||||
|
|
@ -18,7 +17,9 @@ module.exports = class Tab extends StaticProperties(Panel, {scroll: true}) {
|
|||
_tab:'tab',
|
||||
|
||||
// detached: {type: 'boolean', value: true, help: 'Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens'},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal'], help:''},
|
||||
layout: {type: 'string', value: 'default', choices: ['default', 'vertical', 'horizontal', 'grid'], help:''},
|
||||
gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'},
|
||||
scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'},
|
||||
traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'},
|
||||
variables: {type: '*', value: '@{parent.variables}', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'},
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ module.exports.widgets = {
|
|||
canvas: require('./pads/canvas'), // implement...
|
||||
|
||||
// matrices
|
||||
matrix: require('./matrices/matrix'),
|
||||
keyboard: require('./matrices/keyboard'),
|
||||
patchbay: require('./matrices/patchbay').PatchBay,
|
||||
patchbaynode: require('./matrices/patchbay').PatchBayNode,
|
||||
|
|
@ -46,6 +45,7 @@ module.exports.widgets = {
|
|||
panel: require('./containers/panel'),
|
||||
modal: require('./containers/modal'),
|
||||
clone: require('./containers/clone'),
|
||||
matrix: require('./containers/matrix'),
|
||||
|
||||
// state switchers
|
||||
switcher: require('./switchers/switcher'),
|
||||
|
|
@ -63,12 +63,12 @@ module.exports.widgets = {
|
|||
|
||||
module.exports.categories = {
|
||||
'Buttons':['toggle', 'switch', 'dropdown', 'menu'],
|
||||
'Containers':['panel', 'modal', 'clone'],
|
||||
'Containers':['panel', 'modal', 'clone', 'matrix'],
|
||||
'Frames':['frame', 'svg', 'html', 'image'],
|
||||
'Graphs':['plot','eq','visualizer'],
|
||||
'Indicators':['led', 'text'],
|
||||
'Inputs':['input', 'keys', 'script', 'gyroscope', 'file'],
|
||||
'Matrices':['matrix', 'keyboard', 'patchbay'],
|
||||
'Matrices':['keyboard', 'patchbay'],
|
||||
'Pads':['xy','rgb','multixy', 'canvas'],
|
||||
'Sliders':['fader','knob', 'encoder', 'range'],
|
||||
'Switchers':['state', 'switcher','crossfader'],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
var Widget = require('../common/widget'),
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
{remoteBrowse, icon} = require('../../ui/utils')
|
||||
uiFilebrowser = require('../../ui/ui-filebrowser'),
|
||||
{icon} = require('../../ui/utils')
|
||||
|
||||
module.exports = class File extends Widget {
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ module.exports = class File extends Widget {
|
|||
|
||||
if (e.capturedByEditor === true) return
|
||||
|
||||
remoteBrowse({
|
||||
uiFilebrowser({
|
||||
extension: this.getProp('extension').replace(/^\.?(.*)$/, '$1'),
|
||||
directory: this.getProp('directory') === 'auto' ? undefined : this.getProp('directory'),
|
||||
loadDir: this.getProp('allowDir')
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
var _matrix_base = require('./_matrix_base'),
|
||||
Panel = require('../containers/panel'),
|
||||
Widget = require('../common/widget'),
|
||||
parser = require('../../parser')
|
||||
|
||||
|
||||
module.exports = class Keyboard extends _matrix_base {
|
||||
module.exports = class Keyboard extends Panel {
|
||||
|
||||
static description() {
|
||||
|
||||
|
|
@ -12,7 +14,7 @@ module.exports = class Keyboard extends _matrix_base {
|
|||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
return Widget.defaults({
|
||||
|
||||
_matrix: 'matrix',
|
||||
|
||||
|
|
@ -32,7 +34,7 @@ module.exports = class Keyboard extends _matrix_base {
|
|||
]},
|
||||
toggles: {type: 'boolean', value: false, help: 'Set to `true` to make keys bahave like toggle buttons'}
|
||||
|
||||
}, ['_value', 'default', 'value'], {
|
||||
}, ['_value', 'default', 'value', 'linkId'], {
|
||||
|
||||
css: {type: 'string', value: '', help: [
|
||||
'Available CSS variables:',
|
||||
|
|
@ -48,6 +50,8 @@ module.exports = class Keyboard extends _matrix_base {
|
|||
|
||||
super(options)
|
||||
|
||||
this.value = []
|
||||
|
||||
this.on('change',(e)=>{
|
||||
|
||||
if (e.widget === this) return
|
||||
|
|
@ -68,12 +72,15 @@ module.exports = class Keyboard extends _matrix_base {
|
|||
if (pattern[i % 12] == 'w') whiteKeys++
|
||||
}
|
||||
|
||||
this.container.style.setProperty('--nkeys', whiteKeys)
|
||||
|
||||
for (i = start; i < keys + start && i < 109; i++) {
|
||||
|
||||
var data = JSON.parse(strData)
|
||||
|
||||
data.top = data.left = data.height = data.width = 'auto'
|
||||
data.type = this.getProp('toggles') ? 'toggle' : 'push'
|
||||
data.type = 'toggle'
|
||||
data.mode = this.getProp('toggles') ? 'toggle' : 'push'
|
||||
data.id = this.getProp('id') + '/' + i
|
||||
data.label = false
|
||||
data.css = ''
|
||||
|
|
@ -82,11 +89,11 @@ module.exports = class Keyboard extends _matrix_base {
|
|||
data.precision = '@{parent.precision}'
|
||||
|
||||
data.address = '@{parent.address}'
|
||||
data.preArgs = `#{
|
||||
a = @{parent.preArgs};
|
||||
b = typeof(a) == 'string' and a == '' ? [] : typeof(a) == 'Array' ? a : [a];
|
||||
concat(b, [${i}])
|
||||
}`
|
||||
data.preArgs = `JS{{
|
||||
var a = @{parent.preArgs};
|
||||
var b = typeof a === 'string' and a === '' ? [] : Array.isArray(a) ? a : [a];
|
||||
return b.concat([${i}])
|
||||
}}`
|
||||
|
||||
var key = parser.parse({
|
||||
data: data,
|
||||
|
|
@ -96,15 +103,14 @@ module.exports = class Keyboard extends _matrix_base {
|
|||
|
||||
key._index = i - start
|
||||
key.container.classList.add('not-editable')
|
||||
key.container.classList.add('key')
|
||||
|
||||
if (pattern[i % 12] == 'w') {
|
||||
key.container.classList.add('white')
|
||||
key.container.style.width = `${100/whiteKeys}%`
|
||||
whiteKeys2++
|
||||
} else {
|
||||
key.container.classList.add('black')
|
||||
key.container.style.width = `${60 / whiteKeys}%`
|
||||
key.container.style.left = `${100 / whiteKeys * (whiteKeys2 - 3/10)}%`
|
||||
key.container.style.setProperty('--rank', whiteKeys2)
|
||||
}
|
||||
|
||||
this.value[i - start] = this.getProp('off')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
.widget.editing {
|
||||
z-index: 9999!important;
|
||||
// overflow: visible;
|
||||
}
|
||||
.widget.editing:after,
|
||||
.tablink.editing:after,
|
||||
|
|
@ -40,7 +39,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.widget {
|
||||
.widget:not(.not-editable) {
|
||||
pointer-events: initial!important;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,33 +62,6 @@ body {
|
|||
letter-spacing: 1rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background: var(--color-foreground);
|
||||
display: block;
|
||||
padding:15rem;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
&.small {
|
||||
padding:8rem;
|
||||
padding-right: 15rem;
|
||||
}
|
||||
&.tiny {
|
||||
padding:6rem;
|
||||
}
|
||||
&.warning {
|
||||
background:firebrick;
|
||||
}
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
color:var(--color-text-fade);
|
||||
}
|
||||
&.align-center {
|
||||
text-align: center
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -99,122 +72,6 @@ body {
|
|||
|
||||
|
||||
|
||||
#lobby {
|
||||
background: var(--color-bg);
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right: 0;
|
||||
bottom:0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow-y: auto;
|
||||
padding:20rem;
|
||||
|
||||
.main {
|
||||
width:600rem;
|
||||
max-width: 100%;
|
||||
max-height:100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
opacity: 0;
|
||||
transition: opacity .1s;
|
||||
&.show {
|
||||
opacity: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
.list {
|
||||
overflow: auto;
|
||||
background: var(--color-fg);
|
||||
border-top:2rem solid var(--color-bg);
|
||||
text-transform: none;
|
||||
font-weight: 500;
|
||||
flex: 1 1 auto;
|
||||
a {
|
||||
&:focus {
|
||||
&:after {
|
||||
content:"";
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:0;
|
||||
background: var(--color-accent);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.header {
|
||||
padding:22rem 20rem 20rem;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
flex-grow: 0;
|
||||
background-color: var(--color-fg);
|
||||
color:var(--color-accent);
|
||||
letter-spacing: 1rem;
|
||||
font-size: 12rem;
|
||||
background:var(--color-raised);
|
||||
box-shadow: 0 0 0 1rem var(--color-light) inset;
|
||||
}
|
||||
.footer {
|
||||
background: var(--color-fg);
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
flex-grow: 0;
|
||||
border-top:2rem solid var(--color-bg);
|
||||
a {
|
||||
background:var(--color-raised);
|
||||
&:focus {
|
||||
&:after {
|
||||
content:"";
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:0;
|
||||
background: var(--color-accent);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
a {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding:17rem;
|
||||
padding-right:39rem;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
background: none;
|
||||
border-bottom:1rem solid var(--color-bg);
|
||||
em {
|
||||
pointer-events: none;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom:0;
|
||||
}
|
||||
span {
|
||||
position: absolute;
|
||||
right:0rem;
|
||||
top:0rem;
|
||||
padding:17rem;
|
||||
color:var(--color-text-fader);
|
||||
z-index: 1;
|
||||
&:hover {
|
||||
color:var(--color-accent);
|
||||
}
|
||||
i {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#launcher {
|
||||
overflow: initial;
|
||||
|
|
@ -523,93 +380,4 @@ body {
|
|||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.file-browser {
|
||||
width: 540px;
|
||||
height: 360px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
.ariane {
|
||||
height: 40rem;
|
||||
flex-shrink: 0;
|
||||
line-height: 40rem;
|
||||
padding-left: 10rem;
|
||||
}
|
||||
.file-list {
|
||||
overflow-y: auto;
|
||||
flex:1;
|
||||
background: var(--color-bg);
|
||||
padding: 0 10rem;
|
||||
}
|
||||
.file {
|
||||
position: relative;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
input {
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.label {
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
span {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
input:checked + .label {
|
||||
color: var(--color-custom);
|
||||
&:before {
|
||||
content:"";
|
||||
position: absolute;
|
||||
left:-10rem;
|
||||
right:-10rem;
|
||||
height: 100%;
|
||||
background: var(--color-custom);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.file-actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-end;
|
||||
height: 40rem;
|
||||
flex-shrink: 0;
|
||||
margin-top: 10rem;
|
||||
div {
|
||||
margin-left: 10rem;
|
||||
text-transform: uppercase;
|
||||
text-overflow: clip;
|
||||
}
|
||||
i {
|
||||
pointer-events: none;
|
||||
}
|
||||
.save-as {
|
||||
flex:1;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
border: 0;
|
||||
padding: 0 10rem;
|
||||
font-size: 120%;
|
||||
top: -1rem;
|
||||
position: relative;
|
||||
background: var(--color-bg);
|
||||
&[disabled] {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@import 'themes/default';
|
||||
|
|
|
|||
|
|
@ -14,3 +14,10 @@
|
|||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
|
||||
select, input, textarea {
|
||||
-webkit-appearance:none;
|
||||
-moz-appearance:none;
|
||||
appearance:none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
@import 'ui/button';
|
||||
@import 'ui/scrollbars';
|
||||
@import 'ui/workspaces';
|
||||
@import 'ui/notifications';
|
||||
|
|
@ -7,3 +8,5 @@
|
|||
@import 'ui/selectarea';
|
||||
@import 'ui/contextmenu';
|
||||
@import 'ui/modal';
|
||||
@import 'ui/filebrowser';
|
||||
@import 'ui/lobby';
|
||||
|
|
|
|||
14
src/scss/ui/button.scss
Normal file
14
src/scss/ui/button.scss
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
.btn {
|
||||
background: var(--color-foreground);
|
||||
display: block;
|
||||
padding:15rem;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
97
src/scss/ui/filebrowser.scss
Normal file
97
src/scss/ui/filebrowser.scss
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
.file-browser {
|
||||
|
||||
width: 540rem;
|
||||
height: 360rem;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 2rem 8rem 8rem;
|
||||
background: var(--color-background);
|
||||
|
||||
.ariane {
|
||||
height: 40rem;
|
||||
flex-shrink: 0;
|
||||
line-height: 40rem;
|
||||
padding-left: 10rem;
|
||||
background: var(--color-foreground);
|
||||
margin-bottom: 2rem;
|
||||
|
||||
}
|
||||
.file-list {
|
||||
overflow-y: auto;
|
||||
flex:1;
|
||||
background: var(--color-foreground);
|
||||
padding: 0 10rem;
|
||||
}
|
||||
.file {
|
||||
position: relative;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
input {
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.label {
|
||||
position: absolute;
|
||||
width:100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
span {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
input:checked + .label {
|
||||
color: var(--color-widget);
|
||||
&:before {
|
||||
content:"";
|
||||
position: absolute;
|
||||
left:-10rem;
|
||||
right:-10rem;
|
||||
height: 100%;
|
||||
background: var(--color-widget);
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.file-actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
justify-content: flex-end;
|
||||
height: 40rem;
|
||||
flex-shrink: 0;
|
||||
margin-top: 10rem;
|
||||
div {
|
||||
margin-left: 10rem;
|
||||
text-overflow: clip;
|
||||
min-width: 0;
|
||||
}
|
||||
i {
|
||||
pointer-events: none;
|
||||
}
|
||||
.save-as {
|
||||
flex:1;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
border: 0;
|
||||
padding: 0 10rem;
|
||||
font-size: 120%;
|
||||
top: -1rem;
|
||||
position: relative;
|
||||
background: var(--color-foreground);
|
||||
min-width: 0;
|
||||
&[disabled] {
|
||||
display: none
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,10 +40,6 @@ osc-inspector-field {
|
|||
background: var(--color-foreground);
|
||||
cursor: text;
|
||||
|
||||
-webkit-appearance:none;
|
||||
-moz-appearance:none;
|
||||
appearance:none;
|
||||
|
||||
--scrollbar-size: 6rem;
|
||||
|
||||
&::-webkit-scrollbar-thumb:horizontal {
|
||||
|
|
@ -181,9 +177,7 @@ osc-inspector-select {
|
|||
// width: 100%;
|
||||
line-height: $field-height - 8rem;
|
||||
padding: 4rem 6rem;
|
||||
-webkit-appearance:none;
|
||||
-moz-appearance:none;
|
||||
appearance:none;
|
||||
|
||||
position: absolute;
|
||||
left:0;
|
||||
opacity: 0;
|
||||
|
|
@ -217,7 +211,6 @@ osc-inspector-select {
|
|||
|
||||
|
||||
.osc-inspector-color {
|
||||
appearance: none;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
box-shadow: 0;
|
||||
|
|
@ -234,9 +227,7 @@ osc-inspector-select {
|
|||
|
||||
cursor: pointer;
|
||||
|
||||
-webkit-appearance:none;
|
||||
-moz-appearance:none;
|
||||
appearance:none;
|
||||
|
||||
|
||||
&::-webkit-color-swatch {
|
||||
border: none;
|
||||
|
|
|
|||
71
src/scss/ui/lobby.scss
Normal file
71
src/scss/ui/lobby.scss
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
.lobby {
|
||||
|
||||
width: 540rem;
|
||||
height: 360rem;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
background: var(--color-background);
|
||||
padding: 2rem 8rem 8rem;
|
||||
|
||||
.list {
|
||||
overflow: auto;
|
||||
text-transform: none;
|
||||
flex: 1;
|
||||
background: var(--color-foreground);
|
||||
padding: 0 10rem;
|
||||
a {
|
||||
padding-right: 30rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 10rem;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
flex-grow: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
a {
|
||||
margin-left: 10rem;
|
||||
text-align: center;
|
||||
background: var(--color-foreground);
|
||||
&:first-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
a {
|
||||
padding: 0;
|
||||
position: relative;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
width: 100%;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
background: none;
|
||||
em, i {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
span {
|
||||
position: absolute;
|
||||
right:0rem;
|
||||
top:0rem;
|
||||
z-index: 1;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
opacity: 0.5;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
}
|
||||
.popup-title {
|
||||
position: relative;
|
||||
min-height: var(--nav-height);
|
||||
height: var(--nav-height);
|
||||
display: flex;
|
||||
padding:0 15rem;
|
||||
|
|
|
|||
|
|
@ -88,3 +88,4 @@
|
|||
@import 'widgets/indicators';
|
||||
@import 'widgets/frames';
|
||||
@import 'widgets/patchbay';
|
||||
@import 'widgets/keyboard';
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@
|
|||
margin: calc(var(--widget-spacing) / 2) calc(1rem + var(--widget-spacing) / 2) calc(1rem + var(--widget-spacing) / 2);
|
||||
}
|
||||
|
||||
&.noscroll > .panel {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&.contains-widgets {
|
||||
|
||||
> .panel > .widget {
|
||||
|
|
@ -77,6 +81,20 @@
|
|||
}
|
||||
|
||||
}
|
||||
&.layout-grid > .panel {
|
||||
display: grid;
|
||||
> .widget {
|
||||
top:auto!important;
|
||||
left:auto!important;
|
||||
position: relative!important;
|
||||
height: auto!important;
|
||||
width: auto!important;
|
||||
min-height: auto!important;
|
||||
max-height: auto!important;
|
||||
min-width: auto!important;
|
||||
max-width: auto!important;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +141,8 @@
|
|||
|
||||
}
|
||||
|
||||
.panel-container {
|
||||
.panel-container,
|
||||
.matrix-container {
|
||||
|
||||
@extend .widget-panel-base;
|
||||
|
||||
|
|
|
|||
68
src/scss/widgets/keyboard.scss
Normal file
68
src/scss/widgets/keyboard.scss
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
.keyboard-container {
|
||||
|
||||
--widget-padding: 0;
|
||||
--alpha-fill-off: 0;
|
||||
--alpha-fill-on: .75;
|
||||
|
||||
--color-key-on: var(--color-fill);
|
||||
--alpha-key-off: var(--alpha-fill-off);
|
||||
--alpha-key-on: var(--alpha-fill-on);
|
||||
--color-white-key: #ddd;
|
||||
--color-black-key: #111;
|
||||
|
||||
--widget-keypad: var(--widget-padding);
|
||||
|
||||
.panel {
|
||||
|
||||
padding: var(--widget-padding);
|
||||
flex: 1;
|
||||
@include pseudo-stroke($z: 2);
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.key {
|
||||
|
||||
--alpha-fill-off: var(--alpha-key-off);
|
||||
--alpha-fill-on: var(--alpha-key-on);
|
||||
inner {
|
||||
margin: 1rem 0.5rem!important;
|
||||
--widget-padding: -1rem;
|
||||
&:before {
|
||||
content: none;
|
||||
}
|
||||
&:after {
|
||||
background: var(--color-key-on);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.white {
|
||||
flex: 1;
|
||||
width: auto;
|
||||
min-width: auto;
|
||||
height: auto;
|
||||
inner {
|
||||
background: var(--color-white-key);
|
||||
}
|
||||
}
|
||||
|
||||
.black {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
|
||||
left: calc((100% - var(--widget-keypad) * 2) / var(--nkeys) * var(--rank));
|
||||
width: calc(100% / var(--nkeys) * 0.6);
|
||||
margin-left: calc(100% / var(--nkeys) * -0.3 + var(--widget-keypad));
|
||||
height: calc((100% - var(--widget-keypad) * 2) * 0.65);
|
||||
|
||||
inner {
|
||||
margin-left: 0!important;
|
||||
margin-right: 0!important;
|
||||
background: var(--color-black-key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue