integrate remix-plugin 0.0.4

pull/1/head
yann300 6 years ago
parent 8e4f05f715
commit 4525875e99
  1. 2
      package.json
  2. 98
      src/app.js
  3. 21
      src/app/components/plugin-manager-api.js
  4. 148
      src/app/components/plugin-manager-component.js
  5. 6
      src/app/components/swap-panel-api.js
  6. 6
      src/app/components/vertical-icons-api.js
  7. 2
      src/app/editor/SourceHighlighters.js
  8. 2
      src/app/files/browser-files-tree.js
  9. 2
      src/app/files/fileManager.js
  10. 2
      src/app/panels/editor-panel.js
  11. 9
      src/app/panels/file-panel.js
  12. 8
      src/app/tabs/analysis-tab.js
  13. 8
      src/app/tabs/compile-tab.js
  14. 9
      src/app/tabs/debugger-tab.js
  15. 12
      src/app/tabs/run-tab.js
  16. 8
      src/app/tabs/settings-tab.js
  17. 8
      src/app/tabs/support-tab.js
  18. 8
      src/app/tabs/test-tab.js
  19. 250
      src/lib/store.js
  20. 45
      src/remixAppManager.js
  21. 2
      src/universal-dapp.js

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

@ -36,7 +36,6 @@ var toolTip = require('./app/ui/tooltip')
var TransactionReceiptResolver = require('./transactionReceiptResolver') var TransactionReceiptResolver = require('./transactionReceiptResolver')
const PluginManagerComponent = require('./app/components/plugin-manager-component') const PluginManagerComponent = require('./app/components/plugin-manager-component')
const PluginManagerApi = require('./app/components/plugin-manager-api')
const VerticalIconsComponent = require('./app/components/vertical-icons-component') const VerticalIconsComponent = require('./app/components/vertical-icons-component')
const VerticalIconsApi = require('./app/components/vertical-icons-api') const VerticalIconsApi = require('./app/components/vertical-icons-api')
@ -44,7 +43,17 @@ const VerticalIconsApi = require('./app/components/vertical-icons-api')
const SwapPanelComponent = require('./app/components/swap-panel-component') const SwapPanelComponent = require('./app/components/swap-panel-component')
const SwapPanelApi = require('./app/components/swap-panel-api') const SwapPanelApi = require('./app/components/swap-panel-api')
const AppManager = require('remix-plugin').AppManager const CompileTab = require('./app/tabs/compile-tab')
const SettingsTab = require('./app/tabs/settings-tab')
const AnalysisTab = require('./app/tabs/analysis-tab')
const DebuggerTab = require('./app/tabs/debugger-tab')
const SupportTab = require('./app/tabs/support-tab')
const TestTab = require('./app/tabs/test-tab')
const RunTab = require('./app/tabs/run-tab')
const FilePanel = require('./app/panels/file-panel')
import { EntityStore } from './lib/store'
import { RemixAppManager } from './remixAppManager'
var styleGuide = require('./app/ui/styles-guide/theme-chooser') var styleGuide = require('./app/ui/styles-guide/theme-chooser')
var styles = styleGuide.chooser() var styles = styleGuide.chooser()
@ -208,7 +217,7 @@ class App {
profile () { profile () {
return { return {
type: 'app', name: 'App',
description: 'the app', description: 'the app',
methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider'] methods: ['getExecutionContextProvider', 'getProviderEndpoint', 'detectNetWork', 'addProvider', 'removeProvider']
} }
@ -407,7 +416,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
event: new EventEmitter(), event: new EventEmitter(),
profile () { profile () {
return { return {
type: 'txListener', name: 'TxListener',
events: ['newTransaction'] events: ['newTransaction']
} }
} }
@ -442,41 +451,74 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
- the current API is not optimal. For instance methods of `app` only refers to `executionContext`, wich does not make really sense. - the current API is not optimal. For instance methods of `app` only refers to `executionContext`, wich does not make really sense.
*/ */
const appManager = new AppManager({modules: [], plugins: []}) // TODOs those are instanciated before hand. should be instanciated on demand
const swapPanelComponent = new SwapPanelComponent() const pluginManagerComponent = new PluginManagerComponent()
const pluginManagerComponent = new PluginManagerComponent(
{
app: this,
udapp: udapp,
fileManager: fileManager,
sourceHighlighters: registry.get('editor').api.sourceHighlighters,
config: self._components.filesProviders['config'],
txListener: txListenerModuleProxy
})
registry.put({api: pluginManagerComponent.proxy(), name: 'pluginmanager'}) registry.put({api: pluginManagerComponent.proxy(), name: 'pluginmanager'})
self._components.editorpanel.init() let filePanel = new FilePanel()
self._components.fileManager.init() 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)
let analysis = new AnalysisTab(self._components.registry)
let debug = new DebuggerTab(self._components.registry)
let support = new SupportTab(self._components.registry)
let test = new TestTab(self._components.registry, compileTab)
let appStore = new EntityStore('module', { actives: [], ids: [], entities: {} }, 'name')
const appManager = new RemixAppManager(appStore)
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 }])
const swapPanelComponent = new SwapPanelComponent()
const verticalIconComponent = new VerticalIconsComponent() const verticalIconComponent = new VerticalIconsComponent()
const swapPanelApi = new SwapPanelApi(swapPanelComponent, verticalIconComponent, appManager)
const verticalIconsApi = new VerticalIconsApi(verticalIconComponent, appManager)
const swapPanelApi = new SwapPanelApi(swapPanelComponent, verticalIconComponent, pluginManagerComponent) self._components.editorpanel.init()
const verticalIconsApi = new VerticalIconsApi(verticalIconComponent, pluginManagerComponent) self._components.fileManager.init()
const pluginManagerAPI = new PluginManagerApi(pluginManagerComponent)
self._view.mainpanel.appendChild(self._components.editorpanel.render()) self._view.mainpanel.appendChild(self._components.editorpanel.render())
self._view.iconpanel.appendChild(verticalIconComponent.render()) self._view.iconpanel.appendChild(verticalIconComponent.render())
self._view.swappanel.appendChild(swapPanelComponent.render()) self._view.swappanel.appendChild(swapPanelComponent.render())
pluginManagerComponent.initDefault() appManager.doActivate('App')
verticalIconComponent.select('FilePanel') appManager.doActivate('Udapp')
// appManager.init(pluginManagerAPI) 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')
pluginManagerAPI.init({ verticalIconComponent.select('FilePanel')
modules: [],
plugins: []
})
// The event listener needs to be registered as early as possible, because the // The event listener needs to be registered as early as possible, because the
// parent will send the message upon the "load" event. // parent will send the message upon the "load" event.

@ -1,21 +0,0 @@
// const remixLib = require('remix-lib')
class PluginManagerApi {
constructor (pluginManagerComponent) {
this.component = pluginManagerComponent
pluginManagerComponent.event.on('activation', (item) => this.event.emit('activation', item)) // listen by appManager
pluginManagerComponent.event.on('deactivation', (item) => this.event.emit('deactivation', item)) // listen by appManager
}
init (data) {
for (var m in data.modules) {
this.renderItem(m)
}
for (var n in data.plugins) {
this.renderItem(n)
}
}
}
module.exports = PluginManagerApi

@ -14,6 +14,7 @@ var registry = require('../../global/registry')
const styleguide = require('../ui/styles-guide/theme-chooser') const styleguide = require('../ui/styles-guide/theme-chooser')
const styles = styleguide.chooser() const styles = styleguide.chooser()
import { EntityStore } from '../../lib/store.js'
const PluginManagerProxy = require('./plugin-manager-proxy') const PluginManagerProxy = require('./plugin-manager-proxy')
@ -21,147 +22,72 @@ const EventEmitter = require('events')
class PluginManagerComponent { class PluginManagerComponent {
constructor ({ app, udapp, fileManager, sourceHighlighters, config, txListener }) { constructor () {
this.event = new EventEmitter() this.event = new EventEmitter()
this.modulesDefinition = { this.data = {
// service module. They can be seen as daemon proxy: new PluginManagerProxy()
// they usually don't have UI and only represent the minimal API a plugins can access. }
'App': { name: 'App', target: app }, this.views = {
'Udapp': { name: 'Udapp', target: udapp }, root: null,
'FileManager': { name: 'FileManager', target: fileManager }, items: {}
'SourceHighlighters': { name: 'SourceHighlighters', target: sourceHighlighters },
'Config': { name: 'Config', target: config },
'TxListener': { name: 'TxListener', target: txListener },
// internal components. They are mostly views, they don't provide external API for plugins
'SolidityCompile': { name: 'SolidityCompile', description: 'Compile functionality for solidity', class: 'evm-compiler', Type: CompileTab, icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwYXRoIGQ9Ik00NiwxNXYtNCAgYzAtMS4xMDQtMC44OTYtMi0yLTJjMCwwLTI0LjY0OCwwLTI2LDBjLTEuNDY5LDAtMi40ODQtNC00LTRIM0MxLjg5Niw1LDEsNS44OTYsMSw3djR2Mjl2NGMwLDEuMTA0LDAuODk2LDIsMiwyaDM5ICBjMS4xMDQsMCwyLTAuODk2LDItMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBhdGggZD0iTTEsNDRsNS0yNyAgYzAtMS4xMDQsMC44OTYtMiwyLTJoMzljMS4xMDQsMCwyLDAuODk2LDIsMmwtNSwyNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+' },
'FilePanel': { name: 'FilePanel', Type: FilePanel, description: 'Load files from a variety of sources', icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwb2x5bGluZSBmaWxsPSJub25lIiBwb2ludHM9IjQ0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9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwYXRoIGQ9Ik0zMC45MzMsMzIuNTI4Yy0wLjE0Ni0xLjYxMi0wLjA5LTIuNzM3LTAuMDktNC4yMWMwLjczLTAuMzgzLDIuMDM4LTIuODI1LDIuMjU5LTQuODg4YzAuNTc0LTAuMDQ3LDEuNDc5LTAuNjA3LDEuNzQ0LTIuODE4ICBjMC4xNDMtMS4xODctMC40MjUtMS44NTUtMC43NzEtMi4wNjVjMC45MzQtMi44MDksMi44NzQtMTEuNDk5LTMuNTg4LTEyLjM5N2MtMC42NjUtMS4xNjgtMi4zNjgtMS43NTktNC41ODEtMS43NTkgIGMtOC44NTQsMC4xNjMtOS45MjIsNi42ODYtNy45ODEsMTQuMTU2Yy0wLjM0NSwwLjIxLTAuOTEzLDAuODc4LTAuNzcxLDIuMDY1YzAuMjY2LDIuMjExLDEuMTcsMi43NzEsMS43NDQsMi44MTggIGMwLjIyLDIuMDYyLDEuNTgsNC41MDUsMi4zMTIsNC44ODhjMCwxLjQ3MywwLjA1NSwyLjU5OC0wLjA5MSw0LjIxQzE5LjM2NywzNy4yMzgsNy41NDYsMzUuOTE2LDcsNDVoMzggIEM0NC40NTUsMzUuOTE2LDMyLjY4NSwzNy4yMzgsMzAuOTMzLDMyLjUyOHoiLz48L3N2Zz4=' },
'PluginManager': { name: 'PluginManager', target: this, description: 'Mangement of Plugins and Modules', icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWln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LTQuNzYzLTEuOTgybC0xLjI0NS03LjEwNmgtNiAgbC0xLjE1Niw3LjA4M2MtMS43MDQsMC40MTgtMy4zMTMsMS4wODMtNC43NzcsMS45NjNMMTAuMTgsNS44NzNsLTQuMjQzLDQuMjQxbDQuMTA3LDUuODc0Yy0wLjg4OCwxLjQ3LTEuNTYzLDMuMDc3LTEuOTkyLDQuNzkyICBMMSwyMS45NTR2Nmw3LjA0NCwxLjI0OWMwLjQyNSwxLjcxMSwxLjEwMSwzLjMxOCwxLjk5Miw0Ljc5bC00LjE2Myw1LjgyM2w0LjI0MSw0LjI0NWw1Ljg4MS00LjExOSAgYzEuNDY4LDAuODgyLDMuMDczLDEuNTUyLDQuNzc3LDEuOTczbDEuMTgsNy4wODdoNmwxLjI2MS03LjEwNWMxLjY5NS0wLjQzLDMuMjk3LTEuMTA1LDQuNzUxLTEuOTlsNS45MjIsNC4xNTVsNC4yNDItNC4yNDUgIGwtNC4yMjctNS44N2MwLjg3NS0xLjQ1NiwxLjUzOS0zLjA0OCwxLjk1OC00LjczOUw0OSwyNy45NTR6IE0yNSwzM2MtNC40MTgsMC04LTMuNTgyLTgtOHMzLjU4Mi04LDgtOHM4LDMuNTgyLDgsOFMyOS40MTgsMzMsMjUsMzMgIHoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPg==' }
} }
this.activated = {} // list all activated modules
// this.activated = [] // list all activated modules
this.plugins = []
this.data = {}
this.data.proxy = new PluginManagerProxy()
// This load the state from localstorage first then from the second parameter is nothing is found in localstorage
// this.store = Store.fromLocal('***', {}) // Or EntityStore.fromLocal('***', {}, 'id')
} }
proxy () { profile () {
return this.data.proxy return {
name: 'PluginManager',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjw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va2U9IiMwMDAwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2Utd2lkdGg9IjIiLz48cG9seWxpbmUgZmlsbD0ibm9uZSIgcG9pbnRzPSIzMCw0MSAyNSw0NiAyMCw0MSAgICIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIiB4MT0iMjUiIHgyPSIyNSIgeTE9IjI2IiB5Mj0iNDUuNjY4Ii8+PC9zdmc+'
}
} }
initDefault () { setApp (appManager) {
this.activateInternal('App') this.appManager = appManager
this.activateInternal('Udapp') }
this.activateInternal('FileManager')
this.activateInternal('SourceHighlighters') setStore (store) {
this.activateInternal('Config') this.store = store
this.activateInternal('TxListener') this.store.event.on('activate', (name) => { this.views.items[name] ? this.views.items[name].querySelector('button').innerHTML = 'deactivate' : null })
this.store.event.on('deactivate', (name) => { this.views.items[name] ? this.views.items[name].querySelector('button').innerHTML = 'activate' : null })
this.activateInternal('FilePanel') }
this.activateInternal('SolidityCompile')
this.activateInternal('Run') proxy () {
this.activateInternal('PluginManager') return this.data.proxy
this.activateInternal('Settings')
this.activateInternal('Support')
} }
render () { render () {
// var self = this
// loop over all this.modules and this.plugins
let pluginManagerDiv = yo` let pluginManagerDiv = yo`
<div id='pluginManager' class=${css.plugins} > <div id='pluginManager' class=${css.plugins} >
<h2>Plugin Manager</h2> <h2>Plugin Manager</h2>
</div> </div>
` `
for (var mod in this.modulesDefinition) { var modules = this.store.getAll()
if (this.modulesDefinition[mod].icon) { modules.forEach((mod) => {
pluginManagerDiv.appendChild(this.renderItem(mod)) pluginManagerDiv.appendChild(this.renderItem(mod.profile.name))
} })
}
console.log(this.activated)
return pluginManagerDiv return pluginManagerDiv
} }
renderItem (item) { renderItem (item) {
let ctrBtns let ctrBtns
let action = (event) => { let action = () => { this.store.isActive(item) ? this.appManager.doDeactivate(item) : this.appManager.doActivate(item) }
if (this.activated.hasOwnProperty(item)) {
this.deactivateInternal(item)
event.target.innerHTML = 'activate'
} else {
this.activateInternal(item)
event.target.innerHTML = 'deactivate'
}
}
ctrBtns = yo`<div id='${item}Activation'> ctrBtns = yo`<div id='${item}Activation'>
<button onclick=${(event) => { action(event) }} >${this.activated[item] ? 'deactivate' : 'activate'}</button> <button onclick=${(event) => { action(event) }} >${this.store.isActive(item) ? 'deactivate' : 'activate'}</button>
</div>` </div>`
this.views.items[item] = ctrBtns
this.plugins.push(item) this.views.root = yo`
// var self = this
this.view = yo`
<div id='pluginManager' class=${css.plugin} > <div id='pluginManager' class=${css.plugin} >
<h3>${this.modulesDefinition[item].name}</h3> <h3>${this.modulesDefinition[item].name}</h3>
${this.modulesDefinition[item].description} ${this.modulesDefinition[item].description}
${ctrBtns} ${ctrBtns}
</div> </div>
` `
return this.view return this.views.root
}
activatePlugin (jsonProfile, api) {
// let profile = { json: jsonProfile, api }
// let plugin = new Plugin(profile, api)
// this.appManager.addPlugin(plugin)
// this.event.emit('displayableModuleActivated', jsonProfile, plugin.render())
// this.activated[jsonProfile.name] = plugin
}
deactivateInternal (name) {
if (!this.activated[name]) return
this.event.emit('removingItem', this.activated[name])
delete this.activated[name]
}
activateInternal (name) {
if (this.activated[name]) return
const mod = this.modulesDefinition[name]
let dep
if (mod.dep) dep = this.activateInternal(mod.dep)
let instance = mod.target
if (!instance && mod.Type) instance = new mod.Type(registry, dep)
if (!instance) return console.log(`PluginManagerComponent: no Type or instance to add: ${JSON.stringify(mod)}`)
registry.put({api: instance, name: mod.name.toLocaleLowerCase()})
if (instance.profile && typeof instance.profile === 'function') {
this.event.emit('requestActivation', instance.profile(), instance)
}
if (mod.icon && instance.render && typeof instance.render === 'function') {
this.event.emit('requestContainer', mod, instance.render())
}
// if of type evm-compiler, we forward to the internal components
if (mod.class === 'evm-compiler') {
this.data.proxy.register(mod, instance)
}
this.activated[mod.name] = mod
return instance
}
_activate (item) {
this.event.emit('activation', item)
}
_deactivate (item) {
this.event.emit('deactivation', item)
} }
} }

@ -1,15 +1,15 @@
// const EventEmmitter = require('events') // const EventEmmitter = require('events')
class SwapPanelApi { class SwapPanelApi {
constructor (swapPanelComponent, verticalIconsComponent, pluginManagerComponent) { constructor (swapPanelComponent, verticalIconsComponent, appManager) {
this.component = swapPanelComponent this.component = swapPanelComponent
verticalIconsComponent.event.on('showContent', (moduleName) => { verticalIconsComponent.event.on('showContent', (moduleName) => {
this.component.showContent(moduleName) this.component.showContent(moduleName)
}) })
pluginManagerComponent.event.on('requestContainer', (mod, content) => { appManager.event.on('requestContainer', (mod, content) => {
this.add(mod.name, content) this.add(mod.name, content)
}) })
pluginManagerComponent.event.on('removingItem', (mod) => { appManager.event.on('removingItem', (mod) => {
this.remove(mod.name) this.remove(mod.name)
}) })
} }

@ -1,10 +1,10 @@
// API // API
class VerticalIconsApi { class VerticalIconsApi {
constructor (verticalIconsComponent, pluginManagerComponent) { constructor (verticalIconsComponent, appManager) {
this.component = verticalIconsComponent this.component = verticalIconsComponent
pluginManagerComponent.event.on('requestContainer', (mod, content) => verticalIconsComponent.addIcon(mod)) appManager.event.on('requestContainer', (mod, content) => verticalIconsComponent.addIcon(mod))
pluginManagerComponent.event.on('removingItem', (mod) => verticalIconsComponent.removeIcon(mod)) appManager.event.on('removingItem', (mod) => verticalIconsComponent.removeIcon(mod))
} }
} }
module.exports = VerticalIconsApi module.exports = VerticalIconsApi

@ -9,7 +9,7 @@ module.exports = class SourceHighlighters {
profile () { profile () {
return { return {
type: 'sourcehighlighter', name: 'SourceHighlighters',
methods: ['highlight', 'discardHighlight'] methods: ['highlight', 'discardHighlight']
} }
} }

@ -133,7 +133,7 @@ function FilesTree (name, storage) {
this.profile = function () { this.profile = function () {
return { return {
type: this.type, name: this.type,
methods: ['get', 'set', 'remove'] methods: ['get', 'set', 'remove']
} }
} }

@ -52,7 +52,7 @@ class FileManager {
profile () { profile () {
return { return {
type: 'fileManager', name: 'FileManager',
methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'], methods: ['getFilesFromPath', 'getCurrentFile', 'getFile', 'setFile'],
events: ['currentFileChanged'] events: ['currentFileChanged']
} }

@ -16,6 +16,7 @@ class EditorPanel {
constructor (localRegistry) { constructor (localRegistry) {
var self = this var self = this
self.event = new EventManager() self.event = new EventManager()
self._view = {}
self._components = {} self._components = {}
self._components.registry = localRegistry || globalRegistry self._components.registry = localRegistry || globalRegistry
self._components.editor = new Editor({}) self._components.editor = new Editor({})
@ -39,7 +40,6 @@ class EditorPanel {
} }
} }
} }
self._view = {}
var contextualListener = new ContextualListener({editor: self._components.editor, pluginManager: self._deps.pluginManager}) var contextualListener = new ContextualListener({editor: self._components.editor, pluginManager: self._deps.pluginManager})
var contextView = new ContextView({contextualListener, editor: self._components.editor}) var contextView = new ContextView({contextualListener, editor: self._components.editor})

@ -196,6 +196,15 @@ function filepanel (localRegistry) {
self.render = function render () { return element } self.render = function render () { return element }
self.profile = function () {
return {
name: 'FilePanel',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwb2x5bGluZSBmaWxsPSJub25lIiBwb2ludHM9IjQ0LDIxIDQ0LDQ5IDYsNDkgICA2LDIxICIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBvbHlsaW5lIGZpbGw9Im5vbmUiIHBvaW50cz0iMTksNDkgMTksMjggMzEsMjggICAzMSw0OSAiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5Z29uIHBvaW50cz0iMzUsNSAzNSw4LjAxNiAzNywxMC4wOTQgMzcsNyAzOSw3IDM5LDEyLjIwMyA0MSwxNC4yNjYgNDEsNSAiLz48cG9seWxpbmUgZmlsbD0ibm9uZSIgcG9pbnRzPSIgIDEuMTEsMjUuOTQyIDI1LDEuMDUzIDQ4Ljg5LDI1Ljk0MyAiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPg=='
}
}
function uploadFile (event) { function uploadFile (event) {
// TODO The file explorer is merely a view on the current state of // TODO The file explorer is merely a view on the current state of
// the files module. Please ask the user here if they want to overwrite // the files module. Please ask the user here if they want to overwrite

@ -15,6 +15,14 @@ module.exports = class AnalysisTab {
self._components.registry = localRegistry || globalRegistry self._components.registry = localRegistry || globalRegistry
self._deps = {} self._deps = {}
} }
profile () {
return {
name: 'SolidityAnalysis',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxjaXJjbGUgY3g9IjIiIGN5PSIyNSIgcj0iMiIvPjxjaXJjbGUgY3g9IjE1IiBjeT0iMTkiIHI9IjIiLz48Y2lyY2xlIGN4PSIyNSIgY3k9IjExIiByPSIyIi8+PGNpcmNsZSBjeD0iMzUiIGN5PSIxNyIgcj0iMiIvPjxjaXJjbGUgY3g9IjQ4IiBjeT0iNSIgcj0iMiIvPjxjaXJjbGUgY3g9IjIiIGN5PSIzOSIgcj0iMiIvPjxjaXJjbGUgY3g9IjE1IiBjeT0iNDEiIHI9IjIiLz48Y2lyY2xlIGN4PSIyNSIgY3k9IjMzIiByPSIyIi8+PGNpcmNsZSBjeD0iMzUiIGN5PSI0MyIgcj0iMiIvPjxjaXJjbGUgY3g9IjQ4IiBjeT0iMzEiIHI9IjIiLz48cG9seWxpbmUgZmlsbD0ibm9uZSIgcG9pbnRzPSIyLDI1IDE1LDE5IDI1LDExICAgMzUsMTcgNDgsNSAiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjxwb2x5bGluZSBmaWxsPSJub25lIiBwb2ludHM9IjIsMzkgMTUsNDEgMjUsMzMgICAzNSw0MyA0OCwzMSAiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPg=='
}
}
render () { render () {
const self = this const self = this
var staticanalysis = new StaticAnalysis() var staticanalysis = new StaticAnalysis()

@ -56,8 +56,7 @@ module.exports = class CompileTab {
renderer: self._components.registry.get('renderer').api, renderer: self._components.registry.get('renderer').api,
swarmfileProvider: self._components.registry.get('fileproviders/swarm').api, swarmfileProvider: self._components.registry.get('fileproviders/swarm').api,
fileManager: self._components.registry.get('filemanager').api, fileManager: self._components.registry.get('filemanager').api,
fileProviders: self._components.registry.get('fileproviders').api, fileProviders: self._components.registry.get('fileproviders').api
pluginManager: self._components.registry.get('pluginmanager').api
} }
self.data = { self.data = {
hideWarnings: self._deps.config.get('hideWarnings') || false, hideWarnings: self._deps.config.get('hideWarnings') || false,
@ -187,9 +186,10 @@ module.exports = class CompileTab {
} }
profile () { profile () {
return { return {
type: 'solidityCompile', name: 'SolidityCompile',
methods: ['getCompilationResult'], methods: ['getCompilationResult'],
events: ['compilationFinished'] events: ['compilationFinished'],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwYXRoIGQ9Ik00NiwxNXYtNCAgYzAtMS4xMDQtMC44OTYtMi0yLTJjMCwwLTI0LjY0OCwwLTI2LDBjLTEuNDY5LDAtMi40ODQtNC00LTRIM0MxLjg5Niw1LDEsNS44OTYsMSw3djR2Mjl2NGMwLDEuMTA0LDAuODk2LDIsMiwyaDM5ICBjMS4xMDQsMCwyLTAuODk2LDItMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PHBhdGggZD0iTTEsNDRsNS0yNyAgYzAtMS4xMDQsMC44OTYtMiwyLTJoMzljMS4xMDQsMCwyLDAuODk2LDIsMmwtNSwyNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+'
} }
} }
addWarning (msg, settings) { addWarning (msg, settings) {

@ -27,6 +27,15 @@ class DebuggerTab {
self._components.registry = localRegistry || globalRegistry self._components.registry = localRegistry || globalRegistry
} }
profile () {
return {
name: 'Debugger',
methods: [],
events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gc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+'
}
}
render () { render () {
const self = this const self = this
if (self._view.el) return self._view.el if (self._view.el) return self._view.el

@ -178,7 +178,17 @@ function runTab (opts, localRegistry) {
` `
container.appendChild(el) container.appendChild(el)
return { render () { return container } } return {
render () { return container },
profile () {
return {
name: 'Run',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwYXRoIGQ9Ik00My43MzQsMjFjLTMuNjMxLDAtMTUuMDkyLDAtMTUuMDkyLDAgIFMxNi4yNSw1LjE4OCwxNi4wNDcsNC45MzhzLTAuNDIyLTAuNTk0LTEuMTI1LTAuNjcyYy0wLjg1OS0wLjA5NS0xLjk2OS0wLjIwMy0yLjMyOC0wLjIzNGMtMC40MDYtMC4wMzUtMC43MTksMC4xNDEtMC40OTYsMC43MzQgIEMxMi4zODgsNS41MzksMTguNzQ4LDIxLDE4Ljc0OCwyMUg2LjAzNGMwLDAtMi40NTgtNC43MjItMi44NzgtNS41MzFDMi45NjUsMTUuMTAxLDIuNTU3LDE1LjAxNCwyLDE1SDEuMjk3ICBjLTAuMTI1LDAtMC4zMTIsMC0wLjI4MSwwLjM0NEMxLjA1OCwxNS44MTEsMywyNSwzLDI1cy0xLjg4OCw5LjE5Ny0xLjk4NCw5LjY1NkMwLjk1MywzNC45NTMsMS4xNzIsMzUsMS4yOTcsMzVIMiAgYzAuOTY2LTAuMDA5LDAuOTU0LTAuMDc5LDEuMTU2LTAuNDY5QzMuNTc2LDMzLjcyMiw2LjAzNCwyOSw2LjAzNCwyOWgxMi43MTRjMCwwLTYuMzYsMTUuNDYxLTYuNjUsMTYuMjM0ICBjLTAuMjIzLDAuNTk0LDAuMDksMC43NywwLjQ5NiwwLjczNGMwLjM1OS0wLjAzMSwxLjQ2OS0wLjEzOSwyLjMyOC0wLjIzNGMwLjcwMy0wLjA3OCwwLjkyMi0wLjQyMiwxLjEyNS0wLjY3MlMyOC42NDMsMjksMjguNjQzLDI5ICBzMTEuNDYxLDAsMTUuMDkyLDBjMy43NjYsMCw1LjI2NC0zLjAzMSw1LjI2NC00UzQ3LjQ4NCwyMSw0My43MzQsMjF6IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+'
}
}
}
} }
module.exports = runTab module.exports = runTab

@ -38,6 +38,14 @@ module.exports = class SettingsTab {
self._components.themeStorage = new Storage('style:') self._components.themeStorage = new Storage('style:')
self.data.currentTheme = self._components.themeStorage.get('theme') || 'light' self.data.currentTheme = self._components.themeStorage.get('theme') || 'light'
} }
profile () {
return {
name: 'Settings',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnM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Q1NiwxLjUzOS0zLjA0OCwxLjk1OC00LjczOUw0OSwyNy45NTR6IE0yNSwzM2MtNC40MTgsMC04LTMuNTgyLTgtOHMzLjU4Mi04LDgtOHM4LDMuNTgyLDgsOFMyOS40MTgsMzMsMjUsMzMgIHoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPg=='
}
}
render () { render () {
const self = this const self = this
if (self._view.el) return self._view.el if (self._view.el) return self._view.el

@ -28,6 +28,14 @@ module.exports = class SupportTab {
self.data.gitterIsLoaded = true self.data.gitterIsLoaded = true
}) })
} }
profile () {
return {
name: 'Support',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwYXRoIGQ9Ik0zMC45MzMsMzIuNTI4Yy0wLjE0Ni0xLjYxMi0wLjA5LTIuNzM3LTAuMDktNC4yMWMwLjczLTAuMzgzLDIuMDM4LTIuODI1LDIuMjU5LTQuODg4YzAuNTc0LTAuMDQ3LDEuNDc5LTAuNjA3LDEuNzQ0LTIuODE4ICBjMC4xNDMtMS4xODctMC40MjUtMS44NTUtMC43NzEtMi4wNjVjMC45MzQtMi44MDksMi44NzQtMTEuNDk5LTMuNTg4LTEyLjM5N2MtMC42NjUtMS4xNjgtMi4zNjgtMS43NTktNC41ODEtMS43NTkgIGMtOC44NTQsMC4xNjMtOS45MjIsNi42ODYtNy45ODEsMTQuMTU2Yy0wLjM0NSwwLjIxLTAuOTEzLDAuODc4LTAuNzcxLDIuMDY1YzAuMjY2LDIuMjExLDEuMTcsMi43NzEsMS43NDQsMi44MTggIGMwLjIyLDIuMDYyLDEuNTgsNC41MDUsMi4zMTIsNC44ODhjMCwxLjQ3MywwLjA1NSwyLjU5OC0wLjA5MSw0LjIxQzE5LjM2NywzNy4yMzgsNy41NDYsMzUuOTE2LDcsNDVoMzggIEM0NC40NTUsMzUuOTE2LDMyLjY4NSwzNy4yMzgsMzAuOTMzLDMyLjUyOHoiLz48L3N2Zz4='
}
}
render () { render () {
const self = this const self = this
if (self._view.el) return self._view.el if (self._view.el) return self._view.el

@ -23,6 +23,14 @@ module.exports = class TestTab {
self.data = {} self.data = {}
self.testList = yo`<div class=${css.testList}></div>` self.testList = yo`<div class=${css.testList}></div>`
} }
profile () {
return {
name: 'Run',
methods: [],
events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUwIDUwIiBoZWlnaHQ9IjUwcHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MCA1MCIgd2lkdGg9IjUwcHgiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iNTAiIHdpZHRoPSI1MCIvPjxwYXRoIGQ9Ik00OSw0djI1YzAsMC01LjI3MywzLTEyLDMgIGMtMTEuOTI5LDAtMTUuODY5LTQtMjQtNFMxLDMwLDEsMzBWM2MwLDAsMi4wODUtMiwxMi0yczE0LjA0Nyw2LDI0LDZDNDMuMjgxLDcsNDguMTMsNC40NzEsNDksNHoiIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIvPjxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS13aWR0aD0iMiIgeDE9IjEiIHgyPSIxIiB5MT0iMyIgeTI9IjQ5Ii8+PC9zdmc+'
}
}
render () { render () {
const self = this const self = this
var testsOutput = yo`<div class=${css.container} hidden='true' id="tests"></div>` var testsOutput = yo`<div class=${css.container} hidden='true' id="tests"></div>`

@ -0,0 +1,250 @@
import { EventEmitter } from 'events'
export class Store {
/**
* Instanciate the store from `localStorage` first
* @template T
* @param {string} name The name of the store
* @param {T} initialState The initial state used if state is not available in `localStorage`
*/
static fromLocal(name, initialState) {
const fromLocal = localStorage.getItem(name)
const intial = fromLocal ? JSON.parse(fromLocal) : initialState
return new Store(name, intial)
}
/**
* Create a Store that hold the state of the component
* @template T
* @param {string} name The name of the store
* @param {T} initialState The initial state of the store
*/
constructor(name, initialState) {
this.event = new EventEmitter()
this.name = name
this.state = initialState
}
/** Listen on event from the store */
get on() {
return this.event.on;
}
/** Liste once on event from the store */
get once() {
return this.event.once;
}
/**
* Update one field of the state
* @param {Partial<T>} state The part of the state updated
*/
/*
update(state) {
this.state = { ...this.state, ...state }
}
*/
/**
* Get one field of the state
* @template Key key of `this.state`
* @param {Key} key A key of the state
*/
get(key) {
return this.state.entities[key]
}
/** Reset the state its initial value */
reset() {
this.state = this.initialState
}
/** Dispatch an event with the new state */
dispatch() {
this.event.emit('newState', this.state)
}
}
/**
* An entity inside a collection
* @typedef {Object} EntityState
* @property {string[]} ids The list of IDs of the entity in the state
* @property {string[]} actives The list of IDs of the activated entities
* @property {Object} entities A map of ids and entities
*/
export class EntityStore extends Store {
/**
* Instanciate the store from `localStorage` first
* @param {string} name The name of the store
* @param {EntityState} initialState The initial state used if state is not available in `localStorage`
*/
static fromLocal(name, initialState) {
const fromLocal = localStorage.getItem(name)
const intial = fromLocal ? JSON.parse(fromLocal) : initialState
return new EntityStore(name, intial)
}
/**
* Create a entity Store that hold a map entity of the same model
* @param {string} name The name of the store
* @param {EntityState} initialState The initial state used if state is not available in `localStorage`
*/
constructor(name, initialState) {
super(name, initialState)
}
////////////
// GETTER //
////////////
/** Tne entities as a Map */
get entities() {
return this.state.entities
}
/** List of all the ids */
get ids() {
return this.state.ids
}
/** List of all active ID */
get actives() {
return this.state.actives
}
/** Return the length of the entity collection */
get length() {
return this.state.ids.length
}
/////////////
// SETTERS //
/////////////
/**
* Add a new entity to the state
* @param {Object} entity
*/
add(id, entity) {
this.state.entities[id] = entity
this.state.ids.push(id)
}
/**
* Remove an entity from the state
* @param {(string|number)} id The id of the entity to remove
*/
remove(id) {
delete this.state.entities[id]
this.state.ids.splice(this.state.ids.indexOf(id), 1)
this.state.actives.splice(this.state.ids.indexOf(id), 1)
}
/**
* Update one entity of the state
* @param {(string|number)} id The id of the entity to update
* @param {Object} update The fields to update in the entity
*/
/*
updateOne(id, update) {
this.state.entities[id] = {
...this.state.entities[id],
...update
}
}
*/
/**
* Activate one or several entity from the state
* @param {((string|number))} ids An id or a list of id to activate
*/
activate(id) {
this.state.actives.push(id)
this.event.emit('activate', id)
}
/**
* Deactivate one or several entity from the state
* @param {(string|number))} ids An id or a list of id to deactivate
*/
deactivate(id) {
this.state.actives.splice(this.state.actives.indexOf(id), 1)
this.event.emit('deactivate', id)
}
///////////
// QUERY //
///////////
/**
* Get one entity
* @param {(string|number)} id The id of the entity to get
*/
getOne(id) {
return this.state.entities[id]
}
/**
* Get many entities as an array
* @param {(string|number)[]} ids An array of id of entity to get
*/
getMany(ids) {
return ids.map(id => this.state.entities[id])
}
/** Get all the entities as an array */
getAll() {
return this.state.ids.map(id => this.state.entities[id])
}
/** Get all active entities */
getActives() {
return this.state.actives.map(id => this.state.entities[id])
}
////////////////
// CONDITIONS //
////////////////
/**
* Is the entity active
* @param {(string|number)} id The id of the entity to check
*/
isActive(id) {
return this.state.actives.includes(id)
}
/**
* Is this id inside the store
* @param {(string|number)} id The id of the entity to check
*/
hasEntity(id) {
return this.state.ids.includes(id)
}
/**
* Is the state empty
* @param {(string|number)} id The id of the entity to check
*/
isEmpty() {
return this.state.ids.length === 0
}
}
/**
* Store the state of the stores into LocalStorage
* @param {Store[]} stores The list of stores to store into `localStorage`
*/
function localState(stores) {
stores.forEach(store => {
const name = store.name
store.on('newState', (state) => {
localStorage.setItem(name, JSON.stringify(state))
})
})
}

@ -0,0 +1,45 @@
import { AppManagerApi } from 'remix-plugin'
import { EventEmitter } from 'events'
export class RemixAppManager extends AppManagerApi {
constructor (store) {
super(null)
this.store = store
this.event = new EventEmitter()
}
doActivate (name) {
this.activateOne(name)
// temp
this.store.activate(name)
// promise ?
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())
}
}
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)
}
}
setActive (name, isActive) {
isActive ? this.store.activate(name) : this.store.deactivate(name)
}
getEntity (entityName) {
return this.store.get(entityName)
}
addEntity (entity) {
this.store.add(entity.profile.name, entity)
}
}

@ -31,7 +31,7 @@ function UniversalDApp (registry) {
UniversalDApp.prototype.profile = function () { UniversalDApp.prototype.profile = function () {
return { return {
type: 'udapp', name: 'Udapp',
methods: ['runTestTx', 'getAccounts', 'createVMAccount'] methods: ['runTestTx', 'getAccounts', 'createVMAccount']
} }
} }

Loading…
Cancel
Save