⚠️ huge commit: tab system rewrite, see changelog @ 0.18.0
This commit is contained in:
parent
7d797ed9a4
commit
11e73e67e0
21 changed files with 443 additions and 437 deletions
|
|
@ -118,7 +118,7 @@ module.exports = {
|
|||
|
||||
editorEnable: function(){
|
||||
window.GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width")
|
||||
$('.editor-root').attr('data-tab','#container').removeClass('disabled')
|
||||
$('.editor-root').attr('data-widget', $('.root-container').attr('data-widget')).removeClass('disabled')
|
||||
$('.enable-editor').addClass('on')
|
||||
$('.disable-editor').removeClass('on')
|
||||
$('body').addClass('editor-enabled')
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
var ui = require('../ui'),
|
||||
actions = require('../actions'),
|
||||
var actions = require('../actions'),
|
||||
sidepanelCreateToggle = require('../sidepanel').createToggle,
|
||||
editObject = function(){editObject = require('./edit-objects').editObject; editObject(...arguments)},
|
||||
editSession = function(){editSession = require('./edit-objects').editSession; editSession(...arguments)},
|
||||
purgeStores = require('./purge'),
|
||||
{iconify} = require('../utils'),
|
||||
{widgetManager} = require('../managers'),
|
||||
|
|
@ -13,36 +11,12 @@ var ui = require('../ui'),
|
|||
var getObjectData = function(obj){
|
||||
var path = []
|
||||
|
||||
if (obj.hasClass('tab')) {
|
||||
return TABS['#'+obj.attr('id')].data
|
||||
if (obj.hasClass('widget')) {
|
||||
return obj[0].abstract.props
|
||||
} else {
|
||||
return obj.closest('.widget')[0].abstract.props
|
||||
}
|
||||
|
||||
if (obj.is('#container')) {
|
||||
return SESSION
|
||||
}
|
||||
|
||||
while(true) {
|
||||
if (obj.hasClass('widget')) {
|
||||
path.unshift(obj.index())
|
||||
path.unshift('widgets')
|
||||
} else if (obj.hasClass('tab')){
|
||||
path.unshift(obj.data('index'))
|
||||
path.unshift('tabs')
|
||||
} else if (obj.is('#container')) {
|
||||
break
|
||||
}
|
||||
|
||||
obj = obj.parent()
|
||||
}
|
||||
|
||||
path.splice(0,1)
|
||||
|
||||
for (var i=0,data=SESSION, path=path, len=path.length; i<len; i++){
|
||||
data = data[path[i]]
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
}
|
||||
|
||||
var updateDom = function(container,data, remote) {
|
||||
|
|
@ -50,55 +24,29 @@ var updateDom = function(container,data, remote) {
|
|||
// save state
|
||||
var scroll = $('#sidepanel').scrollTop(),
|
||||
state = actions.stateGet(),
|
||||
purgetabs = data.tabs?true:false
|
||||
parentContainer = container.parent(),
|
||||
purge = container[0].abstract.hashes || container[0].abstract.hash
|
||||
|
||||
// widget
|
||||
var newContainer = parsewidgets([data], parentContainer, container[0].abstract.parent)
|
||||
container.replaceWith(newContainer)
|
||||
|
||||
if (container.hasClass('widget')) {
|
||||
// widget
|
||||
var newContainer = parsewidgets([data],container.parent(), container[0].abstract.parent)
|
||||
container.replaceWith(newContainer)
|
||||
if (data.type == 'tab') newContainer.trigger('tab-created')
|
||||
|
||||
if (!remote) editObject(newContainer,data,true)
|
||||
|
||||
} else if (container.hasClass('tab')) {
|
||||
// tab
|
||||
var newContainer = container.empty()
|
||||
|
||||
if (data.widgets && data.widgets.length) parsewidgets(data.widgets,container)
|
||||
if (data.tabs && data.tabs.length) {
|
||||
parsetabs(data.tabs,container,false,data.label)
|
||||
container.addClass('has-tabs')
|
||||
} else {
|
||||
container.removeClass('has-tabs')
|
||||
}
|
||||
|
||||
$(`[data-tab="#${container.attr('id')}"]`).html(`<a ta><span>${iconify(data.label)}</span></a>`).attr('data-id',data.id)
|
||||
|
||||
if (!remote) editObject(newContainer,data,true)
|
||||
|
||||
} else if (container.attr('id')=='container') {
|
||||
// session
|
||||
var newContainer = $('#container')
|
||||
container.empty()
|
||||
parsetabs(data,container,true)
|
||||
|
||||
if (!remote) {
|
||||
editSession(newContainer,data,true)
|
||||
sidepanelCreateToggle()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
newContainer.find('[data-tab]:first-child').trigger('fake-click')
|
||||
$('.editor-root').attr('data-widget', $('.root-container').attr('data-widget'))
|
||||
sidepanelCreateToggle()
|
||||
|
||||
newContainer.trigger('resize')
|
||||
// $(window).resize()
|
||||
|
||||
purgeStores(purgetabs)
|
||||
purgeStores(purge)
|
||||
|
||||
// restore state
|
||||
actions.stateSet(state,false)
|
||||
ui.scrolls()
|
||||
|
||||
if (!remote) {
|
||||
editObject(newContainer,data,true)
|
||||
}
|
||||
|
||||
$('#sidepanel').scrollTop(scroll)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,24 +15,17 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
if (!refresh && (container.hasClass('editing') || $(`a[data-tab="#${container.attr('id')}"]`).hasClass('editing'))) return
|
||||
|
||||
var isWidget = container.hasClass('widget')
|
||||
|
||||
editClean()
|
||||
|
||||
if (isWidget) {
|
||||
$(container).addClass('editing')
|
||||
} else {
|
||||
$(`[data-tab="#${container.attr('id')}"]`).addClass('editing')
|
||||
$(container).parent().addClass('editing')
|
||||
}
|
||||
$(`[data-widget="${container.attr('data-widget')}"]`).addClass('editing')
|
||||
|
||||
$('#editor').append('<div class="editor-container"></div>')
|
||||
var form = $('<div class="form"></div>').appendTo('.editor-container')
|
||||
|
||||
|
||||
var params = isWidget ? widgets[data.type].defaults() : {label:'', id:''}
|
||||
var params = widgets[data.type].defaults()
|
||||
|
||||
$(`<div class="separator"><span>${isWidget?'Widget':'Tab'}</span></div>`).appendTo(form)
|
||||
$(`<div class="separator"><span>${data.type == 'tab' ? 'Tab' : data.type == 'root' ? 'Root' : 'Widget'}</span></div>`).appendTo(form)
|
||||
|
||||
for (var i in params) {
|
||||
|
||||
|
|
@ -46,6 +39,8 @@ var editObject = function(container, data, refresh){
|
|||
// Common options edit
|
||||
if (i!='widgets' && i!='tabs') {
|
||||
|
||||
if (i=='type' && (data.type == 'tab' || data.type == 'root')) continue
|
||||
|
||||
let type = typeof data[i],
|
||||
value = type == 'object'?JSON.stringify(data[i]):data[i],
|
||||
wrapper = $('<div class="input-wrapper"></div>').appendTo(form),
|
||||
|
|
@ -105,7 +100,7 @@ var editObject = function(container, data, refresh){
|
|||
}
|
||||
|
||||
data[$(this).attr('title')] = v
|
||||
if (v==='' && isWidget) delete data[$(this).attr('title')]
|
||||
if (v==='') delete data[$(this).attr('title')]
|
||||
|
||||
try {
|
||||
updateDom(container,data)
|
||||
|
|
@ -121,7 +116,7 @@ var editObject = function(container, data, refresh){
|
|||
}
|
||||
|
||||
// widget list edit
|
||||
if (((isWidget && params.widgets) || (container.hasClass('tab'))) && (!data.tabs||!data.tabs.length)) {
|
||||
if ((params.widgets || (container.hasClass('tab'))) && (!data.tabs||!data.tabs.length)) {
|
||||
|
||||
$(`<div class="separator"><span>Widgets</span></div>`).appendTo(form)
|
||||
|
||||
|
|
@ -176,7 +171,7 @@ var editObject = function(container, data, refresh){
|
|||
}
|
||||
|
||||
// tab list edit
|
||||
if (((isWidget && params.tabs) || (container.hasClass('tab'))) && (!data.widgets||!data.widgets.length)) {
|
||||
if ((params.tabs || (container.hasClass('tab'))) && (!data.widgets||!data.widgets.length)) {
|
||||
|
||||
$(`<div class="separator"><span>Tabs</span></div>`).appendTo(form)
|
||||
|
||||
|
|
@ -187,12 +182,12 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
var editItem = function(i) {
|
||||
return function(){
|
||||
container.find('.tab').first().siblings().addBack().eq(i).trigger(ev)
|
||||
container.find('.tablist li').first().siblings().addBack().eq(i).trigger(ev)
|
||||
}
|
||||
}
|
||||
|
||||
for (var i in data.tabs) {
|
||||
var item = $(`<li data-index="${i}" class="sortables"><a class="btn small">${data.tabs[i].label}</a></li>`)
|
||||
var item = $(`<li data-index="${i}" class="sortables"><a class="btn small">${data.tabs[i].id}</a></li>`)
|
||||
.appendTo(list)
|
||||
.click(editItem(i))
|
||||
|
||||
|
|
@ -229,10 +224,10 @@ var editObject = function(container, data, refresh){
|
|||
list.appendTo(wrapper)
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('width')) {
|
||||
if (data.hasOwnProperty('width') || data.hasOwnProperty('height')) {
|
||||
var handleTarget
|
||||
container.resizable({
|
||||
handles:'s, e, se',
|
||||
handles: 's, e, se',
|
||||
helper: "ui-helper",
|
||||
start: function(event, ui){
|
||||
handleTarget = $(event.originalEvent.target)
|
||||
|
|
@ -272,76 +267,8 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
}
|
||||
|
||||
var editSession = function(container,data,refresh){
|
||||
|
||||
if (!refresh && $('.editor-root').hasClass('editing')) return
|
||||
|
||||
editClean()
|
||||
|
||||
$('.editor-root, #container').addClass('editing')
|
||||
|
||||
$('#editor').append('<div class="editor-container"></div>')
|
||||
|
||||
|
||||
var form = $('<div class="form"></div>').appendTo('.editor-container')
|
||||
|
||||
$(`<div class="separator"><span>Tabs</span></div>`).appendTo(form)
|
||||
|
||||
var list = $('<ul class="input"></ul>'),
|
||||
wrapper = $('<div class="input-wrapper column"></div>').appendTo(form)
|
||||
|
||||
|
||||
var editItem = function(i) {
|
||||
return function(){
|
||||
container.find('.tab').first().siblings().addBack().eq(i).trigger(ev)
|
||||
}
|
||||
}
|
||||
|
||||
for (var i in data) {
|
||||
var item = $(`<li data-index="${i}" class="sortables"><a class="btn small">${data[i].label}</a></li>`)
|
||||
.appendTo(list)
|
||||
.click(editItem(i))
|
||||
|
||||
var remove = $('<span><i class="fa fa-remove"></i></span>')
|
||||
.appendTo(item)
|
||||
.click(function(e){
|
||||
e.stopPropagation()
|
||||
data.splice($(this).parent().attr('data-index'),1)
|
||||
updateDom(container,data)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
list.sortable({
|
||||
start:function(){$(this).sortable( "refreshPositions" )},
|
||||
forcePlaceholderSize: true,
|
||||
items: '.sortables',
|
||||
update: function(e,ui){
|
||||
var prevIndex = $(ui.item).attr('data-index')
|
||||
var newIndex = $(ui.item).index()
|
||||
|
||||
data.splice(newIndex, 0, data.splice(prevIndex, 1)[0])
|
||||
|
||||
updateDom(container,data)
|
||||
}
|
||||
})
|
||||
|
||||
var add = $(`<li><a class="btn small">+</a></li>`).appendTo(list).click(function(){
|
||||
data = data || []
|
||||
data.push({})
|
||||
|
||||
updateDom(container,data)
|
||||
})
|
||||
|
||||
list.appendTo(wrapper)
|
||||
|
||||
|
||||
$('.editor-container').append(form)
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
editObject:editObject,
|
||||
editSession:editSession,
|
||||
editClean:editClean
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
var {getObjectData, updateDom, incrementWidget} = require('./data-workers'),
|
||||
{editObject, editSession, editClean} = require('./edit-objects'),
|
||||
{editObject, editClean} = require('./edit-objects'),
|
||||
createPopup = require('../utils').createPopup,
|
||||
{widgets, categories} = require('../widgets'),
|
||||
{widgetManager} = require('../managers'),
|
||||
menu = require('./context-menu')
|
||||
|
||||
|
||||
|
|
@ -13,35 +14,36 @@ var init = function(){
|
|||
if (!EDITING) return
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
// already handled in drag.js
|
||||
// if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
$('.context-menu').remove()
|
||||
|
||||
var target = $(e.target).is('.widget:not(.not-editable), .tab, [data-tab], #container')?
|
||||
$(e.target):
|
||||
$(e.target).closest('.widget:not(.not-editable), .tab, [data-tab], #container')
|
||||
if (e.target.classList.contains('not-editable')) return
|
||||
|
||||
var target = e.target.hasAttribute('data-widget') || e.target.classList.contains('widget') ?
|
||||
$(e.target).not('.not-editable') : $(e.target).closest('.widget:not(.not-editable)')
|
||||
|
||||
if (!target.length) return
|
||||
|
||||
var container = target.attr('data-tab')?TABS[target.attr('data-tab')].tab:target,
|
||||
type = target.hasClass('widget')?'widget':'tab',
|
||||
var widget = widgetManager.widgets[target.attr('data-widget')]
|
||||
|
||||
if (!widget) return
|
||||
|
||||
var container = widget.container,
|
||||
parent = container.parent(),
|
||||
index = container.index(),
|
||||
data = getObjectData(container)
|
||||
|
||||
if (container.attr('id')=='container') {
|
||||
editSession(container,SESSION)
|
||||
} else {
|
||||
editObject(container,data)
|
||||
}
|
||||
data = getObjectData(container),
|
||||
type = widget.props.type == 'tab' ? 'tab' : 'widget'
|
||||
|
||||
editObject(container,data)
|
||||
|
||||
if (e.type!='fake-right-click') return
|
||||
|
||||
if (container.attr('id')=='container') {
|
||||
if (container.hasClass('root-container')) {
|
||||
menu(d,{
|
||||
'<i class="fa fa-plus"></i> Add tab': function(){
|
||||
data.push({})
|
||||
data.tabs.push({})
|
||||
updateDom(container,data)
|
||||
}
|
||||
},'body')
|
||||
|
|
@ -58,10 +60,10 @@ var init = function(){
|
|||
|
||||
if (type=='widget') actions['<i class="fa fa-cut"></i> Cut'] = function(){
|
||||
CLIPBOARD=JSON.parse(JSON.stringify(data))
|
||||
var parentContainer = container.parents('.widget, .tab, #container').first(),
|
||||
var parentContainer = container.parents('.widget').first(),
|
||||
parentData = getObjectData(parentContainer)
|
||||
|
||||
parentData.widgets.splice(container.index(),1)
|
||||
parentData.widgets.splice(index,1)
|
||||
updateDom(parentContainer,parentData)
|
||||
}
|
||||
|
||||
|
|
@ -140,16 +142,14 @@ var init = function(){
|
|||
`)
|
||||
$('.confirm-delete').click(function(){
|
||||
popup.close()
|
||||
var parentContainer = container.parents('.widget, .tab, #container').first(),
|
||||
var parentContainer = container.parents('.widget').first(),
|
||||
parentData = getObjectData(parentContainer)
|
||||
|
||||
|
||||
if (type=='widget') {
|
||||
parentData.widgets.splice(container.index(),1)
|
||||
} else if (type=='tab' && parentContainer.attr('id')!='container') {
|
||||
parentData.tabs.splice(container.data('index'),1)
|
||||
if (widget.props.type != 'tab') {
|
||||
parentData.widgets.splice(index,1)
|
||||
} else {
|
||||
parentData.splice(container.data('index'),1)
|
||||
parentData.tabs.splice(index,1)
|
||||
}
|
||||
|
||||
updateDom(parentContainer,parentData)
|
||||
|
|
|
|||
|
|
@ -1,47 +1,12 @@
|
|||
var {widgetManager} = require('../managers')
|
||||
|
||||
module.exports = function(purgetabs) {
|
||||
|
||||
// prune tabs store
|
||||
var count, newcount, formerBuffuredTabs, bufferedTabs
|
||||
|
||||
if (purgetabs) {
|
||||
while (true) {
|
||||
// we need to do that several times since tabs are referenced in each of their parents
|
||||
|
||||
// get all buffered tabs
|
||||
formerBuffuredTabs = []
|
||||
for (let i in TABS) {
|
||||
formerBuffuredTabs.push(TABS[i].tab[0])
|
||||
}
|
||||
|
||||
// remove deleted tabs that are not referenced (have no navigation link pointing to them)
|
||||
var $f = $(formerBuffuredTabs)
|
||||
for (let i in TABS) {
|
||||
if (!($f.find(`[data-tab="${i}"]`).length || i== '#container')) {
|
||||
delete TABS[i]
|
||||
}
|
||||
}
|
||||
|
||||
newcount = Object.keys(TABS).length
|
||||
if (count == newcount) break
|
||||
count = newcount
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bufferedTabs = []
|
||||
for (let i in TABS) {
|
||||
bufferedTabs.push(TABS[i].tab[0])
|
||||
}
|
||||
|
||||
module.exports = function(hashes) {
|
||||
// prune widget stores
|
||||
// if widgets cannot be found in buffered tabs, it must be unreferenced
|
||||
var $b = $(bufferedTabs)
|
||||
for (let hash in widgetManager.widgets) {
|
||||
if (!$b.find(widgetManager.widgets[hash].widget).length) {
|
||||
widgetManager.removeWidget(hash)
|
||||
for (let i in hashes) {
|
||||
if (
|
||||
widgetManager.widgets[hashes[i]]
|
||||
) {
|
||||
widgetManager.removeWidget(hashes[i])
|
||||
}
|
||||
}
|
||||
widgetManager.purge()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
var parsetabs = require('./parser').tabs,
|
||||
var parser = require('./parser'),
|
||||
parsewidgets = parser.widgets,
|
||||
reset = parser.reset,
|
||||
ui = require('./ui'),
|
||||
{editorDisable} = require('./actions'),
|
||||
editorInit = require('./editor/init'),
|
||||
|
|
@ -12,7 +14,17 @@ module.exports = function(session,callback) {
|
|||
|
||||
setTimeout(function(){
|
||||
try {
|
||||
parsetabs(session,$('#container'),true)
|
||||
reset()
|
||||
|
||||
if (session[0].type != 'root') {
|
||||
SESSION = [{type:'root', tabs:session}]
|
||||
} else if (session[0].type == 'root'){
|
||||
SESSION = session
|
||||
} else {
|
||||
throw 'Malformed session file'
|
||||
}
|
||||
|
||||
parsewidgets(SESSION,$('#container'))
|
||||
} catch (err) {
|
||||
p.close()
|
||||
$('#lobby').show()
|
||||
|
|
@ -24,6 +36,7 @@ module.exports = function(session,callback) {
|
|||
ui.init()
|
||||
editorDisable()
|
||||
editorInit()
|
||||
$(window).resize()
|
||||
|
||||
setTimeout(function(){
|
||||
p.close()
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ WidgetManager.prototype.addWidget = function(widget) {
|
|||
ipc.send('addWidget', {
|
||||
hash:hash,
|
||||
data:{
|
||||
precision: widget.precision,
|
||||
precision: widget.getProp('precision'),
|
||||
preArgs: widget.getProp('preArgs'),
|
||||
split: widget.split,
|
||||
target: widget.getProp('target'),
|
||||
|
|
|
|||
|
|
@ -7,103 +7,29 @@ var {widgetManager} = require('./managers')
|
|||
var {widgets} = require('./widgets'),
|
||||
{iconify} = require('./utils')
|
||||
|
||||
var iterators = {
|
||||
widget:{},
|
||||
tab:{}
|
||||
},
|
||||
getIterator = function(id,type){
|
||||
iterators[type][id] = (iterators[type][id] || 0) + 1
|
||||
return iterators[type][id]
|
||||
var iterators = {},
|
||||
getIterator = function(id){
|
||||
iterators[id] = (iterators[id] || 0) + 1
|
||||
return iterators[id]
|
||||
}
|
||||
|
||||
var hashCode = function(s){
|
||||
return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0);
|
||||
}
|
||||
module.exports.reset = function(){
|
||||
|
||||
var $body
|
||||
$(function() {
|
||||
$body = $('body')
|
||||
})
|
||||
iterators = {}
|
||||
|
||||
module.exports.tabs = function(data,parent,main){
|
||||
widgetManager.reset()
|
||||
|
||||
if (main) {
|
||||
// Reset Globals
|
||||
SESSION = data
|
||||
for (let i in TABS) {
|
||||
if (i!='#container') {
|
||||
TABS[i].parent.remove()
|
||||
TABS[i].tab.remove()
|
||||
delete TABS[i]
|
||||
}
|
||||
}
|
||||
TABS['#container'] = {
|
||||
tab:$('#container')
|
||||
}
|
||||
|
||||
iterators.tab = {}
|
||||
iterators.widget = {}
|
||||
|
||||
widgetManager.reset()
|
||||
|
||||
}
|
||||
|
||||
var main = main?'main ':'',
|
||||
nav = $(document.createElement('div')).addClass(main + 'navigation'),
|
||||
navtabs = $(document.createElement('ul')).addClass('tablist'),
|
||||
content = $(document.createElement('div')).addClass('content')
|
||||
|
||||
|
||||
for (let i in data) {
|
||||
var tabData = data[i]
|
||||
|
||||
|
||||
var label = tabData.label||tabData.id||'Unnamed',
|
||||
hash = hashCode(label),
|
||||
id = 'tab_'+hash+'_'+getIterator('tab'+hash,'tab')
|
||||
|
||||
tabData.id = tabData.id || ''
|
||||
tabData.label = label
|
||||
|
||||
navtabs.append(`<li data-tab="#${id}" data-id="${tabData.id}"><a><span>${iconify(tabData.label)}</span></a></li>`)
|
||||
|
||||
let tabContent = $(`<div class="tab ${tabData.tabs&&tabData.tabs.length?'has-tabs':''}" id="${id}" data-index="${i}"></div>`)
|
||||
tabContent.data(tabData)
|
||||
|
||||
|
||||
if (tabData.tabs && tabData.tabs.length) {
|
||||
module.exports.tabs(tabData.tabs,tabContent,false)
|
||||
} else if (tabData.widgets && tabData.widgets.length) {
|
||||
module.exports.widgets(tabData.widgets,tabContent)
|
||||
}
|
||||
|
||||
tabContent.on('sync.detached', (e)=>{
|
||||
if (!document.contains(tabContent[0])) $body.trigger(e)
|
||||
})
|
||||
|
||||
// content.append(tabContent)
|
||||
TABS['#'+id]= {
|
||||
parent:content,
|
||||
tab:tabContent,
|
||||
data:tabData
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nav[0].appendChild(navtabs[0])
|
||||
parent[0].appendChild(nav[0])
|
||||
parent[0].appendChild(content[0])
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports.widgets = function(data, parentNode, parentWidget) {
|
||||
module.exports.widgets = function(data, parentNode, parentWidget, tab) {
|
||||
|
||||
for (let i in data) {
|
||||
var props = data[i]
|
||||
|
||||
// Set default widget type
|
||||
props.type = props.type || 'fader'
|
||||
props.type = tab ? 'tab' : props.type || 'fader'
|
||||
|
||||
// Safe copy widget's options
|
||||
let defaults = widgets[props.type].defaults()
|
||||
|
|
@ -114,10 +40,10 @@ module.exports.widgets = function(data, parentNode, parentWidget) {
|
|||
}
|
||||
|
||||
// Genrate widget's id, based on its type
|
||||
if (props.id=='auto') {
|
||||
if (props.id=='auto' || !props.id ) {
|
||||
var id
|
||||
while (!id || widgetManager.getWidgetById(id).length) {
|
||||
id=props.type+'_'+getIterator(props.type,'widget')
|
||||
id=props.type+'_'+getIterator(props.type)
|
||||
}
|
||||
props.id = id
|
||||
}
|
||||
|
|
@ -147,9 +73,12 @@ module.exports.widgets = function(data, parentNode, parentWidget) {
|
|||
|
||||
widgetManager.addWidget(widgetInner)
|
||||
|
||||
widgetContainer[0].setAttribute('data-widget', widgetInner.hash)
|
||||
|
||||
// dimensions / coordinates can't be < 0
|
||||
for (let t in {width:'',height:'',top:'',left:''}) {
|
||||
props[t] = `${props[t]}`.indexOf('-')!=-1?0:props[t]
|
||||
for (let t of ['width', 'height', 'top', 'left']) {
|
||||
if (props.hasOwnProperty(t))
|
||||
props[t] = `${props[t]}`.indexOf('-')!=-1?0:props[t]
|
||||
}
|
||||
|
||||
// convert dimensions / coordinates to rem
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ var sidepanel = function(data){
|
|||
}
|
||||
|
||||
var toggle = function(){
|
||||
var t = $(`<li><a id="open-toggle">${icon('navicon')}</a></li>`).appendTo('.navigation.main ul').click(function(e){
|
||||
var t = $('#open-toggle').parent().off('fake-click').on('fake-click', function(e){
|
||||
var t = (!$('#sidepanel').hasClass('sidepanel-open')) ? 250 : 0
|
||||
|
||||
|
||||
|
|
@ -130,15 +130,15 @@ var toggle = function(){
|
|||
$(window).resize()
|
||||
},t + 25)
|
||||
|
||||
}).on('mousedown touchstart',function(e){e.stopPropagation()})
|
||||
})
|
||||
|
||||
// in case where are hot loading a session
|
||||
if ($('#sidepanel').hasClass('sidepanel-open')) {
|
||||
$('#open-toggle, #container').addClass('sidepanel-open')
|
||||
}
|
||||
|
||||
$(document).on('keydown.sidepanel', function(e){
|
||||
if (e.keyCode==121) t.click()
|
||||
$(document).off('keydown.sidepanel').on('keydown.sidepanel', function(e){
|
||||
if (e.keyCode==121) t.trigger('fake-click')
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,36 +4,6 @@ var actions = require('./actions'),
|
|||
|
||||
var sidepanel = require('./sidepanel').init
|
||||
|
||||
// Tabs...
|
||||
var tabs = function() {
|
||||
$('#container').on('fake-click', function(e){
|
||||
var link = e.target
|
||||
|
||||
if (!link.hasAttribute('data-tab') || link.classList.contains('on')) return
|
||||
|
||||
var id = link.getAttribute('data-tab')
|
||||
|
||||
link.classList.add('on')
|
||||
|
||||
var previous = $(link).siblings('.on').removeClass('on').data('tab')
|
||||
|
||||
if (EDITING) editClean()
|
||||
|
||||
// TABS[id].tab.appendTo(TABS[id].parent)
|
||||
TABS[id].parent[0].appendChild(TABS[id].tab[0])
|
||||
$(previous).detach()
|
||||
|
||||
|
||||
$(id).find('li[data-tab]:first-child, li.parent + li[data-tab]').each(function(){
|
||||
if (!$(this).siblings('.on').length) $(this).trigger('fake-click')
|
||||
})
|
||||
|
||||
$(window).resize()
|
||||
|
||||
})
|
||||
$('li[data-tab]').first().trigger('fake-click')
|
||||
}
|
||||
|
||||
// zoom zoom
|
||||
var scrolls = function(){
|
||||
$('html').on('mousewheel.zoom',function(e) {
|
||||
|
|
@ -66,9 +36,7 @@ var scrolls = function(){
|
|||
module.exports = {
|
||||
init: function(){
|
||||
sidepanel()
|
||||
tabs()
|
||||
scrolls()
|
||||
},
|
||||
tabs:tabs,
|
||||
scrolls:scrolls
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
module.exports.widgets = {
|
||||
// tabs
|
||||
tab: require('./widgets/containers/tab'),
|
||||
root: require('./widgets/containers/root'),
|
||||
|
||||
// sliders
|
||||
fader: require('./widgets/sliders/fader'),
|
||||
knob: require('./widgets/sliders/knob'),
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ module.exports = class _widgets_base {
|
|||
if (this.parent && this.parent.props.type == 'strip') {
|
||||
delete this.props.top
|
||||
delete this.props.left
|
||||
delete this.props[this.parent.getProp('horizontal') ? 'height' : 'width']
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,14 +33,17 @@ module.exports = class Modal extends _widgets_base {
|
|||
|
||||
_osc:'osc',
|
||||
|
||||
value:'',
|
||||
precision:0,
|
||||
address:'auto',
|
||||
preArgs:[],
|
||||
target:[],
|
||||
|
||||
_chidlren:'children',
|
||||
|
||||
variables:{},
|
||||
|
||||
widgets:[],
|
||||
tabs:[]
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -70,13 +73,13 @@ module.exports = class Modal extends _widgets_base {
|
|||
this.widget[0].style.setProperty('--height', height)
|
||||
|
||||
this.widget.find('.closer').on('fake-click',(e)=>{
|
||||
this.setValue(false)
|
||||
this.setValue(false, {sync:true, send:true})
|
||||
})
|
||||
|
||||
this.light = $('<div class="light"></div>').appendTo(this.container)
|
||||
this.light.on('fake-click',(e)=>{
|
||||
if (e.button != 2)
|
||||
this.setValue(!this.value)
|
||||
this.setValue(!this.value, {sync:true, send:true})
|
||||
})
|
||||
|
||||
this.parentScroll = [0,0]
|
||||
|
|
@ -85,7 +88,7 @@ module.exports = class Modal extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
setValue(v) {
|
||||
setValue(v, options={}) {
|
||||
|
||||
this.value = v ? true : false
|
||||
|
||||
|
|
@ -102,6 +105,10 @@ module.exports = class Modal extends _widgets_base {
|
|||
|
||||
if (!this.init || this.value == true) this.fixStacking()
|
||||
if (!this.init) this.init = true
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
|
||||
}
|
||||
|
||||
fixScrolling(){
|
||||
|
|
@ -115,7 +122,6 @@ module.exports = class Modal extends _widgets_base {
|
|||
}
|
||||
|
||||
fixStacking() {
|
||||
console.log(this.value, this.container.parents('.widget'))
|
||||
if (this.value) {
|
||||
this.container.parents('.widget').css('z-index','initial')
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
var _widgets_base = require('../common/_widgets_base'),
|
||||
autolayout = require('autolayout/dist/autolayout.min.js'),
|
||||
editObject = function(){editObject = require('../../editor/edit-objects').editObject; editObject(...arguments)}
|
||||
{iconify} = require('../../utils'),
|
||||
editObject = function(){editObject = require('../../editor/edit-objects').editObject; editObject(...arguments)},
|
||||
{widgetManager} = require('../../managers')
|
||||
|
||||
|
||||
|
||||
module.exports = class Panel extends _widgets_base {
|
||||
|
|
@ -27,6 +30,14 @@ module.exports = class Panel extends _widgets_base {
|
|||
layout:'',
|
||||
spacing:0,
|
||||
|
||||
_osc:'osc',
|
||||
|
||||
value:'',
|
||||
precision:0,
|
||||
address:'auto',
|
||||
preArgs:[],
|
||||
target:[],
|
||||
|
||||
_children:'children',
|
||||
|
||||
variables:{},
|
||||
|
|
@ -43,48 +54,107 @@ module.exports = class Panel extends _widgets_base {
|
|||
super({...options, html: '<div class="panel"></div>'})
|
||||
|
||||
if (!this.getProp('scroll')) this.widget.addClass('noscroll')
|
||||
if (this.getProp('tabs').length) this.widget.addClass('has-tabs')
|
||||
if (this.getProp('tabs') && this.getProp('tabs').length) this.widget.addClass('has-tabs')
|
||||
|
||||
|
||||
this.value = 0
|
||||
this.tabs = []
|
||||
|
||||
var parsers = require('../../parser'),
|
||||
parsewidgets = parsers.widgets,
|
||||
parsetabs = parsers.tabs
|
||||
|
||||
if (this.getProp('tabs').length) {
|
||||
parsetabs(this.getProp('tabs'), this.widget)
|
||||
} else {
|
||||
if (this.getProp('tabs') && this.getProp('tabs').length) {
|
||||
|
||||
this.navigation = $('<div class="navigation"><ul class="tablist"></ul></div>').prependTo(this.widget).find('.tablist')
|
||||
this.wrapper = $('<div class="tabs-wrapper"></div>').appendTo(this.widget)
|
||||
|
||||
parsewidgets(this.getProp('tabs'), this.wrapper, this, true)
|
||||
this.createNavigation()
|
||||
|
||||
this.navigation.on('fake-click', (e)=>{
|
||||
if (!e.target.hasAttribute('data-widget')) return
|
||||
this.setValue($(e.target).index(), {sync: true, send:true})
|
||||
})
|
||||
|
||||
this.wrapper.on('tab-created', (e)=>{
|
||||
e.stopPropagation()
|
||||
this.createNavigation()
|
||||
|
||||
})
|
||||
|
||||
} else if (this.getProp('widgets') && this.getProp('widgets').length) {
|
||||
|
||||
parsewidgets(this.getProp('widgets'), this.widget, this)
|
||||
this.registerHashes()
|
||||
if (this.getProp('layout') != '') this.parseLayout()
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
registerHashes() {
|
||||
this.hashes = [this.hash]
|
||||
var widgets = this.widget.find('.widget')
|
||||
for (let widget of widgets) {
|
||||
if (widget.abstract.hashes) {
|
||||
this.hashes = this.hashes.concat(widget.abstract.hashes)
|
||||
} else {
|
||||
this.hashes.push(widget.abstract.hash)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createNavigation() {
|
||||
|
||||
this.navigation.empty()
|
||||
this.tabs = []
|
||||
|
||||
var tabs = this.wrapper.find('> .widget')
|
||||
|
||||
for (let tab of tabs) {
|
||||
this.tabs.push(tab.abstract)
|
||||
this.navigation.append(`<li data-widget="${tab.abstract.hash}"><a><span>${$(tab).find('> .label span').html()}</span></a></li>`)
|
||||
}
|
||||
|
||||
this.registerHashes()
|
||||
|
||||
this.setValue(this.value)
|
||||
|
||||
}
|
||||
|
||||
parseLayout() {
|
||||
|
||||
this.children = this.widget.find('> .widget')
|
||||
|
||||
if (this.getProp('layout') != '') {
|
||||
try {
|
||||
try {
|
||||
|
||||
var layout = this.getProp('layout').replace(/\$([0-9])+/g, (m)=>{
|
||||
return this.children[m.replace('$','')].abstract.getProp('id')
|
||||
})
|
||||
var layout = this.getProp('layout').replace(/\$([0-9])+/g, (m)=>{
|
||||
return this.children[m.replace('$','')].abstract.getProp('id')
|
||||
})
|
||||
|
||||
this.layout = new autolayout.View({
|
||||
constraints: autolayout.VisualFormat.parse(layout.split('\\n').join('\n').split(' ').join(''), {extended: true}),
|
||||
spacing: this.getProp('spacing')
|
||||
});
|
||||
this.layout = new autolayout.View({
|
||||
constraints: autolayout.VisualFormat.parse(layout.split('\\n').join('\n').split(' ').join(''), {extended: true}),
|
||||
spacing: this.getProp('spacing')
|
||||
});
|
||||
|
||||
this.widget.on('resize',(e, w, h)=>{
|
||||
if (!w) {
|
||||
var w = this.widget.width(),
|
||||
h = this.widget.height()
|
||||
}
|
||||
this.layout.setSize(w,h)
|
||||
this.applyLayout()
|
||||
})
|
||||
|
||||
} catch(err) {
|
||||
throw `Visual Format Language error in ${this.getProp('id')}.layout: ${err.message} (line ${err.line})`
|
||||
}
|
||||
this.widget.on('resize',(e, w, h)=>{
|
||||
if (!w) {
|
||||
var w = this.widget.width(),
|
||||
h = this.widget.height()
|
||||
}
|
||||
this.layout.setSize(w,h)
|
||||
this.applyLayout()
|
||||
})
|
||||
|
||||
} catch(err) {
|
||||
throw `Visual Format Language error in ${this.getProp('id')}.layout: ${err.message} (line ${err.line})`
|
||||
}
|
||||
|
||||
}
|
||||
applyLayout(){
|
||||
|
||||
applyLayout() {
|
||||
this.widget.find('> .widget').each((i,widget)=>{
|
||||
var id = widget.abstract.getProp('id')
|
||||
if (!this.layout.subViews[id]) return
|
||||
|
|
@ -98,4 +168,25 @@ module.exports = class Panel extends _widgets_base {
|
|||
})
|
||||
}
|
||||
|
||||
setValue(v, options={}) {
|
||||
if (this.tabs.length && typeof v == 'number' && v >= 0 && v < this.tabs.length) {
|
||||
|
||||
for (let i in this.tabs) {
|
||||
|
||||
this.tabs[i].hide()
|
||||
}
|
||||
|
||||
this.tabs[v].show()
|
||||
|
||||
this.navigation.find('li').removeClass('on').eq(v).addClass('on')
|
||||
this.value = v
|
||||
|
||||
$(window).resize()
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
53
src/browser/js/app/widgets/containers/root.js
Normal file
53
src/browser/js/app/widgets/containers/root.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
var Panel = require('./panel'),
|
||||
{iconify} = require('../../utils'),
|
||||
Tab = require('./tab')
|
||||
|
||||
|
||||
|
||||
module.exports = class Root extends Panel {
|
||||
|
||||
static defaults() {
|
||||
|
||||
return {
|
||||
|
||||
type:'root',
|
||||
|
||||
_osc:'osc',
|
||||
|
||||
value:'',
|
||||
precision:0,
|
||||
address:'auto',
|
||||
preArgs:[],
|
||||
target:[],
|
||||
|
||||
_children:'children',
|
||||
|
||||
variables:{},
|
||||
|
||||
tabs:[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
||||
options.props.id = 'root'
|
||||
options.props.scroll = true
|
||||
options.props.label = false
|
||||
|
||||
super(options)
|
||||
|
||||
this.widget.addClass('root')
|
||||
this.widget.find('> .navigation').addClass('main')
|
||||
|
||||
}
|
||||
|
||||
createNavigation() {
|
||||
|
||||
super.createNavigation()
|
||||
|
||||
this.navigation.append(`<li class="not-editable"><a id="open-toggle">${iconify('^navicon')}</a></li>`)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -44,6 +44,7 @@ module.exports = class Strip extends Panel {
|
|||
this.container.addClass(this.getProp('horizontal') ? 'horizontal' : 'vertical')
|
||||
this.container.addClass(this.getProp('stretch') ? 'stretch' : '')
|
||||
|
||||
delete this.setValue
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
72
src/browser/js/app/widgets/containers/tab.js
Normal file
72
src/browser/js/app/widgets/containers/tab.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
var Panel = require('./panel'),
|
||||
editClean = function(){editClean = require('../../editor/edit-objects').editClean; editClean(...arguments)}
|
||||
|
||||
|
||||
|
||||
module.exports = class Tab extends Panel {
|
||||
|
||||
static defaults() {
|
||||
|
||||
return {
|
||||
type:'tab',
|
||||
id:'auto',
|
||||
|
||||
_style:'style',
|
||||
|
||||
label:'auto',
|
||||
css:'',
|
||||
|
||||
_layout:'layout',
|
||||
|
||||
layout:'',
|
||||
spacing:0,
|
||||
|
||||
_osc:'osc',
|
||||
|
||||
value:'',
|
||||
precision:0,
|
||||
address:'auto',
|
||||
preArgs:[],
|
||||
target:[],
|
||||
|
||||
_children:'children',
|
||||
|
||||
variables:{},
|
||||
|
||||
widgets:[],
|
||||
tabs:[]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
||||
options.props.scroll = true
|
||||
|
||||
super(options)
|
||||
|
||||
this.widget.addClass('tab')
|
||||
|
||||
this.detached = false
|
||||
|
||||
var $body = $('body')
|
||||
|
||||
this.widget.on('sync.detached', (e)=>{
|
||||
if (this.detached) $body.trigger(e)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (EDITING) editClean()
|
||||
this.widget.detach()
|
||||
this.container.hide()
|
||||
this.detached = true
|
||||
|
||||
}
|
||||
show() {
|
||||
this.container.show().append(this.widget)
|
||||
this.detached = false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -12,41 +12,11 @@ body {
|
|||
flex-direction: column;
|
||||
background:var(--color-bg);
|
||||
padding:2rem;
|
||||
// transition:right .2s;
|
||||
&.sidepanel-open {
|
||||
right:var(--sidepanel-size);
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
height:100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background:var(--color-fg);
|
||||
padding:2rem;
|
||||
margin-top:1rem;
|
||||
}
|
||||
|
||||
.tab {
|
||||
position: absolute;
|
||||
overflow: auto;
|
||||
left:-1rem;
|
||||
right:0;
|
||||
top:-1rem;
|
||||
bottom:0;
|
||||
background:var(--color-bg);
|
||||
transform: rotateZ(0);
|
||||
}
|
||||
.has-tabs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
> .navigation {
|
||||
background:var(--color-bg);
|
||||
}
|
||||
> .content {
|
||||
background:none;
|
||||
}
|
||||
}
|
||||
|
||||
.navigation {
|
||||
height:var(--nav-height);
|
||||
|
|
@ -54,6 +24,15 @@ body {
|
|||
flex-shrink:0;
|
||||
font-weight:bold;
|
||||
text-transform: uppercase;
|
||||
background: transparent;
|
||||
height:calc(var(--nav-height) - 2rem);
|
||||
|
||||
&:after {
|
||||
background: var(--color-bg);
|
||||
}
|
||||
a.on {
|
||||
border-color: var(--color-bg);
|
||||
}
|
||||
|
||||
&.main {
|
||||
li:last-child {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,15 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--color-bg);
|
||||
> .content {
|
||||
left:1rem;
|
||||
width: calc(100% - 1rem);
|
||||
> .tabs-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
left:-1rem;
|
||||
> .widget {
|
||||
background: none;
|
||||
border-top:none;
|
||||
// border-right:1rem solid transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -32,6 +38,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
> .tabs-wrapper {
|
||||
flex:1;
|
||||
min-height:0;
|
||||
> .tab-container {
|
||||
// width: 100%;
|
||||
> .label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
&.nolabel {
|
||||
> .panel {
|
||||
|
|
@ -42,21 +60,8 @@
|
|||
}
|
||||
|
||||
}
|
||||
.navigation {
|
||||
// margin-top: 1rem;
|
||||
background: transparent;
|
||||
height:calc(var(--nav-height) - 2rem);
|
||||
&:after {
|
||||
background: var(--color-bg);
|
||||
}
|
||||
a.on {
|
||||
border-color: var(--color-bg);
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -79,6 +84,7 @@
|
|||
&.horizontal {
|
||||
width: 100%;
|
||||
height: 130rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&.vertical {
|
||||
|
|
@ -139,6 +145,13 @@
|
|||
background: var(--color-fg);
|
||||
|
||||
}
|
||||
.editor-enabled .strip-container {
|
||||
&.horizontal > .panel > .widget > .ui-resizable-s,
|
||||
&.vertical > .panel > .widget > .ui-resizable-e,
|
||||
> .panel > .widget > .ui-resizable-se {
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-container {
|
||||
@extend .panel-container-base;
|
||||
|
|
@ -178,10 +191,10 @@
|
|||
position: absolute;
|
||||
width: auto;
|
||||
height: auto;
|
||||
top:45rem;
|
||||
top:46rem;
|
||||
left:-1rem;
|
||||
right:-1rem;
|
||||
bottom:-1rem;
|
||||
right:0rem;
|
||||
bottom:0rem;
|
||||
}
|
||||
}
|
||||
.popup-title {
|
||||
|
|
@ -205,3 +218,30 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
.root-container {
|
||||
@extend .panel-container-base;
|
||||
height: 100%;
|
||||
border:none;
|
||||
> .label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
.tab-container, .root-container {
|
||||
height: 100%;
|
||||
box-shadow: none;
|
||||
|
||||
|
||||
> .panel {
|
||||
transform: rotateZ(0);
|
||||
top:0rem;
|
||||
left:-1rem;
|
||||
right:0rem;
|
||||
&.has-tabs {
|
||||
top:1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue