|
|
@ -2,7 +2,6 @@ import { Plugin } from '@remixproject/engine' |
|
|
|
import { EventEmitter } from 'events' |
|
|
|
import { EventEmitter } from 'events' |
|
|
|
import QueryParams from '../../lib/query-params' |
|
|
|
import QueryParams from '../../lib/query-params' |
|
|
|
import * as packageJson from '../../../../../package.json' |
|
|
|
import * as packageJson from '../../../../../package.json' |
|
|
|
import { RemixUiThemeModule } from '@remix-ui/theme-module' |
|
|
|
|
|
|
|
import ReactDOM from 'react-dom' |
|
|
|
import ReactDOM from 'react-dom' |
|
|
|
// eslint-disable-next-line no-use-before-define
|
|
|
|
// eslint-disable-next-line no-use-before-define
|
|
|
|
import React from 'react' |
|
|
|
import React from 'react' |
|
|
@ -37,8 +36,6 @@ export class ThemeModule extends Plugin { |
|
|
|
this._deps = { |
|
|
|
this._deps = { |
|
|
|
config: registry.get('config').api |
|
|
|
config: registry.get('config').api |
|
|
|
} |
|
|
|
} |
|
|
|
this.element = document.createElement('div') |
|
|
|
|
|
|
|
this.element.setAttribute('id', 'themeModuleSection') |
|
|
|
|
|
|
|
this.themes = themes.reduce((acc, theme) => { |
|
|
|
this.themes = themes.reduce((acc, theme) => { |
|
|
|
theme.url = window.location.origin + window.location.pathname + theme.url |
|
|
|
theme.url = window.location.origin + window.location.pathname + theme.url |
|
|
|
return { ...acc, [theme.name]: theme } |
|
|
|
return { ...acc, [theme.name]: theme } |
|
|
@ -53,23 +50,6 @@ export class ThemeModule extends Plugin { |
|
|
|
this.forced = !!queryTheme |
|
|
|
this.forced = !!queryTheme |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onActivation () { |
|
|
|
|
|
|
|
this.renderComponent() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
|
|
|
|
return this.element |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderComponent () { |
|
|
|
|
|
|
|
ReactDOM.render( |
|
|
|
|
|
|
|
<RemixUiThemeModule |
|
|
|
|
|
|
|
themeModule={this} |
|
|
|
|
|
|
|
/>, |
|
|
|
|
|
|
|
this.element |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Return the active theme */ |
|
|
|
/** Return the active theme */ |
|
|
|
currentTheme () { |
|
|
|
currentTheme () { |
|
|
|
return this.themes[this.active] |
|
|
|
return this.themes[this.active] |
|
|
|