@ -35,12 +35,14 @@ const DebuggerTab = require('./app/tabs/debugger-tab')
const TestTab = require ( './app/tabs/test-tab' )
const TestTab = require ( './app/tabs/test-tab' )
const FilePanel = require ( './app/panels/file-panel' )
const FilePanel = require ( './app/panels/file-panel' )
const Editor = require ( './app/editor/editor' )
const Editor = require ( './app/editor/editor' )
const Terminal = require ( './app/panels/terminal' )
const ContextualListener = require ( './app/editor/contextualListener' )
import { basicLogo } from './app/ui/svgLogo'
import { basicLogo } from './app/ui/svgLogo'
import { RunTab , makeUdapp } from './app/udapp'
import { RunTab , makeUdapp } from './app/udapp'
import PanelsResize from './lib/panels-resize'
import PanelsResize from './lib/panels-resize'
import { Engine } from '@remixproject/engine'
import { RemixAppManager } from './remixAppManager'
import { RemixAppManager } from './remixAppManager'
import { FramingService } from './framingService'
import { FramingService } from './framingService'
import { MainView } from './app/panels/main-view'
import { MainView } from './app/panels/main-view'
@ -170,7 +172,7 @@ class App {
// center panel, resizable
// center panel, resizable
self . _view . sidepanel = yo `
self . _view . sidepanel = yo `
< div id = "side-panel" data - id = "remixIdeSidePanel" style = "min-width: 320px;" class = $ { css . sidepanel } >
< div id = "side-panel" data - id = "remixIdeSidePanel" style = "min-width: 320px;" class = "${css.sidepanel} border-right border-left" >
$ { '' }
$ { '' }
< / d i v >
< / d i v >
`
`
@ -229,12 +231,14 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// APP_MANAGER
// APP_MANAGER
const appManager = new RemixAppManager ( { } )
const appManager = new RemixAppManager ( { } )
const engine = new Engine ( appManager )
await engine . onload ( )
const workspace = appManager . pluginLoader . get ( )
const workspace = appManager . pluginLoader . get ( )
// SERVICES
// SERVICES
// ----------------- import content servive ----------------------------
// ----------------- import content servive ------------------------
const contentImport = new CompilerImport ( )
const contentImport = new CompilerImport ( )
// ----------------- theme servive ----------------------------
// ----------------- theme servive ---------------------------------
const themeModule = new ThemeModule ( registry )
const themeModule = new ThemeModule ( registry )
registry . put ( { api : themeModule , name : 'themeModule' } )
registry . put ( { api : themeModule , name : 'themeModule' } )
themeModule . initTheme ( ( ) => {
themeModule . initTheme ( ( ) => {
@ -247,6 +251,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const editor = new Editor ( { } , themeModule ) // wrapper around ace editor
const editor = new Editor ( { } , themeModule ) // wrapper around ace editor
registry . put ( { api : editor , name : 'editor' } )
registry . put ( { api : editor , name : 'editor' } )
editor . event . register ( 'requiringToSaveCurrentfile' , ( ) => fileManager . saveCurrentFile ( ) )
editor . event . register ( 'requiringToSaveCurrentfile' , ( ) => fileManager . saveCurrentFile ( ) )
// ----------------- fileManager servive ----------------------------
// ----------------- fileManager servive ----------------------------
const fileManager = new FileManager ( editor )
const fileManager = new FileManager ( editor )
registry . put ( { api : fileManager , name : 'filemanager' } )
registry . put ( { api : fileManager , name : 'filemanager' } )
@ -254,20 +259,38 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const blockchain = new Blockchain ( registry . get ( 'config' ) . api )
const blockchain = new Blockchain ( registry . get ( 'config' ) . api )
const pluginUdapp = new PluginUDapp ( blockchain )
const pluginUdapp = new PluginUDapp ( blockchain )
// ----------------- compilation metadata generation servive ----------------------------
// ----------------- compilation metadata generation servive ---------
const compilerMetadataGenerator = new CompilerMetadata ( blockchain , fileManager , registry . get ( 'config' ) . api )
const compilerMetadataGenerator = new CompilerMetadata ( blockchain , fileManager , registry . get ( 'config' ) . api )
// ----------------- compilation result service (can keep track of compilation results) ----------------------------
// ----------------- compilation result service (can keep track of compilation results) ----------------------------
const compilersArtefacts = new CompilersArtefacts ( ) // store all the compilation results (key represent a compiler name)
const compilersArtefacts = new CompilersArtefacts ( ) // store all the compilation results (key represent a compiler name)
registry . put ( { api : compilersArtefacts , name : 'compilersartefacts' } )
registry . put ( { api : compilersArtefacts , name : 'compilersartefacts' } )
const { eventsDecoder , txlistener } = makeUdapp ( blockchain , compilersArtefacts , ( domEl ) => mainview . getTerminal ( ) . logHtml ( domEl ) )
// ----------------- network service (resolve network id / name) -----
// ----------------- network service (resolve network id / name) ----------------------------
const networkModule = new NetworkModule ( blockchain )
const networkModule = new NetworkModule ( blockchain )
// ----------------- convert offset to line/column service ----------------------------
// ----------------- convert offset to line/column service -----------
var offsetToLineColumnConverter = new OffsetToLineColumnConverter ( )
const offsetToLineColumnConverter = new OffsetToLineColumnConverter ( )
registry . put ( { api : offsetToLineColumnConverter , name : 'offsettolinecolumnconverter' } )
registry . put ( { api : offsetToLineColumnConverter , name : 'offsettolinecolumnconverter' } )
appManager . register ( [
// -------------------Terminal----------------------------------------
const terminal = new Terminal (
{ appManager , blockchain } ,
{
getPosition : ( event ) => {
var limitUp = 36
var limitDown = 20
var height = window . innerHeight
var newpos = ( event . pageY < limitUp ) ? limitUp : event . pageY
newpos = ( newpos < height - limitDown ) ? newpos : height - limitDown
return height - newpos
}
}
)
makeUdapp ( blockchain , compilersArtefacts , ( domEl ) => terminal . logHtml ( domEl ) )
const contextualListener = new ContextualListener ( { editor } )
engine . register ( [
contentImport ,
contentImport ,
themeModule ,
themeModule ,
editor ,
editor ,
@ -275,24 +298,24 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
compilerMetadataGenerator ,
compilerMetadataGenerator ,
compilersArtefacts ,
compilersArtefacts ,
networkModule ,
networkModule ,
offsetToLineColumnConverter
offsetToLineColumnConverter ,
contextualListener ,
terminal
] )
] )
// LAYOUT & SYSTEM VIEWS
// LAYOUT & SYSTEM VIEWS
const appPanel = new MainPanel ( )
const appPanel = new MainPanel ( )
const mainview = new MainView ( editor , appPanel , fileManager , appManager , txlistener , eventsDecoder , blockchain )
const mainview = new MainView ( contextualListener , editor , appPanel , fileManager , appManager , terminal )
registry . put ( { api : mainview , name : 'mainview' } )
registry . put ( { api : mainview , name : 'mainview' } )
appManager . register ( [
engine . register ( appPanel )
appPanel
] )
// those views depend on app_manager
// those views depend on app_manager
const menuicons = new VerticalIcons ( appManager )
const menuicons = new VerticalIcons ( appManager )
const landingPage = new LandingPage ( appManager , menuicons )
const landingPage = new LandingPage ( appManager , menuicons )
const sidePanel = new SidePanel ( appManager , menuicons )
const sidePanel = new SidePanel ( appManager , menuicons )
const hiddenPanel = new HiddenPanel ( )
const hiddenPanel = new HiddenPanel ( )
const pluginManagerComponent = new PluginManagerComponent ( appManager )
const pluginManagerComponent = new PluginManagerComponent ( appManager , engine )
const filePanel = new FilePanel ( appManager )
const filePanel = new FilePanel ( appManager )
let settings = new SettingsTab (
let settings = new SettingsTab (
registry . get ( 'config' ) . api ,
registry . get ( 'config' ) . api ,
@ -306,7 +329,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
self . _view . sidepanel . appendChild ( sidePanel . render ( ) )
self . _view . sidepanel . appendChild ( sidePanel . render ( ) )
document . body . appendChild ( hiddenPanel . render ( ) ) // Hidden Panel is display none, it can be directly on body
document . body . appendChild ( hiddenPanel . render ( ) ) // Hidden Panel is display none, it can be directly on body
appManager . register ( [
engine . register ( [
menuicons ,
menuicons ,
landingPage ,
landingPage ,
sidePanel ,
sidePanel ,
@ -344,7 +367,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
new Renderer ( )
new Renderer ( )
)
)
appManager . register ( [
engine . register ( [
compileTab ,
compileTab ,
run ,
run ,
debug ,
debug ,
@ -354,17 +377,17 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
] )
] )
try {
try {
appManager . register ( await appManager . registeredPlugins ( ) )
engine . register ( await appManager . registeredPlugins ( ) )
} catch ( e ) {
} catch ( e ) {
console . log ( 'couldn\'t register iframe plugins' , e . message )
console . log ( 'couldn\'t register iframe plugins' , e . message )
}
}
await appManager . activate ( [ 'contentImport' , 'theme' , 'editor' , 'fileManager' , 'compilerMetadata' , 'compilerArtefacts' , 'network' , 'offsetToLineColumnConverter' ] )
await appManager . activatePlugin ( [ 'contentImport' , 'theme' , 'editor' , 'fileManager' , 'compilerMetadata' , 'compilerArtefacts' , 'network' , 'offsetToLineColumnConverter' ] )
await appManager . activate ( [ 'mainPanel' ] )
await appManager . activatePlugin ( [ 'mainPanel' , 'menuicons ' ] )
await appManager . activate ( [ 'menuicons' , 'home' , 'sidePanel' , 'pluginManager' , 'fileExplorers' , 'settings' ] )
await appManager . activatePlugin ( [ 'home' , 'sidePanel' , 'pluginManager' , 'fileExplorers' , 'settings' , 'contextualListener' , 'terminal ' ] )
// Set workspace after initial activation
// Set workspace after initial activation
if ( Array . isArray ( workspace ) ) await appManager . activate ( workspace )
if ( Array . isArray ( workspace ) ) await appManager . activatePlugin ( workspace )
// Load and start the service who manager layout and frame
// Load and start the service who manager layout and frame
const framingService = new FramingService ( sidePanel , menuicons , mainview , this . _components . resizeFeature )
const framingService = new FramingService ( sidePanel , menuicons , mainview , this . _components . resizeFeature )
@ -390,6 +413,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
}
if ( isElectron ( ) ) {
if ( isElectron ( ) ) {
appManager . activate ( [ 'remixd' ] )
appManager . activatePlugin ( 'remixd' )
}
}
}
}