goblin-laboratory 4.11.1 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/widgets/renderer.js +1 -12
- package/widgets/root/index.js +0 -16
- package/widgets/store/store.js +7 -16
- package/widgets/widget/index.js +2 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goblin-laboratory",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.2",
|
|
4
4
|
"description": "Laboratory",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"aphrodite": "^2.2.2",
|
|
40
|
-
"connected-react-router": "^6.3.2",
|
|
41
40
|
"css-key": "^1.0.0",
|
|
42
41
|
"@fortawesome/react-fontawesome": "^0.1.9",
|
|
43
42
|
"history": "^4.6.1",
|
package/widgets/renderer.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import Root from 'goblin-laboratory/widgets/root';
|
|
4
|
-
import {createHashHistory} from 'history';
|
|
5
|
-
import {push} from 'connected-react-router/immutable';
|
|
6
4
|
import configureStore from 'goblin-laboratory/widgets/store/store';
|
|
7
5
|
|
|
8
6
|
class Renderer {
|
|
9
7
|
constructor(send, options = {}) {
|
|
10
8
|
this.send = send;
|
|
11
|
-
this.push = push;
|
|
12
9
|
this.options = options;
|
|
13
10
|
|
|
14
11
|
this.history = undefined;
|
|
15
|
-
if (this.options.useRouter !== false) {
|
|
16
|
-
this.history = createHashHistory();
|
|
17
|
-
}
|
|
18
12
|
|
|
19
13
|
this._store = configureStore(
|
|
20
14
|
window.__INITIAL_STATE__,
|
|
@@ -69,12 +63,7 @@ class Renderer {
|
|
|
69
63
|
render = ReactDOM.hydrate;
|
|
70
64
|
}
|
|
71
65
|
render(
|
|
72
|
-
<Root
|
|
73
|
-
store={this.store}
|
|
74
|
-
labId={labId}
|
|
75
|
-
useRouter={this.options.useRouter !== false}
|
|
76
|
-
history={this.history}
|
|
77
|
-
/>,
|
|
66
|
+
<Root store={this.store} labId={labId} history={this.history} />,
|
|
78
67
|
rootElement
|
|
79
68
|
);
|
|
80
69
|
}
|
package/widgets/root/index.js
CHANGED
|
@@ -4,11 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
|
|
6
6
|
import {Provider} from 'react-redux';
|
|
7
|
-
import {ConnectedRouter} from 'connected-react-router/immutable';
|
|
8
7
|
import Laboratory from '../laboratory/widget';
|
|
9
|
-
import {withRoute} from '../with-route/with-route.js';
|
|
10
|
-
|
|
11
|
-
const LabWithRoute = withRoute('/')(Laboratory);
|
|
12
8
|
|
|
13
9
|
class Root extends React.PureComponent {
|
|
14
10
|
getChildContext() {
|
|
@@ -27,23 +23,11 @@ class Root extends React.PureComponent {
|
|
|
27
23
|
};
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
renderLabWithRouter() {
|
|
31
|
-
const {history, labId} = this.props;
|
|
32
|
-
return (
|
|
33
|
-
<ConnectedRouter history={history}>
|
|
34
|
-
<LabWithRoute id={labId} />
|
|
35
|
-
</ConnectedRouter>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
26
|
renderLab() {
|
|
40
27
|
return <Laboratory id={this.props.labId} />;
|
|
41
28
|
}
|
|
42
29
|
|
|
43
30
|
renderContent() {
|
|
44
|
-
if (this.props.useRouter) {
|
|
45
|
-
return this.renderLabWithRouter();
|
|
46
|
-
}
|
|
47
31
|
return this.renderLab();
|
|
48
32
|
}
|
|
49
33
|
|
package/widgets/store/store.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import {applyMiddleware, compose, createStore} from 'redux';
|
|
2
|
-
import {routerMiddleware} from 'connected-react-router/immutable';
|
|
3
2
|
import thunk from 'redux-thunk';
|
|
4
3
|
import middlewares from './middlewares';
|
|
5
4
|
|
|
6
|
-
const rootReducer =
|
|
7
|
-
.default;
|
|
5
|
+
const rootReducer =
|
|
6
|
+
require('goblin-laboratory/widgets/store/root-reducer').default;
|
|
8
7
|
|
|
9
8
|
export default function configureStore(initialState, history, send) {
|
|
10
|
-
const {transitMiddleware, formMiddleware, questMiddleware} =
|
|
11
|
-
send
|
|
12
|
-
);
|
|
13
|
-
const routerHistory = routerMiddleware(history);
|
|
9
|
+
const {transitMiddleware, formMiddleware, questMiddleware} =
|
|
10
|
+
middlewares(send);
|
|
14
11
|
|
|
15
12
|
const composeEnhancers =
|
|
16
13
|
(process.env.NODE_ENV === 'development' &&
|
|
@@ -19,20 +16,14 @@ export default function configureStore(initialState, history, send) {
|
|
|
19
16
|
|
|
20
17
|
const finalCreateStore = composeEnhancers(
|
|
21
18
|
// Middleware you want to use in development:
|
|
22
|
-
applyMiddleware(
|
|
23
|
-
thunk,
|
|
24
|
-
routerHistory,
|
|
25
|
-
transitMiddleware,
|
|
26
|
-
questMiddleware,
|
|
27
|
-
formMiddleware
|
|
28
|
-
)
|
|
19
|
+
applyMiddleware(thunk, transitMiddleware, questMiddleware, formMiddleware)
|
|
29
20
|
)(createStore);
|
|
30
21
|
|
|
31
22
|
const store = finalCreateStore(rootReducer, initialState);
|
|
32
23
|
if (module.hot) {
|
|
33
24
|
module.hot.accept('goblin-laboratory/widgets/store/root-reducer', () => {
|
|
34
|
-
const nextRootReducer =
|
|
35
|
-
.default;
|
|
25
|
+
const nextRootReducer =
|
|
26
|
+
require('goblin-laboratory/widgets/store/root-reducer').default;
|
|
36
27
|
store.replaceReducer(nextRootReducer);
|
|
37
28
|
});
|
|
38
29
|
}
|
package/widgets/widget/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Shredder from 'xcraft-core-shredder';
|
|
5
|
-
import {push} from 'connected-react-router/immutable';
|
|
6
5
|
import {flushToStyleTag} from 'aphrodite/no-important';
|
|
7
6
|
import importer from 'goblin_importer';
|
|
8
7
|
import shallowEqualShredder from './utils/shallowEqualShredder';
|
|
@@ -430,12 +429,8 @@ class Widget extends React.Component {
|
|
|
430
429
|
this.context.store.dispatch(action);
|
|
431
430
|
}
|
|
432
431
|
|
|
433
|
-
nav(route
|
|
434
|
-
|
|
435
|
-
this.context.dispatch(push(route));
|
|
436
|
-
} else {
|
|
437
|
-
this.doFor(this.context.labId, 'nav', {route});
|
|
438
|
-
}
|
|
432
|
+
nav(route) {
|
|
433
|
+
this.doFor(this.context.labId, 'nav', {route});
|
|
439
434
|
}
|
|
440
435
|
|
|
441
436
|
setBackendValue(path, value) {
|