mirror of
https://github.com/hydra-synth/hydra.git
synced 2025-12-05 14:30:03 +01:00
updated build v1.5.3
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
# Changelog
|
||||
# [1.5.3] - 2023 - 02 - 19
|
||||
- fixed error reporting
|
||||
- removed devtools
|
||||
|
||||
# [1.5.2] - 2023 - 02 - 10
|
||||
- updated upload text, removed default
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -27,7 +27,7 @@
|
||||
<link rel="stylesheet" href="./css/modal.css">
|
||||
<link rel="shortcut icon" type="image/png" href="https://cdn.glitch.com/597fe374-3d18-46a5-b99c-ceff1f8ffd79%2Ffavicon.png?1530891352785" />
|
||||
|
||||
<script type="module" crossorigin src="./assets/index-4527e955.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-1010dfdc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
||||
2
index.js
2
index.js
@@ -9,7 +9,7 @@ import galleryStore from './src/stores/gallery-store.js'
|
||||
import mainView from './src/views/main.js'
|
||||
|
||||
const app = choo()
|
||||
app.use(devtools())
|
||||
// app.use(devtools())
|
||||
app.use(store)
|
||||
app.use(editorStore)
|
||||
app.use(galleryStore)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydra-web-editor",
|
||||
"version": "1.5.2",
|
||||
"version": "1.5.3",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
22
src/stores/repl-v2.js
Normal file
22
src/stores/repl-v2.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export default {
|
||||
eval: (arg, callback = () => {}) => {
|
||||
const info = {
|
||||
isError: false,
|
||||
codeString: '',
|
||||
errorMessage: ''
|
||||
}
|
||||
|
||||
// wrap everything in an async function
|
||||
var jsString = `(async() => {
|
||||
${arg}
|
||||
})().catch(${(err) => { window._reportError(err) }})`
|
||||
try {
|
||||
window.eval(jsString)
|
||||
} catch (err) {
|
||||
info.errorMessage = err.message
|
||||
}
|
||||
info.codeString = jsString
|
||||
if (info.errorMessage.length > 0) info.isError = true
|
||||
callback(info)
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
import repl from '../views/editor/repl.js'
|
||||
import repl from './repl-v2.js'
|
||||
// console.log('ENVIRONMENT IS', process.env.NODE_ENV)
|
||||
|
||||
export default function store(state, emitter) {
|
||||
state.showInfo = false
|
||||
state.showUI = true
|
||||
state.showExtensions = false
|
||||
state.errorMessage = ''
|
||||
state.isError = false
|
||||
|
||||
// if backend gallery endpoint supplied, then enable gallery functionality
|
||||
const SERVER_URL = import.meta.env.VITE_SERVER_URL
|
||||
state.serverURL = SERVER_URL !== undefined ? SERVER_URL : null
|
||||
|
||||
window._reportError = (err) => {
|
||||
state.errorMessage = err.message
|
||||
state.isError = true
|
||||
emitter.emit('render')
|
||||
}
|
||||
|
||||
emitter.on('load and eval code', (code, shouldUpdateURL = true) => {
|
||||
emitter.emit('editor: load code', code)
|
||||
@@ -18,7 +25,13 @@ export default function store(state, emitter) {
|
||||
})
|
||||
|
||||
emitter.on('repl: eval', (code = '', callback) => {
|
||||
repl.eval(code, callback)
|
||||
repl.eval(code, (info) => {
|
||||
state.errorMessage = info.errorMessage
|
||||
state.isError = info.isError
|
||||
if(callback) callback(info.codeString, info.isError)
|
||||
emitter.emit('render')
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
emitter.on('screencap', () => {
|
||||
|
||||
@@ -27,11 +27,13 @@ export default class Editor extends Component {
|
||||
|
||||
hide() {
|
||||
this.textEl.style.opacity = 0
|
||||
this.logElement.style.display = 'none'
|
||||
}
|
||||
|
||||
show() {
|
||||
this.textEl.style.opacity = 1
|
||||
this.textEl.style.pointerEvents = 'all'
|
||||
this.logElement.style.display = 'block'
|
||||
}
|
||||
|
||||
update (state) {
|
||||
@@ -40,6 +42,10 @@ export default class Editor extends Component {
|
||||
} else {
|
||||
this.show()
|
||||
}
|
||||
const msg = state.errorMessage
|
||||
const className = state.isError ? 'log-error' : ''
|
||||
console.log('UPDATING LOG updating state', state)
|
||||
this.logElement.innerHTML = ` >> <span class=${className}> ${msg} </span> `
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,13 @@ export default class Editor extends Component {
|
||||
|
||||
hide() {
|
||||
this.innerText.style.opacity = 0
|
||||
this.logElement.style.opacity = 0
|
||||
}
|
||||
|
||||
show() {
|
||||
this.innerText.style.opacity = 1
|
||||
this.innerText.style.pointerEvents = 'all'
|
||||
this.logElement.style.opacity = 1
|
||||
}
|
||||
|
||||
update (state) {
|
||||
@@ -40,6 +42,9 @@ export default class Editor extends Component {
|
||||
} else {
|
||||
this.show()
|
||||
}
|
||||
const msg = state.errorMessage
|
||||
const className = state.isError ? 'log-error' : ''
|
||||
this.logElement.innerHTML = ` >> <span class=${className}> ${msg} </span> `
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user