Merge branch 'master' into oneclickplugin

pull/1/head
Patrick Gallagher 5 years ago committed by GitHub
commit 06281321cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      src/app.js
  2. 72
      src/app/components/local-plugin.js
  3. 5
      src/app/components/plugin-manager-component.js
  4. 14
      src/app/components/side-panel.js
  5. 8
      src/app/components/vertical-icons.js
  6. 3
      src/app/tabs/runTab/model/dropdownlogic.js
  7. 9
      src/app/tabs/runTab/settings.js
  8. 9
      src/app/tabs/settings-tab.js
  9. 1
      src/app/tabs/styles/compile-tab-styles.js
  10. 1
      src/app/tabs/styles/run-tab-styles.js
  11. 4
      src/app/udapp/run-tab.js
  12. 7
      src/app/ui/landing-page/landing-page.js
  13. 6
      src/framingService.js
  14. 102
      src/lib/panels-resize.js
  15. 20
      src/remixAppManager.js
  16. 4
      test-browser/commands/checkTerminalFilter.js
  17. 10
      test-browser/commands/testFunction.js

@ -62,38 +62,29 @@ var css = csjs`
overflow-x: auto; overflow-x: auto;
} }
.browsersolidity { .browsersolidity {
position : relative;
width : 100vw; width : 100vw;
height : 100vh; height : 100vh;
overflow : hidden; overflow : hidden;
flex-direction : row;
display : flex;
} }
.mainpanel { .mainpanel {
display : flex; display : flex;
flex-direction : column; flex-direction : column;
position : absolute;
top : 0;
bottom : 0;
overflow : hidden; overflow : hidden;
flex : 1;
} }
.iconpanel { .iconpanel {
display : flex; display : flex;
flex-direction : column; flex-direction : column;
position : absolute;
top : 0;
bottom : 0;
left : 0;
overflow : hidden; overflow : hidden;
width : 50px; width : 50px;
user-select : none; user-select : none;
/* border-right : 1px solid var(--primary); */
} }
.sidepanel { .sidepanel {
display : flex; display : flex;
flex-direction : column; flex-direction : row-reverse;
position : absolute; width : 320px;
top : 0;
left : 50px;
bottom : 0;
} }
.highlightcode { .highlightcode {
position:absolute; position:absolute;
@ -150,7 +141,6 @@ class App {
init () { init () {
var self = this var self = this
self._components.resizeFeature = new PanelsResize('#side-panel', '#editor-container', { 'minWidth': 300, x: 450 })
run.apply(self) run.apply(self)
} }
@ -166,22 +156,25 @@ class App {
// center panel, resizable // center panel, resizable
self._view.sidepanel = yo` self._view.sidepanel = yo`
<div id="side-panel" class=${css.sidepanel}> <div id="side-panel" style="min-width: 320px;" class=${css.sidepanel}>
${''} ${''}
</div> </div>
` `
// handle the editor + terminal // handle the editor + terminal
self._view.mainpanel = yo` self._view.mainpanel = yo`
<div id="editor-container" class=${css.mainpanel}> <div id="main-panel" class=${css.mainpanel}>
${''} ${''}
</div> </div>
` `
self._components.resizeFeature = new PanelsResize(self._view.sidepanel)
self._view.el = yo` self._view.el = yo`
<div class=${css.browsersolidity}> <div class=${css.browsersolidity}>
${self._view.iconpanel} ${self._view.iconpanel}
${self._view.sidepanel} ${self._view.sidepanel}
${self._components.resizeFeature.render()}
${self._view.mainpanel} ${self._view.mainpanel}
</div> </div>
` `

@ -2,8 +2,6 @@
const yo = require('yo-yo') const yo = require('yo-yo')
const modalDialog = require('../ui/modaldialog') const modalDialog = require('../ui/modaldialog')
const unexposedEvents = ['statusChanged']
module.exports = class LocalPlugin { module.exports = class LocalPlugin {
/** /**
@ -40,8 +38,6 @@ module.exports = class LocalPlugin {
...this.profile, ...this.profile,
hash: `local-${this.profile.name}` hash: `local-${this.profile.name}`
} }
profile.events = (profile.events || []).filter(item => item !== '')
if (!profile.location) throw new Error('Plugin should have a location') if (!profile.location) throw new Error('Plugin should have a location')
if (!profile.name) throw new Error('Plugin should have a name') if (!profile.name) throw new Error('Plugin should have a name')
if (!profile.url) throw new Error('Plugin should have an URL') if (!profile.url) throw new Error('Plugin should have an URL')
@ -49,23 +45,6 @@ module.exports = class LocalPlugin {
return profile return profile
} }
/**
* Add or remove a notification to/from the profile
* @param {Event} e The event when checkbox changes
* @param {string} pluginName The name of the plugin
* @param {string} eventName The name of the event to listen on
*/
toggleNotification (e, pluginName, eventName) {
const {checked} = e.target
if (checked) {
if (!this.profile.notifications[pluginName]) this.profile.notifications[pluginName] = []
this.profile.notifications[pluginName].push(eventName)
} else {
this.profile.notifications[pluginName].splice(this.profile.notifications[pluginName].indexOf(eventName), 1)
if (this.profile.notifications[pluginName].length === 0) delete this.profile.notifications[pluginName]
}
}
updateName ({target}) { updateName ({target}) {
this.profile.name = target.value this.profile.name = target.value
} }
@ -78,32 +57,10 @@ module.exports = class LocalPlugin {
this.profile.displayName = target.value this.profile.displayName = target.value
} }
updateEvents ({target}, index) {
if (this.profile.events[index] !== undefined) {
this.profile.events[index] = target.value
}
}
updateLoc ({target}) { updateLoc ({target}) {
this.profile.location = target.value this.profile.location = target.value
} }
/**
* The checkbox for a couple module / event
* @param {string} plugin The name of the plugin
* @param {string} event The name of the event exposed by the plugin
*/
notificationCheckbox (plugin, event) {
const notifications = this.profile.notifications || {}
const checkbox = notifications[plugin] && notifications[plugin].includes(event)
? yo`<input id="${plugin}${event}" type="checkbox" checked onchange="${e => this.toggleNotification(e, plugin, event)}">`
: yo`<input id="${plugin}${event}" type="checkbox" onchange="${e => this.toggleNotification(e, plugin, event)}">`
return yo`<div>
${checkbox}
<label for="${plugin}${event}">${plugin} - ${event}</label>
</div>`
}
/** /**
* The form to create a local plugin * The form to create a local plugin
* @param {ProfileApi[]} plugins Liste of profile of the plugins * @param {ProfileApi[]} plugins Liste of profile of the plugins
@ -112,15 +69,6 @@ module.exports = class LocalPlugin {
const name = this.profile.name || '' const name = this.profile.name || ''
const url = this.profile.url || '' const url = this.profile.url || ''
const displayName = this.profile.displayName || '' const displayName = this.profile.displayName || ''
const profiles = plugins
.filter(({profile}) => profile.events && profile.events.length > 0)
.map(({profile}) => profile)
const eventsForm = (events) => {
return yo`<div>${events.map((event, i) => {
return yo`<input class="form-control" onchange="${e => this.updateEvents(e, i)}" value="${event}" />`
})}</div>`
}
const radioLocations = (label, displayN) => { const radioLocations = (label, displayN) => {
const radioButton = (this.profile.location === label) const radioButton = (this.profile.location === label)
? yo`<div class="radio"> ? yo`<div class="radio">
@ -135,14 +83,6 @@ module.exports = class LocalPlugin {
${radioButton} ${radioButton}
</div>` </div>`
} }
const eventsEl = eventsForm(this.profile.events || [])
const pushEvent = () => {
if (!this.profile.events) this.profile.events = []
this.profile.events.push('')
yo.update(eventsEl, eventsForm(this.profile.events))
}
const addEvent = yo`<button type="button" class="btn btn-sm btn-light" onclick="${() => pushEvent()}">Add an event</button>`
return yo` return yo`
<form id="local-plugin-form"> <form id="local-plugin-form">
<div class="form-group"> <div class="form-group">
@ -157,18 +97,6 @@ module.exports = class LocalPlugin {
<label for="plugin-url">Url <small>(required)</small></label> <label for="plugin-url">Url <small>(required)</small></label>
<input class="form-control" onchange="${e => this.updateUrl(e)}" value="${url}" id="plugin-url" placeholder="ex: https://localhost:8000"> <input class="form-control" onchange="${e => this.updateUrl(e)}" value="${url}" id="plugin-url" placeholder="ex: https://localhost:8000">
</div> </div>
<div class="form-group">
<label>Events</label>
${eventsEl}${addEvent}
</div>
<div class="form-group">
<label>Notifications</label>
${profiles.map(({name, events}) => {
return events
.filter(event => !unexposedEvents.includes(event))
.map(event => this.notificationCheckbox(name, event))
})}
</div>
<div class="form-group"> <div class="form-group">
<h6>Location in remix <small>(required)</small></h6> <h6>Location in remix <small>(required)</small></h6>
${radioLocations('sidePanel', 'Side Panel')} ${radioLocations('sidePanel', 'Side Panel')}

@ -19,9 +19,6 @@ const css = csjs`
z-index: 2; z-index: 2;
margin-bottom: 0px; margin-bottom: 0px;
} }
.localPluginBtn {
margin-top: 15px;
}
.displayName { .displayName {
text-transform: capitalize; text-transform: capitalize;
display: flex; display: flex;
@ -186,7 +183,7 @@ class PluginManagerComponent extends ViewPlugin {
<div id='pluginManager'> <div id='pluginManager'>
<header class="form-group ${css.pluginSearch}"> <header class="form-group ${css.pluginSearch}">
<input onkeyup="${e => this.filterPlugins(e)}" class="form-control" placeholder="Search"> <input onkeyup="${e => this.filterPlugins(e)}" class="form-control" placeholder="Search">
<button onclick="${_ => this.openLocalPlugin()}" class="btn btn-sm text-info ${css.localPluginBtn}"> <button onclick="${_ => this.openLocalPlugin()}" class="btn btn-sm text-dark border-0 font-weight-bold mt-2">
Connect to a Local Plugin Connect to a Local Plugin
</button> </button>
</header> </header>

@ -5,9 +5,11 @@ const yo = require('yo-yo')
const css = csjs` const css = csjs`
.panel { .panel {
width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: auto;
} }
.swapitTitle { .swapitTitle {
margin: 0; margin: 0;
@ -22,7 +24,6 @@ const css = csjs`
} }
.swapitHeader { .swapitHeader {
height: 35px; height: 35px;
padding: 15px 20px;
display: flex; display: flex;
align-items: center; align-items: center;
} }
@ -32,7 +33,6 @@ const css = csjs`
} }
.pluginsContainer { .pluginsContainer {
height: 100%; height: 100%;
flex: 1;
overflow-y: auto; overflow-y: auto;
} }
.titleInfo { .titleInfo {
@ -131,10 +131,10 @@ export class SidePanel extends AbstractPanel {
} }
return yo` return yo`
<header class="${css.swapitHeader}"> <header class="${css.swapitHeader} px-3">
<h6 class="${css.swapitTitle}">${name}</h6> <h6 class="${css.swapitTitle}">${name}</h6>
${docLink} ${docLink}
${versionWarning} ${versionWarning}
</header> </header>
` `
} }
@ -143,7 +143,7 @@ export class SidePanel extends AbstractPanel {
return yo` return yo`
<section class="${css.panel}"> <section class="${css.panel}">
${this.header} ${this.header}
<div class="${css.pluginsContainer}"> <div class="${css.pluginsContainer} py-1">
${this.view} ${this.view}
</div> </div>
</section>` </section>`

@ -160,9 +160,9 @@ export class VerticalIcons extends Plugin {
}) })
// remove active // remove active
const currentActive = this.view.querySelector(`.${css.active}`) const currentActive = this.view.querySelector(`.active`)
if (currentActive) { if (currentActive) {
currentActive.classList.remove(css.active) currentActive.classList.remove(`active`)
} }
} }
@ -176,7 +176,7 @@ export class VerticalIcons extends Plugin {
const nextActive = this.view.querySelector(`[plugin="${name}"]`) const nextActive = this.view.querySelector(`[plugin="${name}"]`)
if (nextActive) { if (nextActive) {
let image = nextActive.querySelector('.image') let image = nextActive.querySelector('.image')
nextActive.classList.add(css.active) nextActive.classList.add(`active`)
image.style.setProperty('filter', `invert(${invert}) grayscale(1) brightness(0%)`) image.style.setProperty('filter', `invert(${invert}) grayscale(1) brightness(0%)`)
} }
} }
@ -210,7 +210,7 @@ export class VerticalIcons extends Plugin {
onThemeChanged (themeType) { onThemeChanged (themeType) {
const invert = themeType === 'dark' ? 1 : 0 const invert = themeType === 'dark' ? 1 : 0
const active = this.view.querySelector(`.${css.active}`) const active = this.view.querySelector(`.active`)
if (active) { if (active) {
let image = active.querySelector('.image') let image = active.querySelector('.image')
image.style.setProperty('filter', `invert(${invert})`) image.style.setProperty('filter', `invert(${invert})`)

@ -54,8 +54,9 @@ class DropdownLogic {
} }
cb(null, 'abi', abi) cb(null, 'abi', abi)
}) })
} else {
cb(null, 'instance')
} }
cb(null, 'instance')
} }
getCompiledContracts (compiler, compilerFullName) { getCompiledContracts (compiler, compilerFullName) {

@ -178,18 +178,17 @@ class SettingsUI {
selectExEnv.addEventListener('change', (event) => { selectExEnv.addEventListener('change', (event) => {
let context = selectExEnv.options[selectExEnv.selectedIndex].value let context = selectExEnv.options[selectExEnv.selectedIndex].value
this.settings.changeExecutionContext(context, () => { this.settings.changeExecutionContext(context, () => {
modalDialogCustom.confirm('External node request', 'Are you sure you want to connect to an ethereum node?', () => { const modal = modalDialogCustom.confirm('External node request', 'Are you sure you want to connect to an ethereum node?', () => {
modal.hide()
modalDialogCustom.prompt('External node request', 'Web3 Provider Endpoint', 'http://localhost:8545', (target) => { modalDialogCustom.prompt('External node request', 'Web3 Provider Endpoint', 'http://localhost:8545', (target) => {
this.settings.setProviderFromEndpoint(target, context, (alertMsg) => { this.settings.setProviderFromEndpoint(target, context, (alertMsg) => {
if (alertMsg) { if (alertMsg) addTooltip(alertMsg)
modalDialogCustom.alert(alertMsg)
}
this.setFinalContext() this.setFinalContext()
}) })
}, this.setFinalContext.bind(this)) }, this.setFinalContext.bind(this))
}, this.setFinalContext.bind(this)) }, this.setFinalContext.bind(this))
}, (alertMsg) => { }, (alertMsg) => {
modalDialogCustom.alert(alertMsg) addTooltip(alertMsg)
}, this.setFinalContext.bind(this)) }, this.setFinalContext.bind(this))
}) })

@ -10,14 +10,15 @@ import * as packageJson from '../../../package.json'
const profile = { const profile = {
name: 'settings', name: 'settings',
displayName: 'Settings', displayName: 'Settings',
methods: [], methods: ['getGithubAccessToken'],
events: [], events: [],
icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMTUyIDg5NnEwLTEwNi03NS0xODF0LTE4MS03NS0xODEgNzUtNzUgMTgxIDc1IDE4MSAxODEgNzUgMTgxLTc1IDc1LTE4MXptNTEyLTEwOXYyMjJxMCAxMi04IDIzdC0yMCAxM2wtMTg1IDI4cS0xOSA1NC0zOSA5MSAzNSA1MCAxMDcgMTM4IDEwIDEyIDEwIDI1dC05IDIzcS0yNyAzNy05OSAxMDh0LTk0IDcxcS0xMiAwLTI2LTlsLTEzOC0xMDhxLTQ0IDIzLTkxIDM4LTE2IDEzNi0yOSAxODYtNyAyOC0zNiAyOGgtMjIycS0xNCAwLTI0LjUtOC41dC0xMS41LTIxLjVsLTI4LTE4NHEtNDktMTYtOTAtMzdsLTE0MSAxMDdxLTEwIDktMjUgOS0xNCAwLTI1LTExLTEyNi0xMTQtMTY1LTE2OC03LTEwLTctMjMgMC0xMiA4LTIzIDE1LTIxIDUxLTY2LjV0NTQtNzAuNXEtMjctNTAtNDEtOTlsLTE4My0yN3EtMTMtMi0yMS0xMi41dC04LTIzLjV2LTIyMnEwLTEyIDgtMjN0MTktMTNsMTg2LTI4cTE0LTQ2IDM5LTkyLTQwLTU3LTEwNy0xMzgtMTAtMTItMTAtMjQgMC0xMCA5LTIzIDI2LTM2IDk4LjUtMTA3LjV0OTQuNS03MS41cTEzIDAgMjYgMTBsMTM4IDEwN3E0NC0yMyA5MS0zOCAxNi0xMzYgMjktMTg2IDctMjggMzYtMjhoMjIycTE0IDAgMjQuNSA4LjV0MTEuNSAyMS41bDI4IDE4NHE0OSAxNiA5MCAzN2wxNDItMTA3cTktOSAyNC05IDEzIDAgMjUgMTAgMTI5IDExOSAxNjUgMTcwIDcgOCA3IDIyIDAgMTItOCAyMy0xNSAyMS01MSA2Ni41dC01NCA3MC41cTI2IDUwIDQxIDk4bDE4MyAyOHExMyAyIDIxIDEyLjV0OCAyMy41eiIvPjwvc3ZnPg==', icon: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB2aWV3Qm94PSIwIDAgMTc5MiAxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMTUyIDg5NnEwLTEwNi03NS0xODF0LTE4MS03NS0xODEgNzUtNzUgMTgxIDc1IDE4MSAxODEgNzUgMTgxLTc1IDc1LTE4MXptNTEyLTEwOXYyMjJxMCAxMi04IDIzdC0yMCAxM2wtMTg1IDI4cS0xOSA1NC0zOSA5MSAzNSA1MCAxMDcgMTM4IDEwIDEyIDEwIDI1dC05IDIzcS0yNyAzNy05OSAxMDh0LTk0IDcxcS0xMiAwLTI2LTlsLTEzOC0xMDhxLTQ0IDIzLTkxIDM4LTE2IDEzNi0yOSAxODYtNyAyOC0zNiAyOGgtMjIycS0xNCAwLTI0LjUtOC41dC0xMS41LTIxLjVsLTI4LTE4NHEtNDktMTYtOTAtMzdsLTE0MSAxMDdxLTEwIDktMjUgOS0xNCAwLTI1LTExLTEyNi0xMTQtMTY1LTE2OC03LTEwLTctMjMgMC0xMiA4LTIzIDE1LTIxIDUxLTY2LjV0NTQtNzAuNXEtMjctNTAtNDEtOTlsLTE4My0yN3EtMTMtMi0yMS0xMi41dC04LTIzLjV2LTIyMnEwLTEyIDgtMjN0MTktMTNsMTg2LTI4cTE0LTQ2IDM5LTkyLTQwLTU3LTEwNy0xMzgtMTAtMTItMTAtMjQgMC0xMCA5LTIzIDI2LTM2IDk4LjUtMTA3LjV0OTQuNS03MS41cTEzIDAgMjYgMTBsMTM4IDEwN3E0NC0yMyA5MS0zOCAxNi0xMzYgMjktMTg2IDctMjggMzYtMjhoMjIycTE0IDAgMjQuNSA4LjV0MTEuNSAyMS41bDI4IDE4NHE0OSAxNiA5MCAzN2wxNDItMTA3cTktOSAyNC05IDEzIDAgMjUgMTAgMTI5IDExOSAxNjUgMTcwIDcgOCA3IDIyIDAgMTItOCAyMy0xNSAyMS01MSA2Ni41dC01NCA3MC41cTI2IDUwIDQxIDk4bDE4MyAyOHExMyAyIDIxIDEyLjV0OCAyMy41eiIvPjwvc3ZnPg==',
description: 'Remix-IDE settings', description: 'Remix-IDE settings',
kind: 'settings', kind: 'settings',
location: 'sidePanel', location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/settings.html', documentation: 'https://remix-ide.readthedocs.io/en/latest/settings.html',
version: packageJson.version version: packageJson.version,
permission: true
} }
module.exports = class SettingsTab extends ViewPlugin { module.exports = class SettingsTab extends ViewPlugin {
@ -162,4 +163,8 @@ module.exports = class SettingsTab extends ViewPlugin {
this._deps.themeModule.switchTheme() this._deps.themeModule.switchTheme()
return this._view.el return this._view.el
} }
getGithubAccessToken () {
return this.config.get('settings/gist-access-token')
}
} }

@ -147,6 +147,7 @@ const css = csjs`
.errorBlobs { .errorBlobs {
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
word-break: break-all;
} }
.spinningIcon { .spinningIcon {

@ -2,7 +2,6 @@ var csjs = require('csjs-inject')
var css = csjs` var css = csjs`
.runTabView { .runTabView {
padding: 2%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }

@ -74,7 +74,7 @@ export class RunTab extends LibraryPlugin {
} }
renderContainer () { renderContainer () {
this.container = yo`<div class="${css.runTabView} p-3" id="runTabView" ></div>` this.container = yo`<div class="${css.runTabView} py-0 pr-2" id="runTabView" ></div>`
var el = yo` var el = yo`
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
@ -133,7 +133,7 @@ export class RunTab extends LibraryPlugin {
if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) } if (noInstancesText.parentNode) { noInstancesText.parentNode.removeChild(noInstancesText) }
}) })
this.contractDropdownUI.event.register('newContractABIAdded', (abi, address) => { this.contractDropdownUI.event.register('newContractABIAdded', (abi, address) => {
this.instanceContainer.appendChild(udappUI.renderInstanceFromABI(abi, address, address)) this.instanceContainer.appendChild(udappUI.renderInstanceFromABI(abi, address, '<at address>'))
}) })
this.contractDropdownUI.event.register('newContractInstanceAdded', (contractObject, address, value) => { this.contractDropdownUI.event.register('newContractInstanceAdded', (contractObject, address, value) => {
this.instanceContainer.appendChild(udappUI.renderInstance(contractObject, address, value)) this.instanceContainer.appendChild(udappUI.renderInstance(contractObject, address, value))

@ -136,10 +136,11 @@ export class LandingPage extends ViewPlugin {
this.verticalIcons.select('vyper') this.verticalIcons.select('vyper')
} }
const startWorkshop = () => { const startWorkshop = () => {
this.appManager.ensureActivated('box')
this.appManager.ensureActivated('solidity') this.appManager.ensureActivated('solidity')
this.appManager.ensureActivated('solidityUnitTesting') this.appManager.ensureActivated('solidityUnitTesting')
this.appManager.ensureActivated('workshop') this.appManager.ensureActivated('workshops')
this.verticalIcons.select('workshop') this.verticalIcons.select('workshops')
} }
const startPipeline = () => { const startPipeline = () => {
@ -200,7 +201,7 @@ export class LandingPage extends ViewPlugin {
<div class="${css.enviroments} pt-2"> <div class="${css.enviroments} pt-2">
<button class="btn btn-lg btn-secondary mr-3" onclick=${() => startSolidity()}>Solidity</button> <button class="btn btn-lg btn-secondary mr-3" onclick=${() => startSolidity()}>Solidity</button>
<button class="btn btn-lg btn-secondary mr-3" onclick=${() => startVyper()}>Vyper</button> <button class="btn btn-lg btn-secondary mr-3" onclick=${() => startVyper()}>Vyper</button>
<button class="btn btn-lg btn-secondary mr-3" onclick=${() => startWorkshop()}>Workshop</button> <button class="btn btn-lg btn-secondary mr-3" onclick=${() => startWorkshop()}>Workshops</button>
</div> </div>
</div> </div>
<div class="file"> <div class="file">

@ -10,13 +10,13 @@ export class FramingService {
start () { start () {
this.sidePanel.events.on('toggle', () => { this.sidePanel.events.on('toggle', () => {
this.resizeFeature.panel1.clientWidth !== 0 ? this.resizeFeature.minimize() : this.resizeFeature.maximise() this.resizeFeature.panel.clientWidth !== 0 ? this.resizeFeature.hidePanel() : this.resizeFeature.showPanel()
}) })
this.sidePanel.events.on('showing', () => { this.sidePanel.events.on('showing', () => {
this.resizeFeature.panel1.clientWidth === 0 ? this.resizeFeature.maximise() : '' this.resizeFeature.panel.clientWidth === 0 ? this.resizeFeature.showPanel() : ''
}) })
this.mainPanel.events.on('toggle', () => { this.mainPanel.events.on('toggle', () => {
this.resizeFeature.maximise() this.resizeFeature.showPanel()
}) })
this.verticalIcon.select('fileExplorers') this.verticalIcon.select('fileExplorers')

@ -3,14 +3,10 @@ const csjs = require('csjs-inject')
const css = csjs` const css = csjs`
.dragbar { .dragbar {
position : absolute; width : 1px;
top : 0px; height : 100%;
width : 0.5em;
right : 0;
bottom : 0;
cursor : col-resize; cursor : col-resize;
z-index : 999; z-index : 999;
/* border-right : 2px solid var(--primary); */
} }
.ghostbar { .ghostbar {
width : 3px; width : 3px;
@ -24,98 +20,70 @@ const css = csjs`
} }
` `
/*
* opt:
* minWidth : minimn width for panels
* x : position of gutter at load
*
*
*/
export default class PanelsResize { export default class PanelsResize {
constructor (idpanel1, idpanel2, opt) { constructor (panel) {
var panel1 = document.querySelector(idpanel1) this.panel = panel
var panel2 = document.querySelector(idpanel2) const string = panel.style.minWidth
this.panel1 = panel1 this.minWidth = string.length > 2 ? parseInt(string.substring(0, string.length - 2)) : 0
this.panel2 = panel2 }
this.opt = opt
var ghostbar = yo`<div class=${css.ghostbar}></div>` render () {
this.ghostbar = yo`<div class=${css.ghostbar}></div>`
let mousedown = (event) => { const mousedown = (event) => {
event.preventDefault() event.preventDefault()
if (event.which === 1) { if (event.which === 1) {
moveGhostbar(event) moveGhostbar(event)
document.body.appendChild(ghostbar) document.body.appendChild(this.ghostbar)
document.addEventListener('mousemove', moveGhostbar) document.addEventListener('mousemove', moveGhostbar)
document.addEventListener('mouseup', removeGhostbar) document.addEventListener('mouseup', removeGhostbar)
document.addEventListener('keydown', cancelGhostbar) document.addEventListener('keydown', cancelGhostbar)
} }
} }
let cancelGhostbar = (event) => { const cancelGhostbar = (event) => {
if (event.keyCode === 27) { if (event.keyCode === 27) {
document.body.removeChild(ghostbar) document.body.removeChild(this.ghostbar)
document.removeEventListener('mousemove', moveGhostbar) document.removeEventListener('mousemove', moveGhostbar)
document.removeEventListener('mouseup', removeGhostbar) document.removeEventListener('mouseup', removeGhostbar)
document.removeEventListener('keydown', cancelGhostbar) document.removeEventListener('keydown', cancelGhostbar)
} }
} }
let moveGhostbar = (event) => { // @NOTE VERTICAL ghostbar const moveGhostbar = (event) => {
let p = processPositions(event) this.ghostbar.style.left = event.x + 'px'
if (p.panel1Width <= opt.minWidth || p.panel2Width <= opt.minWidth) return
ghostbar.style.left = event.x + 'px'
}
let setPosition = (event) => {
let p = processPositions(event)
panel1.style.width = p.panel1Width + 'px'
panel2.style.left = p.panel2left + 'px'
panel2.style.width = p.panel2Width + 'px'
} }
let removeGhostbar = (event) => { const removeGhostbar = (event) => {
document.body.removeChild(ghostbar) document.body.removeChild(this.ghostbar)
document.removeEventListener('mousemove', moveGhostbar) document.removeEventListener('mousemove', moveGhostbar)
document.removeEventListener('mouseup', removeGhostbar) document.removeEventListener('mouseup', removeGhostbar)
document.removeEventListener('keydown', cancelGhostbar) document.removeEventListener('keydown', cancelGhostbar)
setPosition(event) this.setPosition(event)
} }
let processPositions = (event) => { return yo`<div onmousedown=${mousedown} class=${css.dragbar}></div>`
let panel1Width = event.x - panel1.offsetLeft }
panel1Width = panel1Width < opt.minWidth ? opt.minWidth : panel1Width
let panel2left = panel1.offsetLeft + panel1Width
let panel2Width = panel2.parentElement.clientWidth - panel1.offsetLeft - panel1Width
panel2Width = panel2Width < opt.minWidth ? opt.minWidth : panel2Width
return { panel1Width, panel2left, panel2Width }
}
window.addEventListener('resize', function (event) {
setPosition({ x: panel1.offsetLeft + panel1.clientWidth })
})
var dragbar = yo`<div onmousedown=${mousedown} class=${css.dragbar}></div>` calculatePanelWidth (event) {
panel1.appendChild(dragbar) return event.x - this.panel.offsetLeft
}
setPosition(opt) setPosition (event) {
const panelWidth = this.calculatePanelWidth(event)
// close the panel if the width is less than a minWidth
if (panelWidth > this.minWidth - 10 || this.panel.style.display === 'none') {
this.panel.style.width = panelWidth + 'px'
this.showPanel()
} else this.hidePanel()
} }
minimize () { hidePanel () {
let panel1Width = 0 this.panel.style.display = 'none'
let panel2left = this.panel1.offsetLeft + panel1Width
let panel2Width = this.panel2.parentElement.clientWidth - this.panel1.offsetLeft - panel1Width
this.panel1.style.width = panel1Width + 'px'
this.panel2.style.left = panel2left + 'px'
this.panel2.style.width = panel2Width + 'px'
} }
maximise () { showPanel () {
let panel1Width = this.opt.minWidth this.panel.style.display = 'flex'
let panel2left = this.panel1.offsetLeft + panel1Width
let panel2Width = this.panel2.parentElement.clientWidth - this.panel1.offsetLeft - panel1Width
this.panel1.style.width = panel1Width + 'px'
this.panel2.style.left = panel2left + 'px'
this.panel2.style.width = panel2Width + 'px'
} }
} }

@ -136,7 +136,7 @@ export class RemixAppManager extends PluginEngine {
'solidity': ['compilationFinished'] 'solidity': ['compilationFinished']
}, },
version: '0.1.0-beta', version: '0.1.0-beta',
url: 'https://remix-mythx-plugin.surge.sh', url: 'https://remythx.xyz',
description: 'Perform Static and Dynamic Security Analysis using the MythX Cloud Service', description: 'Perform Static and Dynamic Security Analysis using the MythX Cloud Service',
icon: 'https://remix-mythx-plugin.surge.sh/logo.png', icon: 'https://remix-mythx-plugin.surge.sh/logo.png',
location: 'sidePanel', location: 'sidePanel',
@ -158,7 +158,7 @@ export class RemixAppManager extends PluginEngine {
location: 'sidePanel' location: 'sidePanel'
} }
const threeBox = { const threeBox = {
name: '3box', name: 'box',
displayName: '3Box Spaces', displayName: '3Box Spaces',
description: 'A decentralized storage for everything that happen on Remix', description: 'A decentralized storage for everything that happen on Remix',
methods: ['login', 'isEnabled', 'getUserAddress', 'openSpace', 'closeSpace', 'isSpaceOpened', 'getSpacePrivateValue', 'setSpacePrivateValue', 'getSpacePublicValue', 'setSpacePublicValue', 'getSpacePublicData'], methods: ['login', 'isEnabled', 'getUserAddress', 'openSpace', 'closeSpace', 'isSpaceOpened', 'getSpacePrivateValue', 'setSpacePrivateValue', 'getSpacePublicValue', 'setSpacePublicValue', 'getSpacePublicData'],
@ -169,9 +169,9 @@ export class RemixAppManager extends PluginEngine {
location: 'sidePanel' location: 'sidePanel'
} }
const remixWorkshop = { const remixWorkshop = {
name: 'workshop', name: 'workshops',
displayName: 'Remix Workshop', displayName: 'Remix Workshops',
description: 'Learn Solidity with Remix !', description: 'Learn Ethereum with Remix !',
methods: [], methods: [],
events: [], events: [],
version: '0.1.0-alpha', version: '0.1.0-alpha',
@ -212,6 +212,15 @@ export class RemixAppManager extends PluginEngine {
description: 'A free tool to generate smart contract interfaces.', description: 'A free tool to generate smart contract interfaces.',
documentation: 'https://github.com/pi0neerpat/remix-plugin-one-click-dapp', documentation: 'https://github.com/pi0neerpat/remix-plugin-one-click-dapp',
icon: 'https://remix-one-click-dapp.surge.sh/icon.png', icon: 'https://remix-one-click-dapp.surge.sh/icon.png',
const gasProfiler = {
name: 'gasProfiler',
displayName: 'Gas Profiler',
events: [],
methods: [],
version: '0.1.0-alpha',
url: 'https://remix-gas-profiler.surge.sh',
description: 'Profile gas costs',
icon: 'https://res.cloudinary.com/key-solutions/image/upload/v1565781702/gas-profiler_nxmsal.png',
location: 'sidePanel' location: 'sidePanel'
} }
return [ return [
@ -226,6 +235,7 @@ export class RemixAppManager extends PluginEngine {
new IframePlugin(debugPlugin), new IframePlugin(debugPlugin),
new IframePlugin(libraTools), new IframePlugin(libraTools),
new IframePlugin(oneClickDapp) new IframePlugin(oneClickDapp)
new IframePlugin(gasProfiler)
] ]
} }
} }

@ -17,10 +17,10 @@ function checkFilter (browser, filter, test, done) {
done() done()
return return
} }
var filterClass = '#editor-container div[class^="search"] input[class^="filter"]' const filterClass = '#main-panel div[class^="search"] input[class^="filter"]'
browser.setValue(filterClass, filter, function () { browser.setValue(filterClass, filter, function () {
browser.execute(function () { browser.execute(function () {
return document.querySelector('#editor-container div[class^="journal"]').innerHTML === test return document.querySelector('#main-panel div[class^="journal"]').innerHTML === test
}, [], function (result) { }, [], function (result) {
browser.clearValue(filterClass).setValue(filterClass, '', function () { browser.clearValue(filterClass).setValue(filterClass, '', function () {
if (!result.value) { if (!result.value) {

@ -16,12 +16,12 @@ class TestFunction extends EventEmitter {
}) })
.click('.instance button[title="' + fnFullName + '"]') .click('.instance button[title="' + fnFullName + '"]')
.pause(500) .pause(500)
.waitForElementPresent('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"]') .waitForElementPresent('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"]')
.assert.containsText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] span', log) .assert.containsText('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] span', log)
.click('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] div[class^="log"]') .click('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] div[class^="log"]')
.perform(function (client, done) { .perform(function (client, done) {
if (expectedReturn) { if (expectedReturn) {
client.getText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', (result) => { client.getText('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', (result) => {
console.log(result) console.log(result)
var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedReturn)) var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedReturn))
if (!equal) { if (!equal) {
@ -33,7 +33,7 @@ class TestFunction extends EventEmitter {
}) })
.perform((client, done) => { .perform((client, done) => {
if (expectedEvent) { if (expectedEvent) {
client.getText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', (result) => { client.getText('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', (result) => {
console.log(result) console.log(result)
var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedEvent)) var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedEvent))
if (!equal) { if (!equal) {

Loading…
Cancel
Save