Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function app () {
process.nextTick(() => insertCss(api.styles()))
var view = Value(getView())
var screen = h('App', view)
window.onhashchange = () => view.set(getView())
document.body.appendChild(screen)
// tabs (another core module) currently handles this
// window.addEventListener('error', window.onError = displayError)
return screen
}
function PreviewSetup (strings) {
var showPreview = Value(false)
var previewBtn = h('Button',
{
className: when(showPreview, '-strong', '-subtle'),
'ev-click': () => showPreview.set(!showPreview())
},
when(showPreview, strings.blogNew.actions.edit, strings.blogNew.actions.preview)
)
return { previewBtn, showPreview }
}
var { previewBtn, showPreview } = PreviewSetup(strings)
return nest('app.html.lightbox', (content, isOpen) => {
if (typeof isOpen !== 'function') isOpen = Value(false)
const closeMe = () => isOpen.set(false)
const lb = h('Lightbox', { className: when(isOpen, '-open', '-close'), 'ev-click': closeMe },
h('div.content', {'ev-click': (ev) => ev.stopPropagation()},[
content
]))
lb.close = closeMe
return lb
})
}
function menu (handleClick) {
var state = Value('')
return h('Menu', {
classList: [ state ],
'ev-mouseover': () => state.set('-active'),
'ev-mouseout': () => state.set('')
}, [
h('div', api.app.html.menuItem(handleClick))
])
}
}