mirror of
https://github.com/hydra-synth/hydra.git
synced 2025-12-05 14:30:03 +01:00
updated CHANGELOG
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
# [1.5.1] - 2023 - 07 - 19
|
||||||
|
## Added
|
||||||
|
- extension loader
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- refactored some event names
|
||||||
|
- separated stores by functionality
|
||||||
|
|
||||||
# [1.5.0] - 2023 - 07 - 14
|
# [1.5.0] - 2023 - 07 - 14
|
||||||
- switch to ES6 syntax
|
- switch to ES6 syntax
|
||||||
- working with vite bundler. KNOWN BUG/CHANGE: editor now requires `const n = 4` instead of `n=4` this breaks some examples
|
- working with vite bundler. KNOWN BUG/CHANGE: editor now requires `const n = 4` instead of `n=4` this breaks some examples
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// to add:
|
||||||
|
// flash block, flash line, format code
|
||||||
|
|
||||||
export default function editorStore(state, emitter) {
|
export default function editorStore(state, emitter) {
|
||||||
emitter.on('editor: randomize', function (evt) {
|
emitter.on('editor: randomize', function (evt) {
|
||||||
const editor = state.editor.editor
|
const editor = state.editor.editor
|
||||||
@@ -14,6 +17,11 @@ export default function editorStore(state, emitter) {
|
|||||||
state.editor.editor.addCodeToTop(code)
|
state.editor.editor.addCodeToTop(code)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
emitter.on('editor: load code', (code) => {
|
||||||
|
const editor = state.editor.editor
|
||||||
|
editor.setValue(code)
|
||||||
|
})
|
||||||
|
|
||||||
emitter.on('editor: eval all', function () {
|
emitter.on('editor: eval all', function () {
|
||||||
const editor = state.editor.editor
|
const editor = state.editor.editor
|
||||||
const code = editor.getValue()
|
const code = editor.getValue()
|
||||||
@@ -28,11 +36,4 @@ export default function editorStore(state, emitter) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
emitter.on('editor: eval line', (line) => {
|
|
||||||
repl.eval(line)
|
|
||||||
})
|
|
||||||
|
|
||||||
emitter.on('editor:evalBlock', (block) => {
|
|
||||||
repl.eval(block)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,9 @@ export default function galleryStore(state, emitter) {
|
|||||||
sketches = new Gallery((code, sketchFromURL) => {
|
sketches = new Gallery((code, sketchFromURL) => {
|
||||||
emitter.emit('load and eval code', code)
|
emitter.emit('load and eval code', code)
|
||||||
if(sketchFromURL) {
|
if(sketchFromURL) {
|
||||||
state.showInfo = false
|
emitter.emit('ui: hide info')
|
||||||
} else {
|
} else {
|
||||||
state.showInfo = true
|
emitter.emit('ui: show info')
|
||||||
}
|
}
|
||||||
emitter.emit('render')
|
emitter.emit('render')
|
||||||
// @todo create gallery store
|
// @todo create gallery store
|
||||||
@@ -19,12 +19,14 @@ export default function galleryStore(state, emitter) {
|
|||||||
state.gallery = sketches
|
state.gallery = sketches
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// redundant with below
|
||||||
emitter.on('gallery:saveToURL', function () {
|
emitter.on('gallery:saveToURL', function () {
|
||||||
let editor = state.editor.editor
|
let editor = state.editor.editor
|
||||||
const editorText = editor.getValue()
|
const editorText = editor.getValue()
|
||||||
sketches.saveLocally(editorText)
|
sketches.saveLocally(editorText)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// save to url
|
||||||
emitter.on('gallery: save locally', function (code) {
|
emitter.on('gallery: save locally', function (code) {
|
||||||
// let editor = state.editor.editor
|
// let editor = state.editor.editor
|
||||||
// const editorText = editor.getValue()
|
// const editorText = editor.getValue()
|
||||||
@@ -55,7 +57,7 @@ export default function galleryStore(state, emitter) {
|
|||||||
|
|
||||||
emitter.on('gallery:showExample', () => {
|
emitter.on('gallery:showExample', () => {
|
||||||
const editor = state.editor.editor
|
const editor = state.editor.editor
|
||||||
emitter.emit('ui: clear all')
|
emitter.emit('clear all')
|
||||||
sketches.setRandomSketch()
|
sketches.setRandomSketch()
|
||||||
editor.setValue(sketches.code)
|
editor.setValue(sketches.code)
|
||||||
// repl.eval(editor.getValue())
|
// repl.eval(editor.getValue())
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export default class Gallery {
|
|||||||
this.setSketchFromCode(base64Code, callback)
|
this.setSketchFromCode(base64Code, callback)
|
||||||
}
|
}
|
||||||
if (showCode === 'false') {
|
if (showCode === 'false') {
|
||||||
this.emitter.emit('hideAll')
|
this.emitter.emit('ui: hide all')
|
||||||
this.emitter.emit('hide info')
|
this.emitter.emit('hide info')
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ export default function store(state, emitter) {
|
|||||||
|
|
||||||
|
|
||||||
emitter.on('load and eval code', (code) => {
|
emitter.on('load and eval code', (code) => {
|
||||||
const editor = state.editor.editor
|
emitter.emit('editor: load code', code)
|
||||||
editor.setValue(code)
|
|
||||||
emitter.emit('repl: eval', code)
|
emitter.emit('repl: eval', code)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -46,17 +45,17 @@ export default function store(state, emitter) {
|
|||||||
editor.clear()
|
editor.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter.on('ui: clear all', () => {
|
emitter.on('clear all', () => {
|
||||||
clearAll()
|
clearAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
emitter.on('hideAll', function () {
|
emitter.on('ui: hide all', function () {
|
||||||
state.showUI = !state.showUI
|
state.showUI = !state.showUI
|
||||||
emitter.emit('render')
|
emitter.emit('render')
|
||||||
})
|
})
|
||||||
|
|
||||||
emitter.on('toggle info', function (count) {
|
emitter.on('ui: toggle info', function (count) {
|
||||||
if (state.showInfo) {
|
if (state.showInfo) {
|
||||||
// state.showInfo = false
|
// state.showInfo = false
|
||||||
// state.showExtensions = false
|
// state.showExtensions = false
|
||||||
@@ -85,14 +84,14 @@ export default function store(state, emitter) {
|
|||||||
// emitter.emit('render')
|
// emitter.emit('render')
|
||||||
// })
|
// })
|
||||||
|
|
||||||
emitter.on('show extensions', () => {
|
emitter.on('ui: show extensions', () => {
|
||||||
state.showExtensions = true
|
state.showExtensions = true
|
||||||
state.showInfo = true
|
state.showInfo = true
|
||||||
emitter.emit('extensions: select category')
|
emitter.emit('extensions: select category')
|
||||||
emitter.emit('render')
|
emitter.emit('render')
|
||||||
})
|
})
|
||||||
|
|
||||||
emitter.on('hide extensions', () => {
|
emitter.on('ui: hide extensions', () => {
|
||||||
state.showExtensions = false
|
state.showExtensions = false
|
||||||
emitter.emit('render')
|
emitter.emit('render')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import keymaps from './keymaps.js'
|
|||||||
import Mutator from './randomizer/Mutator.js'
|
import Mutator from './randomizer/Mutator.js'
|
||||||
import beautify from 'js-beautify'
|
import beautify from 'js-beautify'
|
||||||
|
|
||||||
console.log('BEAUTIFY', beautify)
|
|
||||||
|
|
||||||
var isShowing = true
|
var isShowing = true
|
||||||
|
|
||||||
|
|
||||||
@@ -34,9 +32,9 @@ export default class Editor extends EventEmitter {
|
|||||||
const extraKeys = {}
|
const extraKeys = {}
|
||||||
Object.entries(keymaps).forEach(([key, e]) => extraKeys[key] = () => {
|
Object.entries(keymaps).forEach(([key, e]) => extraKeys[key] = () => {
|
||||||
if(e == 'editor:evalBlock') {
|
if(e == 'editor:evalBlock') {
|
||||||
this.emit(e, this.getCurrentBlock().text)
|
this.emit('repl: eval', this.getCurrentBlock().text)
|
||||||
} else if (e == 'editor: eval line') {
|
} else if (e == 'editor: eval line') {
|
||||||
this.emit(e, this.getLine())
|
this.emit('repl: eval', this.getLine())
|
||||||
} else if (e == 'editor:toggleComment') {
|
} else if (e == 'editor:toggleComment') {
|
||||||
this.cm.toggleComment()
|
this.cm.toggleComment()
|
||||||
// } else if (e == 'gallery:saveToURL') {
|
// } else if (e == 'gallery:saveToURL') {
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ export default {
|
|||||||
'Shift-Ctrl-G': 'gallery:shareSketch',
|
'Shift-Ctrl-G': 'gallery:shareSketch',
|
||||||
'Shift-Ctrl-F': 'editor:formatCode',
|
'Shift-Ctrl-F': 'editor:formatCode',
|
||||||
'Shift-Ctrl-L': 'gallery:saveToURL',
|
'Shift-Ctrl-L': 'gallery:saveToURL',
|
||||||
'Shift-Ctrl-H': 'hideAll',
|
'Shift-Ctrl-H': 'ui: hide all',
|
||||||
'Shift-Ctrl-S': 'screencap'
|
'Shift-Ctrl-S': 'screencap'
|
||||||
}
|
}
|
||||||
@@ -12,13 +12,13 @@ export default function toolbar(state, emit) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const toggleInfo = state.showInfo ? icon("close", "fa-times", t('toolbar.hide-info'), 'toggle info') : icon("close", "fa-question-circle", t('toolbar.show-info'), 'toggle info')
|
const toggleInfo = state.showInfo ? icon("close", "fa-times", t('toolbar.hide-info'), 'ui: toggle info') : icon("close", "fa-question-circle", t('toolbar.show-info'), 'ui: toggle info')
|
||||||
|
|
||||||
const toggleExtensions = !state.showExtensions ? icon("add", "fa-solid fa-puzzle-piece", t('toolbar.load-extension'), 'show extensions') : icon("close", "fa-question-circle", t('toolbar.show-info'), 'hide extensions')
|
const toggleExtensions = !state.showExtensions ? icon("add", "fa-solid fa-puzzle-piece", t('toolbar.load-extension'), 'ui: show extensions') : icon("close", "fa-question-circle", t('toolbar.show-info'), 'ui: hide extensions')
|
||||||
|
|
||||||
return html`<div id="toolbar-container">
|
return html`<div id="toolbar-container">
|
||||||
${icon("run", `fa-play-circle ${hidden}`, t('toolbar.run'), 'editor: eval all')}
|
${icon("run", `fa-play-circle ${hidden}`, t('toolbar.run'), 'editor: eval all')}
|
||||||
${icon("clear", `fa fa-trash ${hidden}`, t('toolbar.clear'), 'ui: clear all')}
|
${icon("clear", `fa fa-trash ${hidden}`, t('toolbar.clear'), 'clear all')}
|
||||||
${toggleExtensions}
|
${toggleExtensions}
|
||||||
${icon("shuffle", `fa-random`, t('toolbar.shuffle'), 'gallery:showExample')}
|
${icon("shuffle", `fa-random`, t('toolbar.shuffle'), 'gallery:showExample')}
|
||||||
${icon("mutator", `fa-dice ${hidden}`, t('toolbar.random'), 'editor: randomize')}
|
${icon("mutator", `fa-dice ${hidden}`, t('toolbar.random'), 'editor: randomize')}
|
||||||
|
|||||||
Reference in New Issue
Block a user