diff --git a/src/app/panels/editor-panel.js b/src/app/panels/editor-panel.js index 94795b2420..818d0417ea 100644 --- a/src/app/panels/editor-panel.js +++ b/src/app/panels/editor-panel.js @@ -157,7 +157,49 @@ class EditorPanel { context () { return self._api.context() } - } + }, + banner: ` +/****************************************************************************** + + ........................................... + .....................:..................... + ....................o:;.................... + ...................oo:;;................... + ..................ooo:;;;.................. + .................oooo:;;;;................. + ................ooooo:;;;;;................ + ...............oooooo:;;;;;;............... + ..............ooooooo:;;;;;;;.............. + .............ooooooo;:';;;;;;;............. + ............ooooo;;;;:'''';;;;;............ + ...........oo;;;;;;;;:'''''''';;........... + ..........;;;;;;;;;;;:'''''''''''.......... + ..............;;;;;;;:'''''''.............. + ...........oo...;;;;;:'''''...;;........... + ............oooo...;;:''...;;;;............ + ..............oooo...:...;;;;.............. + ...............oooooo:;;;;;;............... + ................ooooo:;;;;;................ + .................oooo:;;;;................. + ..................ooo:;;;.................. + ...................oo:;;................... + ....................o:;.................... + .....................:..................... + ........................................... + + ######## ######## ## ## #### ## ## + ## ## ## ### ### ## ## ## + ## ## ## #### #### ## ## ## + ######## ###### ## ### ## ## ### + ## ## ## ## ## ## ## ## + ## ## ## ## ## ## ## ## + ## ## ######## ## ## #### ## ## + + + welcome to browser solidity + +******************************************************************************/ +` }) } self._components.terminal.event.register('resize', delta => self._adjustLayout('top', delta)) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index f26103e94a..67e3c9d2a4 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -123,58 +123,15 @@ var ghostbar = yo`
` class Terminal { constructor (opts = { auto: true }) { var self = this + self.event = new EventManager() + self._api = opts.api self.data = { lineLength: opts.lineLength || 80, session: [], - banner: opts.banner || ` -/****************************************************************************** - - ........................................... - .....................:..................... - ....................o:;.................... - ...................oo:;;................... - ..................ooo:;;;.................. - .................oooo:;;;;................. - ................ooooo:;;;;;................ - ...............oooooo:;;;;;;............... - ..............ooooooo:;;;;;;;.............. - .............ooooooo;:';;;;;;;............. - ............ooooo;;;;:'''';;;;;............ - ...........oo;;;;;;;;:'''''''';;........... - ..........;;;;;;;;;;;:'''''''''''.......... - ..............;;;;;;;:'''''''.............. - ...........oo...;;;;;:'''''...;;........... - ............oooo...;;:''...;;;;............ - ..............oooo...:...;;;;.............. - ...............oooooo:;;;;;;............... - ................ooooo:;;;;;................ - .................oooo:;;;;................. - ..................ooo:;;;.................. - ...................oo:;;................... - ....................o:;.................... - .....................:..................... - ........................................... - - - ######## ######## ## ## #### ## ## - ## ## ## ### ### ## ## ## - ## ## ## #### #### ## ## ## - ######## ###### ## ### ## ## ### - ## ## ## ## ## ## ## ## - ## ## ## ## ## ## ## ## - ## ## ######## ## ## #### ## ## - - - welcome to browser solidity - - new features: - - dom terminal v0.0.1-alpha - -******************************************************************************/ -` + banner: opts.banner, + activeFilters: { commands: {}, input: '' } } - self.event = new EventManager() - self._api = opts.api + self._view = { el: null, bar: null, input: null, term: null, journal: null, cli: null } self._components = {} self._components.dropdown = new Dropdown({ options: [ @@ -185,12 +142,11 @@ class Terminal { defaults: ['knownTransaction', 'script'] }) self._components.dropdown.event.register('deselect', function (label) { - console.log('deselect', label) + self.updateJournal({ type: 'deselect', value: label }) }) self._components.dropdown.event.register('select', function (label) { - console.log('select', label) + self.updateJournal({ type: 'select', value: label }) }) - self._view = { el: null, bar: null, input: null, term: null, journal: null, cli: null } self._commands = {} self.commands = {} self._INDEX = {} @@ -256,7 +212,7 @@ class Terminal { ${self._view.term} ` - self.commands.log(self.data.banner) + if (self.data.banner) self.commands.log(self.data.banner) function throttle (fn, wait) { var time = Date.now() @@ -361,11 +317,11 @@ class Terminal { background.style.height = (self._view.journal.offsetHeight - (placeholder.offsetTop + placeholder.offsetHeight)) + 'px' background.onclick = undefined background.style.cursor = 'default' + background.style.pointerEvents = 'none' } else { background.style = '' text.style = '' background.onclick = function (event) { - console.error('background click') placeholder.scrollIntoView() check() } @@ -385,7 +341,7 @@ class Terminal { function filter (event) { var input = event.currentTarget setTimeout(function () { - console.log('filter', input.value) + self.updateJournal({ type: 'search', value: input.value }) }, 0) } function clear (event) { @@ -469,6 +425,43 @@ class Terminal { editable.focus() } } + updateJournal (filterEvent) { + // @TODO: updates `self.data.activeFilters: { commands: {}, input: '' }` + var value = filterEvent.value + if (filterEvent.type === 'select') { + console.log(value) + } else if (filterEvent.type === 'deselect') { + console.log(value) + } else if (filterEvent.type === 'search') { + console.log(value) + } + } + _keep (item) { + // @TODO: checks `self.data.activeFilters: { commands: {}, input: '' }` + // @TODO: return false (if item is currently filtered out / irrelevant + // according to `self.data.activeFilters` + // self._INDEX.all[item.gidx] + // + // self._INDEX.allMain + // self._INDEX.commands + // self._INDEX.commandsMain + // + // if () + // self.updateJournal( + // _INDEX + // + return true // false + } + _appendItem (item) { + var self = this + var { el, gidx } = item + if (self._keep(item)) { + self._view.journal.appendChild(yo` +