From 3ac62b7207241bc1cec532806223806f0c8761c4 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 15 Feb 2022 18:15:47 +0100 Subject: [PATCH] plugin rename --- .../src/app/components/hidden-panel.tsx | 5 ++-- .../components/plugin-manager-component.js | 5 ++-- .../src/app/components/side-panel.tsx | 5 ++-- .../src/app/components/vertical-icons.tsx | 5 ++-- apps/remix-ide/src/app/editor/editor.js | 5 ++-- apps/remix-ide/src/app/panels/file-panel.js | 1 - apps/remix-ide/src/app/panels/tab-proxy.js | 5 ++-- apps/remix-ide/src/app/panels/terminal.js | 6 ++--- .../src/app/plugins/viewReactPlugin.ts | 27 ------------------- apps/remix-ide/src/app/tabs/analysis-tab.js | 4 +-- apps/remix-ide/src/app/tabs/compile-tab.js | 1 - apps/remix-ide/src/app/tabs/debugger-tab.js | 1 - apps/remix-ide/src/app/tabs/settings-tab.tsx | 10 +++---- apps/remix-ide/src/app/tabs/test-tab.js | 5 ++-- apps/remix-ide/src/app/udapp/run-tab.js | 1 - .../src/app/ui/landing-page/landing-page.js | 6 ++--- libs/remix-ui/helper/src/index.ts | 1 + .../src/lib/components/PluginViewWrapper.tsx | 11 +++----- package.json | 14 +++++----- 19 files changed, 36 insertions(+), 82 deletions(-) delete mode 100644 apps/remix-ide/src/app/plugins/viewReactPlugin.ts rename apps/remix-ide/src/app/components/ViewPluginUI.tsx => libs/remix-ui/helper/src/lib/components/PluginViewWrapper.tsx (66%) diff --git a/apps/remix-ide/src/app/components/hidden-panel.tsx b/apps/remix-ide/src/app/components/hidden-panel.tsx index 1ce2f0b531..31c7a0cb0b 100644 --- a/apps/remix-ide/src/app/components/hidden-panel.tsx +++ b/apps/remix-ide/src/app/components/hidden-panel.tsx @@ -1,10 +1,9 @@ // eslint-disable-next-line no-use-before-define import React from 'react' -import ReactDOM from 'react-dom' // eslint-disable-line import { AbstractPanel } from './panel' import * as packageJson from '../../../../../package.json' import { RemixPluginPanel } from '@remix-ui/panel' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' const profile = { name: 'hiddenPanel', @@ -39,7 +38,7 @@ export class HiddenPanel extends AbstractPanel { render() { return ( -
+
); } diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index b67e6ecf0e..00013ee545 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -1,9 +1,8 @@ import { ViewPlugin } from '@remixproject/engine-web' import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import {RemixUiPluginManager} from '@remix-ui/plugin-manager' // eslint-disable-line import * as packageJson from '../../../../../package.json' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' const _paq = window._paq = window._paq || [] const profile = { @@ -98,7 +97,7 @@ class PluginManagerComponent extends ViewPlugin { render () { return ( -
+
); } diff --git a/apps/remix-ide/src/app/components/side-panel.tsx b/apps/remix-ide/src/app/components/side-panel.tsx index 9c116205c9..bf82defe55 100644 --- a/apps/remix-ide/src/app/components/side-panel.tsx +++ b/apps/remix-ide/src/app/components/side-panel.tsx @@ -1,11 +1,10 @@ // eslint-disable-next-line no-use-before-define import React from 'react' -import ReactDOM from 'react-dom' import { AbstractPanel } from './panel' import { RemixPluginPanel } from '@remix-ui/panel' import packageJson from '../../../../../package.json' import RemixUIPanelHeader from 'libs/remix-ui/panel/src/lib/plugins/panel-header' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' // const csjs = require('csjs-inject') const sidePanel = { @@ -86,7 +85,7 @@ export class SidePanel extends AbstractPanel { render() { return ( -
+
); } diff --git a/apps/remix-ide/src/app/components/vertical-icons.tsx b/apps/remix-ide/src/app/components/vertical-icons.tsx index 970b51c36d..bc70fd812c 100644 --- a/apps/remix-ide/src/app/components/vertical-icons.tsx +++ b/apps/remix-ide/src/app/components/vertical-icons.tsx @@ -1,12 +1,11 @@ // eslint-disable-next-line no-use-before-define import React from 'react' -import ReactDOM from 'react-dom' import packageJson from '../../../../../package.json' import { Plugin } from '@remixproject/engine' import { EventEmitter } from 'events' import { IconRecord, RemixUiVerticalIconsPanel } from '@remix-ui/vertical-icons-panel' import { Profile } from '@remixproject/plugin-utils' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' const profile = { name: 'menuicons', @@ -121,7 +120,7 @@ export class VerticalIcons extends Plugin { render() { return ( -
+
); } } diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index da700bfd10..0e745a1cd8 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -1,10 +1,9 @@ 'use strict' import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { EditorUI } from '@remix-ui/editor' // eslint-disable-line import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' const EventManager = require('../../lib/events') @@ -111,7 +110,7 @@ class Editor extends Plugin { this.ref.gotoLine = (line, column) => this.gotoLine(line, column || 0) this.ref.getCursorPosition = () => this.getCursorPosition() }} id='editorView'> - + } diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 75d8f0e7e3..6c5e4d0235 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -2,7 +2,6 @@ import { ViewPlugin } from '@remixproject/engine-web' import * as packageJson from '../../../../../package.json' import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { FileSystemProvider } from '@remix-ui/workspace' // eslint-disable-line import Registry from '../state/registry' import { RemixdHandle } from '../plugins/remixd-handle' diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index cf3c737c59..aa33f4a5ca 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -1,8 +1,7 @@ import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { Plugin } from '@remixproject/engine' import { TabsUI } from '@remix-ui/tabs' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' const EventEmitter = require('events') const helper = require('../../lib/helper') @@ -329,6 +328,6 @@ export class TabProxy extends Plugin { } renderTabsbar () { - return
+ return
} } diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js index f81decf27b..d99de73d83 100644 --- a/apps/remix-ide/src/app/panels/terminal.js +++ b/apps/remix-ide/src/app/panels/terminal.js @@ -1,15 +1,15 @@ /* global Node, requestAnimationFrame */ // eslint-disable-line import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { RemixUiTerminal } from '@remix-ui/terminal' // eslint-disable-line import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' import Registry from '../state/registry' +import { PluginViewWrapper } from '@remix-ui/helper' const vm = require('vm') const EventManager = require('../../lib/events') import { CompilerImports } from '@remix-project/core-plugin' // eslint-disable-line -import { ViewPluginUI } from '../components/ViewPluginUI' + const KONSOLES = [] @@ -109,7 +109,7 @@ class Terminal extends Plugin { } render () { - return
+ return
} updateComponent(state) { diff --git a/apps/remix-ide/src/app/plugins/viewReactPlugin.ts b/apps/remix-ide/src/app/plugins/viewReactPlugin.ts deleted file mode 100644 index da2f108de9..0000000000 --- a/apps/remix-ide/src/app/plugins/viewReactPlugin.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { Profile, LocationProfile } from '@remixproject/plugin-utils' -import { Plugin } from '@remixproject/engine' - - -export function isView

(profile: Profile): profile is (ViewProfile & P) { - return !!profile['location'] -} - -export type ViewProfile = Profile & LocationProfile - -export abstract class ViewReactPlugin extends Plugin { - abstract render(): any - - constructor(public profile: ViewProfile) { - super(profile) - } - - async activate() { - await this.call(this.profile.location, 'addView', this.profile, this.render()) - super.activate() - } - - deactivate() { - this.call(this.profile.location, 'removeView', this.profile) - super.deactivate() - } -} \ No newline at end of file diff --git a/apps/remix-ide/src/app/tabs/analysis-tab.js b/apps/remix-ide/src/app/tabs/analysis-tab.js index 2378d68faa..f17b0da52b 100644 --- a/apps/remix-ide/src/app/tabs/analysis-tab.js +++ b/apps/remix-ide/src/app/tabs/analysis-tab.js @@ -4,7 +4,7 @@ import { EventEmitter } from 'events' import {RemixUiStaticAnalyser} from '@remix-ui/static-analyser' // eslint-disable-line import * as packageJson from '../../../../../package.json' import Registry from '../state/registry' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' var EventManager = require('../../lib/events') @@ -61,7 +61,7 @@ class AnalysisTab extends ViewPlugin { } render () { - return

+ return
} updateComponent(state) { diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index a27abb5e64..87378d3ef6 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -1,6 +1,5 @@ /* global */ import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { SolidityCompiler } from '@remix-ui/solidity-compiler' // eslint-disable-line import { CompileTabLogic } from '@remix-ui/solidity-compiler' // eslint-disable-line import { CompilerApiMixin } from '@remixproject/solidity-compiler-plugin' // eslint-disable-line diff --git a/apps/remix-ide/src/app/tabs/debugger-tab.js b/apps/remix-ide/src/app/tabs/debugger-tab.js index bd19b88137..63debf4553 100644 --- a/apps/remix-ide/src/app/tabs/debugger-tab.js +++ b/apps/remix-ide/src/app/tabs/debugger-tab.js @@ -3,7 +3,6 @@ import { DebuggerApiMixin } from '@remixproject/debugger-plugin' // eslint-disab import { ViewPlugin } from '@remixproject/engine-web' import * as packageJson from '../../../../../package.json' import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import * as remixBleach from '../../lib/remixBleach' import { compilationFinishedToastMsg, compilingToastMsg, localCompilationToastMsg, notFoundToastMsg, sourceVerificationNotAvailableToastMsg } from '@remix-ui/helper' const css = require('./styles/debugger-tab-styles') diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index ac174c013f..25ea5fb934 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -1,11 +1,9 @@ -import React, { useEffect, useState } from 'react' // eslint-disable-line +import React from 'react' // eslint-disable-line import { ViewPlugin } from '@remixproject/engine-web' -import ReactDOM from 'react-dom' import * as packageJson from '../../../../../package.json' import { RemixUiSettings } from '@remix-ui/settings' //eslint-disable-line import Registry from '../state/registry' -import { ViewReactPlugin } from '../plugins/viewReactPlugin' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' const profile = { name: 'settings', @@ -21,7 +19,7 @@ const profile = { permission: true } -module.exports = class SettingsTab extends ViewReactPlugin { +module.exports = class SettingsTab extends ViewPlugin { config: any = {} editor: any private _deps: { @@ -51,7 +49,7 @@ module.exports = class SettingsTab extends ViewReactPlugin { render() { return (
- +
); } diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 0ab38fb89c..c2af5ce7a7 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -1,13 +1,12 @@ /* global */ import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { SolidityUnitTesting } from '@remix-ui/solidity-unit-testing' // eslint-disable-line import { TestTabLogic } from '@remix-ui/solidity-unit-testing' // eslint-disable-line import { ViewPlugin } from '@remixproject/engine-web' import helper from '../../lib/helper' import { canUseWorker, urlFromVersion } from '@remix-project/remix-solidity' -import { ViewPluginUI } from '../components/ViewPluginUI' +import { PluginViewWrapper } from '@remix-ui/helper' var { UnitTestRunner, assertLibCode } = require('@remix-project/remix-tests') @@ -137,7 +136,7 @@ module.exports = class TestTab extends ViewPlugin { render () { this.onActivationInternal() - return
+ return
} updateComponent(state) { diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index 10d99bfd2b..05a015c4fc 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -1,5 +1,4 @@ import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import { RunTabUI } from '@remix-ui/run-tab' import { ViewPlugin } from '@remixproject/engine-web' import * as packageJson from '../../../../../package.json' diff --git a/apps/remix-ide/src/app/ui/landing-page/landing-page.js b/apps/remix-ide/src/app/ui/landing-page/landing-page.js index 7c9268f11c..2f8819fc5f 100644 --- a/apps/remix-ide/src/app/ui/landing-page/landing-page.js +++ b/apps/remix-ide/src/app/ui/landing-page/landing-page.js @@ -1,10 +1,8 @@ /* global */ import React from 'react' // eslint-disable-line -import ReactDOM from 'react-dom' import * as packageJson from '../../../../../../package.json' import { ViewPlugin } from '@remixproject/engine-web' import { RemixUiHomeTab } from '@remix-ui/home-tab' // eslint-disable-line -import { ViewReactPlugin } from '../../plugins/viewReactPlugin' const profile = { name: 'home', @@ -16,7 +14,7 @@ const profile = { location: 'mainPanel', version: packageJson.version } -export class LandingPage extends ViewReactPlugin { +export class LandingPage extends ViewPlugin { constructor (appManager, verticalIcons, fileManager, filePanel, contentImport) { super(profile) this.profile = profile @@ -32,7 +30,7 @@ export class LandingPage extends ViewReactPlugin { } render () { - return
} diff --git a/libs/remix-ui/helper/src/index.ts b/libs/remix-ui/helper/src/index.ts index 31c21f0564..36d73ef523 100644 --- a/libs/remix-ui/helper/src/index.ts +++ b/libs/remix-ui/helper/src/index.ts @@ -1,2 +1,3 @@ export * from './lib/remix-ui-helper' export * from './lib/helper-components' +export * from './lib/components/PluginViewWrapper' \ No newline at end of file diff --git a/apps/remix-ide/src/app/components/ViewPluginUI.tsx b/libs/remix-ui/helper/src/lib/components/PluginViewWrapper.tsx similarity index 66% rename from apps/remix-ide/src/app/components/ViewPluginUI.tsx rename to libs/remix-ui/helper/src/lib/components/PluginViewWrapper.tsx index 9a4b84489e..058fa3aee0 100644 --- a/apps/remix-ide/src/app/components/ViewPluginUI.tsx +++ b/libs/remix-ui/helper/src/lib/components/PluginViewWrapper.tsx @@ -1,25 +1,20 @@ import React from "react" import { useEffect, useState } from "react" -interface IViewPluginUI { +interface IPluginViewWrapperProps { plugin: any } -export const ViewPluginUI = (props: IViewPluginUI) => { +export const PluginViewWrapper = (props: IPluginViewWrapperProps) => { const [state, setState] = useState(null) useEffect(() => { - // console.log(props.plugin) if(props.plugin.setDispatch){ props.plugin.setDispatch(setState) } }, []) - - useEffect(() => { - // console.log(state) - }, [state]) - + return ( <>{state? <>{props.plugin.updateComponent(state)} diff --git a/package.json b/package.json index 6a15b5d85e..16e53e4066 100644 --- a/package.json +++ b/package.json @@ -147,13 +147,13 @@ "@ethereumjs/tx": "^3.3.2", "@ethereumjs/vm": "^5.5.3", "@monaco-editor/react": "^4.3.1", - "@remixproject/engine": "^0.3.26", - "@remixproject/engine-web": "^0.3.26", - "@remixproject/plugin": "^0.3.26", - "@remixproject/plugin-api": "^0.3.26", - "@remixproject/plugin-utils": "^0.3.26", - "@remixproject/plugin-webview": "^0.3.26", - "@remixproject/plugin-ws": "^0.3.26", + "@remixproject/engine": "^0.3.27", + "@remixproject/engine-web": "^0.3.27", + "@remixproject/plugin": "^0.3.27", + "@remixproject/plugin-api": "^0.3.27", + "@remixproject/plugin-utils": "^0.3.27", + "@remixproject/plugin-webview": "^0.3.27", + "@remixproject/plugin-ws": "^0.3.27", "ansi-gray": "^0.1.1", "async": "^2.6.2", "axios": ">=0.21.1",