updated dev

This commit is contained in:
ojack
2025-03-15 11:22:16 +01:00
13 changed files with 137 additions and 85 deletions

View File

@@ -3,6 +3,13 @@
- updated code editor to cm6
- still not working: dice button
# [1.5.3] - 2023 - 02 - 19
- fixed error reporting
- removed devtools
# [1.5.2] - 2023 - 02 - 10
- updated upload text, removed default
# [1.5.1] - 2023 - 07 - 19
## Added
- extension loader

File diff suppressed because one or more lines are too long

BIN
dist/images/hydra-landing.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

8
dist/index.html vendored
View File

@@ -7,13 +7,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title" content="HYDRA">
<meta property="og:description" content="live coding networked visuals in the browser">
<meta property="og:image" content="https://cdn.glitch.com/9c3a06ab-0731-42ca-a1a3-3a249825d08f%2FScreen%20Shot%202018-06-24%20at%204.47.49%20PM.png?1531889983803">
<meta property="og:image" content="/images/hydra-landing.png">
<meta property="og:url" content="https://hydra.ojack.xyz">
<meta name="twitter:title" content="HYDRA">
<meta name="twitter:description" content="live coding networked visuals in the browser">
<meta name="twitter:image" content="https://cdn.glitch.com/9c3a06ab-0731-42ca-a1a3-3a249825d08f%2FScreen%20Shot%202018-06-24%20at%204.47.49%20PM.png?1531889983803">
<meta name="twitter:image" content="/images/hydra-landing.png">
<meta name="twitter:card" content="summary_large_image">
<script src="https://unpkg.com/hydra-synth"></script>
<script src="https://cdn.jsdelivr.net/npm/hydra-synth/dist/hydra-synth.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js" defer></script>
<!-- <script src="./bundle.js?1.2wsdajk" defer></script> -->
@@ -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-3e7f6eb3.js"></script>
<script type="module" crossorigin src="./assets/index-e814b025.js"></script>
</head>
<body>
</body>

View File

@@ -7,13 +7,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title" content="HYDRA">
<meta property="og:description" content="live coding networked visuals in the browser">
<meta property="og:image" content="https://cdn.glitch.com/9c3a06ab-0731-42ca-a1a3-3a249825d08f%2FScreen%20Shot%202018-06-24%20at%204.47.49%20PM.png?1531889983803">
<meta property="og:image" content="/images/hydra-landing.png">
<meta property="og:url" content="https://hydra.ojack.xyz">
<meta name="twitter:title" content="HYDRA">
<meta name="twitter:description" content="live coding networked visuals in the browser">
<meta name="twitter:image" content="https://cdn.glitch.com/9c3a06ab-0731-42ca-a1a3-3a249825d08f%2FScreen%20Shot%202018-06-24%20at%204.47.49%20PM.png?1531889983803">
<meta name="twitter:image" content="/images/hydra-landing.png">
<meta name="twitter:card" content="summary_large_image">
<script src="https://unpkg.com/hydra-synth"></script>
<script src="https://cdn.jsdelivr.net/npm/hydra-synth/dist/hydra-synth.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js" defer></script>
<!-- <script src="./bundle.js?1.2wsdajk" defer></script> -->

View File

@@ -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)

View File

@@ -1,6 +1,6 @@
{
"name": "hydra-web-editor",
"version": "1.5.1",
"version": "1.5.3",
"description": "",
"main": "index.js",
"scripts": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -71,13 +71,15 @@ function showConfirmation(successCallback, terminateCallback) {
HYDRA SKETCH GALLERY
///////////////////////////////////////
🎨 Click 'OK' to add your sketch and screenshot to the gallery of hydra sketches at https://botsin.space/@hydra.
🎨 Add your sketch to the gallery of hydra sketches at https://botsin.space/@hydra.
✍️ Type your name, mastodon handle, or a short description below, and then press 'OK' to share.
‼️ Make sure you are ready to share - there is no undo button!
💖 Thank you for sharing! You are also warmly invited to join the the live coding server on the fediverse at https://social.toplap.org/.
`
, 'your name, mastodon handle, and/or a short description')
, '')
// console.log('confirm value', c)
if (c !== null) {

22
src/stores/repl-v2.js Normal file
View 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)
}
}

View File

@@ -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', () => {

View File

@@ -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
}

View File

@@ -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
}