Improved builder

This commit is contained in:
neauoire 2020-03-25 10:02:22 +09:00
parent a78e6d3d8a
commit 2387542efc
5 changed files with 11 additions and 16 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
builds/ builds/
.DS_Store .DS_Store
*/.DS_Store */.DS_Store
debug.*

View File

@ -1,6 +0,0 @@
<svg class="vector" width="300px" height="300px" xmlns="http://www.w3.org/2000/svg" baseProfile="full" version="1.1" style="width: 300px; height: 300px; stroke: rgb(0, 0, 0); stroke-width: 0; fill: none; stroke-linecap: round; background:black">
<rect width="300" height="300" style="fill:rgb(0,0,0)" />
<g transform="translate(48 48) scale(0.675)">
<path d="M60,60 l120,0 a60,60 0 0,1 60,60 a-60,60 0 0,1 -60,60 l-120,0 M180,180 a60,60 0 0,1 60,60" style="stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(255, 255, 255); fill: none;"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 586 B

View File

@ -59,7 +59,7 @@ function Acels (client) {
return h return h
} }
this.convert = (event) => { this.convert = (event) => {
const accelerator = event.key === ' ' ? 'Space' : event.key.substr(0, 1).toUpperCase() + event.key.substr(1) const accelerator = event.key === ' ' ? 'Space' : capitalize(event.key.replace('Arrow', ''))
if ((event.ctrlKey || event.metaKey) && event.shiftKey) { if ((event.ctrlKey || event.metaKey) && event.shiftKey) {
return `CmdOrCtrl+Shift+${accelerator}` return `CmdOrCtrl+Shift+${accelerator}`
} }
@ -113,6 +113,7 @@ function Acels (client) {
this.toggle = () => { this.toggle = () => {
this.el.className = this.el.className === 'hidden' ? '' : 'hidden' this.el.className = this.el.className === 'hidden' ? '' : 'hidden'
} }
function capitalize (s) { return s.substr(0, 1).toUpperCase() + s.substr(1) }
} }
'use strict' 'use strict'
function Lisp (lib = {}) { function Lisp (lib = {}) {

View File

@ -58,7 +58,7 @@ function Acels (client) {
} }
this.convert = (event) => { this.convert = (event) => {
const accelerator = event.key === ' ' ? 'Space' : event.key.substr(0, 1).toUpperCase() + event.key.substr(1) const accelerator = event.key === ' ' ? 'Space' : capitalize(event.key.replace('Arrow', ''))
if ((event.ctrlKey || event.metaKey) && event.shiftKey) { if ((event.ctrlKey || event.metaKey) && event.shiftKey) {
return `CmdOrCtrl+Shift+${accelerator}` return `CmdOrCtrl+Shift+${accelerator}`
} }
@ -81,6 +81,7 @@ function Acels (client) {
this.onKeyDown = (e) => { this.onKeyDown = (e) => {
const target = this.get(this.convert(e)) const target = this.get(this.convert(e))
if (!target || !target.downfn) { return this.pipe ? this.pipe.onKeyDown(e) : null } if (!target || !target.downfn) { return this.pipe ? this.pipe.onKeyDown(e) : null }
target.downfn() target.downfn()
e.preventDefault() e.preventDefault()
} }
@ -118,4 +119,6 @@ function Acels (client) {
this.toggle = () => { this.toggle = () => {
this.el.className = this.el.className === 'hidden' ? '' : 'hidden' this.el.className = this.el.className === 'hidden' ? '' : 'hidden'
} }
function capitalize (s) { return s.substr(0, 1).toUpperCase() + s.substr(1) }
} }

View File

@ -20,7 +20,7 @@ function cleanup (txt) {
// Create release // Create release
const release_body = ` fs.writeFileSync('index.html', cleanup(`
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<html> <html>
@ -43,13 +43,11 @@ const release_body = `
${styles.reduce((acc, item) => { return `${acc}/* Including Style ${item} */ \n\n${fs.readFileSync('./links/' + item, 'utf8')}\n` }, '')} ${styles.reduce((acc, item) => { return `${acc}/* Including Style ${item} */ \n\n${fs.readFileSync('./links/' + item, 'utf8')}\n` }, '')}
</style> </style>
</body> </body>
</html>` </html>`))
fs.writeFileSync('index.html', cleanup(release_body))
// Create debug // Create debug
const debug_body = ` fs.writeFileSync('debug.html', `
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<html> <html>
@ -70,8 +68,6 @@ const debug_body = `
}) })
</script> </script>
</body> </body>
</html>` </html>`)
fs.writeFileSync('debug.html', debug_body)
console.log(`Built ${id}`) console.log(`Built ${id}`)