use remix-plugin 0.0.5

pull/1/head
yann300 6 years ago
parent 45b566945f
commit 4774502da8
  1. 2
      package.json
  2. 69
      src/app.js
  3. 2
      src/app/components/plugin-manager-component.js
  4. 8
      src/lib/store.js
  5. 33
      src/remixAppManager.js

@ -42,7 +42,7 @@
"remix-analyzer": "0.3.1",
"remix-debug": "0.3.1",
"remix-lib": "0.4.1",
"remix-plugin": "0.0.1-alpha.4",
"remix-plugin": "0.0.1-alpha.5",
"remix-solidity": "0.3.1",
"remix-tests": "0.1.1",
"remixd": "0.1.8-alpha.6",

@ -449,15 +449,15 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// TODOs those are instanciated before hand. should be instanciated on demand
const pluginManagerComponent = new PluginManagerComponent()
let appStore = new EntityStore('module', { actives: [], ids: [], entities: {} }, 'name')
let appStore = new EntityStore('module', { actives: [], ids: [], entities: {} })
const appManager = new RemixAppManager(appStore)
registry.put({api: appManager.proxy(), name: 'pluginmanager'})
pluginManagerComponent.setApp(appManager)
pluginManagerComponent.setStore(appStore)
let filePanel = new FilePanel()
registry.put({api: filePanel, name: 'filepanel'})
let compileTab = new CompileTab(self._components.registry)
let run = new RunTab(self._components.registry)
let settings = new SettingsTab(self._components.registry)
@ -465,28 +465,25 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
let debug = new DebuggerTab(self._components.registry)
let support = new SupportTab(self._components.registry)
let test = new TestTab(self._components.registry, compileTab)
pluginManagerComponent.setApp(appManager)
pluginManagerComponent.setStore(appStore)
let sourceHighlighters = registry.get('editor').api.sourceHighlighters
let configProvider = self._components.filesProviders['config']
appManager.init([
{ profile: this.profile(), api: this },
{ profile: udapp.profile(), api: udapp },
{ profile: fileManager.profile(), api: fileManager },
{ profile: sourceHighlighters.profile(), api: sourceHighlighters },
{ profile: configProvider.profile(), api: configProvider },
{ profile: txListenerModuleProxy.profile(), api: txListenerModuleProxy },
{ profile: compileTab.profile(), api: compileTab },
{ profile: filePanel.profile(), api: filePanel },
{ profile: test.profile(), api: test },
{ profile: support.profile(), api: support },
{ profile: debug.profile(), api: debug },
{ profile: analysis.profile(), api: analysis },
{ profile: settings.profile(), api: settings },
{ profile: run.profile(), api: run },
{ profile: pluginManagerComponent.profile(), api: pluginManagerComponent }])
appStore.addEntities([
{ profile: this.profile(), api: this },
{ profile: udapp.profile(), api: udapp },
{ profile: fileManager.profile(), api: fileManager },
{ profile: sourceHighlighters.profile(), api: sourceHighlighters },
{ profile: configProvider.profile(), api: configProvider },
{ profile: txListenerModuleProxy.profile(), api: txListenerModuleProxy },
{ profile: compileTab.profile(), api: compileTab },
{ profile: filePanel.profile(), api: filePanel },
{ profile: test.profile(), api: test },
{ profile: support.profile(), api: support },
{ profile: debug.profile(), api: debug },
{ profile: analysis.profile(), api: analysis },
{ profile: settings.profile(), api: settings },
{ profile: run.profile(), api: run },
{ profile: pluginManagerComponent.profile(), api: pluginManagerComponent }])
const swapPanelComponent = new SwapPanelComponent()
const verticalIconComponent = new VerticalIconsComponent()
@ -500,18 +497,18 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
self._view.iconpanel.appendChild(verticalIconComponent.render())
self._view.swappanel.appendChild(swapPanelComponent.render())
appManager.doActivate('App')
appManager.doActivate('Udapp')
appManager.doActivate('FileManager')
appManager.doActivate('SourceHighlighters')
appManager.doActivate('config')
appManager.doActivate('TxListener')
appManager.doActivate('FilePanel')
appManager.doActivate('SolidityCompile')
appManager.doActivate('Run')
appManager.doActivate('PluginManager')
appManager.doActivate('Settings')
appManager.doActivate('Support')
appManager.activateOne('App')
appManager.activateOne('Udapp')
appManager.activateOne('FileManager')
appManager.activateOne('SourceHighlighters')
appManager.activateOne('config')
appManager.activateOne('TxListener')
appManager.activateOne('FilePanel')
appManager.activateOne('SolidityCompile')
appManager.activateOne('Run')
appManager.activateOne('PluginManager')
appManager.activateOne('Settings')
appManager.activateOne('Support')
verticalIconComponent.select('FilePanel')

@ -53,7 +53,7 @@ class PluginManagerComponent {
const mod = this.store.getOne(item)
if (!mod) return
let action = () => { this.store.isActive(item) ? this.appManager.doDeactivate(item) : this.appManager.doActivate(item) }
let action = () => { this.store.isActive(item) ? this.appManager.deactivateOne(item) : this.appManager.activateOne(item) }
ctrBtns = yo`<div id='${item}Activation'>
<button onclick=${(event) => { action(event) }} >${this.store.isActive(item) ? 'deactivate' : 'activate'}</button>

@ -135,6 +135,14 @@ export class EntityStore extends Store {
this.state.ids.push(id)
}
/**
* Add entities to the state
* @param {Array} entities
*/
addEntities(entities) {
entities.forEach((entity) => { this.add(entity.profile.name, entity) })
}
/**
* Remove an entity from the state
* @param {(string|number)} id The id of the entity to remove

@ -18,35 +18,16 @@ export class RemixAppManager extends AppManagerApi {
return this.data.proxy
}
doActivate (name) {
this.activateOne(name)
// temp
this.store.activate(name)
// promise ?
setActive (name, isActive) {
const entity = this.getEntity(name)
if (entity.profile.icon && entity.api.render && typeof entity.api.render === 'function') {
this.event.emit('requestContainer', entity.profile, entity.api.render())
}
if (name === 'SolidityCompile') {
this.data.proxy.register(entity.api)
if (entity && entity.profile.icon && entity.api.render && typeof entity.api.render === 'function') {
isActive ? this.event.emit('requestContainer', entity.profile, entity.api.render())
: this.event.emit('removingItem', entity.profile)
}
}
doDeactivate (name) {
this.deactivateOne(name)
// temp
this.store.deactivate(name)
// promise ?
const entity = this.getEntity(name)
if (entity.profile.icon && entity.api.render && typeof entity.api.render === 'function') {
this.event.emit('removingItem', entity.profile)
}
if (name === 'SolidityCompile') {
this.data.proxy.unregister(entity.api)
if (entity && name === 'SolidityCompiler') {
isActive ? this.data.proxy.register(entity.api) : this.data.proxy.unregister(entity.api)
}
}
setActive (name, isActive) {
isActive ? this.store.activate(name) : this.store.deactivate(name)
}
@ -57,4 +38,4 @@ export class RemixAppManager extends AppManagerApi {
addEntity (entity) {
this.store.add(entity.profile.name, entity)
}
}
}

Loading…
Cancel
Save