goblin-laboratory 2.2.1 → 2.2.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/.editorconfig +9 -9
- package/.eslintrc.js +28 -28
- package/.zou-flow +3 -3
- package/README.md +107 -107
- package/carnotzet.js +10 -10
- package/config.js +13 -13
- package/laboratory.js +13 -13
- package/lib/.webpack-config.js +53 -53
- package/lib/carnotzet.js +118 -118
- package/lib/helpers.js +16 -16
- package/lib/index.js +66 -66
- package/package.json +47 -47
- package/widgets/connect-helpers/arrayEquals.js +5 -5
- package/widgets/connect-helpers/arraysEquals.js +24 -24
- package/widgets/connect-helpers/c.js +99 -99
- package/widgets/connect-helpers/join-models.js +16 -16
- package/widgets/connect-helpers/with-c.js +276 -276
- package/widgets/devtools.js +5 -5
- package/widgets/disconnect-overlay/styles.js +50 -50
- package/widgets/disconnect-overlay/widget.js +40 -40
- package/widgets/fields-view/widget.js +34 -34
- package/widgets/form/index.js +79 -79
- package/widgets/frame/widget.js +47 -47
- package/widgets/frontend-form/reducer.js +18 -18
- package/widgets/frontend-form/widget.js +15 -15
- package/widgets/importer/default.js +14 -14
- package/widgets/importer/importer.js +54 -53
- package/widgets/importer/index.js +4 -4
- package/widgets/index-browsers.js +195 -195
- package/widgets/index-electron-ws.js +153 -153
- package/widgets/index-electron.js +69 -69
- package/widgets/index.js +1 -1
- package/widgets/laboratory/service.js +542 -542
- package/widgets/laboratory/widget.js +98 -98
- package/widgets/maintenance/styles.js +38 -38
- package/widgets/maintenance/widget.js +65 -65
- package/widgets/props-binder/widget.js +48 -48
- package/widgets/renderer.js +85 -85
- package/widgets/root/index.js +54 -54
- package/widgets/searchkit/index.js +68 -68
- package/widgets/store/backend-reducer.js +116 -116
- package/widgets/store/commands-reducer.js +14 -14
- package/widgets/store/middlewares.js +171 -171
- package/widgets/store/network-reducer.js +23 -23
- package/widgets/store/root-reducer.js +35 -35
- package/widgets/store/store.js +40 -40
- package/widgets/store/widgets-reducer.js +95 -95
- package/widgets/theme-context/js-to-css.js +20 -20
- package/widgets/theme-context/widget.js +130 -130
- package/widgets/view/index.js +31 -31
- package/widgets/widget/index.js +1205 -1205
- package/widgets/widget/utils/connect.js +47 -47
- package/widgets/widget/utils/connectBackend.js +48 -48
- package/widgets/widget/utils/connectWidget.js +31 -31
- package/widgets/widget/utils/manifest.txt +134 -134
- package/widgets/widget/utils/shallowEqualShredder.js +36 -36
- package/widgets/widget/utils/widgets-actions.js +21 -21
- package/widgets/widget/utils/wrapMapStateToProps.js +26 -26
- package/widgets/with-desktop-id/widget.js +20 -20
- package/widgets/with-model/context.js +5 -5
- package/widgets/with-model/widget.js +42 -42
- package/widgets/with-workitem/widget.js +30 -30
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Widget from 'goblin-laboratory/widgets/widget';
|
|
3
|
-
import Maintenance from 'goblin-laboratory/widgets/maintenance/widget';
|
|
4
|
-
import DisconnectOverlay from '../disconnect-overlay/widget';
|
|
5
|
-
import ThemeContext from 'goblin-laboratory/widgets/theme-context/widget';
|
|
6
|
-
|
|
7
|
-
import importer from 'goblin_importer';
|
|
8
|
-
const widgetImporter = importer('widget');
|
|
9
|
-
|
|
10
|
-
class LaboratoryNC extends Widget {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
renderContent() {
|
|
16
|
-
const {status, root, rootId, overlay, message} = this.props;
|
|
17
|
-
if (status && status !== 'off') {
|
|
18
|
-
return <Maintenance />;
|
|
19
|
-
} else {
|
|
20
|
-
const widgetName = root.split('@')[0];
|
|
21
|
-
const RootWidget = widgetImporter(widgetName);
|
|
22
|
-
if (overlay) {
|
|
23
|
-
return (
|
|
24
|
-
<DisconnectOverlay message={message}>
|
|
25
|
-
<RootWidget id={rootId} />
|
|
26
|
-
</DisconnectOverlay>
|
|
27
|
-
);
|
|
28
|
-
} else {
|
|
29
|
-
return <RootWidget id={rootId} />;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
const {id, root, theme, themeContext, titlebar, titlebarId} = this.props;
|
|
36
|
-
if (!root) {
|
|
37
|
-
// Laboratory not loaded
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
if (titlebar) {
|
|
41
|
-
const TitlebarWidget = widgetImporter(titlebar);
|
|
42
|
-
return (
|
|
43
|
-
<ThemeContext
|
|
44
|
-
labId={id}
|
|
45
|
-
currentTheme={theme}
|
|
46
|
-
themeContext={themeContext}
|
|
47
|
-
>
|
|
48
|
-
<TitlebarWidget id={titlebarId}>
|
|
49
|
-
{this.renderContent()}
|
|
50
|
-
</TitlebarWidget>
|
|
51
|
-
</ThemeContext>
|
|
52
|
-
);
|
|
53
|
-
} else {
|
|
54
|
-
return (
|
|
55
|
-
<ThemeContext
|
|
56
|
-
labId={id}
|
|
57
|
-
currentTheme={theme}
|
|
58
|
-
themeContext={themeContext}
|
|
59
|
-
>
|
|
60
|
-
{this.renderContent()}
|
|
61
|
-
</ThemeContext>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const Laboratory = Widget.connect((state, props) => {
|
|
68
|
-
const labState = state.get('backend').get(props.id);
|
|
69
|
-
if (!labState) {
|
|
70
|
-
return {};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
let overlay = false;
|
|
74
|
-
let message = '';
|
|
75
|
-
const hasOverlay = state.get('network.hasOverlay');
|
|
76
|
-
if (hasOverlay) {
|
|
77
|
-
const hordes = state.get('network.hordes');
|
|
78
|
-
const payload = hordes.find(({overlay}) => overlay);
|
|
79
|
-
if (payload) {
|
|
80
|
-
overlay = payload.overlay;
|
|
81
|
-
message = payload.message;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
root: labState.get('root'),
|
|
87
|
-
rootId: labState.get('rootId'),
|
|
88
|
-
titlebar: labState.get('titlebar'),
|
|
89
|
-
titlebarId: labState.get('titlebarId'),
|
|
90
|
-
theme: labState.get('theme'),
|
|
91
|
-
themeContext: labState.get('themeContext'),
|
|
92
|
-
status: state.get('backend.workshop.maintenance.status'),
|
|
93
|
-
overlay,
|
|
94
|
-
message,
|
|
95
|
-
};
|
|
96
|
-
})(LaboratoryNC);
|
|
97
|
-
|
|
98
|
-
export default Laboratory;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Widget from 'goblin-laboratory/widgets/widget';
|
|
3
|
+
import Maintenance from 'goblin-laboratory/widgets/maintenance/widget';
|
|
4
|
+
import DisconnectOverlay from '../disconnect-overlay/widget';
|
|
5
|
+
import ThemeContext from 'goblin-laboratory/widgets/theme-context/widget';
|
|
6
|
+
|
|
7
|
+
import importer from 'goblin_importer';
|
|
8
|
+
const widgetImporter = importer('widget');
|
|
9
|
+
|
|
10
|
+
class LaboratoryNC extends Widget {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
renderContent() {
|
|
16
|
+
const {status, root, rootId, overlay, message} = this.props;
|
|
17
|
+
if (status && status !== 'off') {
|
|
18
|
+
return <Maintenance />;
|
|
19
|
+
} else {
|
|
20
|
+
const widgetName = root.split('@')[0];
|
|
21
|
+
const RootWidget = widgetImporter(widgetName);
|
|
22
|
+
if (overlay) {
|
|
23
|
+
return (
|
|
24
|
+
<DisconnectOverlay message={message}>
|
|
25
|
+
<RootWidget id={rootId} />
|
|
26
|
+
</DisconnectOverlay>
|
|
27
|
+
);
|
|
28
|
+
} else {
|
|
29
|
+
return <RootWidget id={rootId} />;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
const {id, root, theme, themeContext, titlebar, titlebarId} = this.props;
|
|
36
|
+
if (!root) {
|
|
37
|
+
// Laboratory not loaded
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if (titlebar) {
|
|
41
|
+
const TitlebarWidget = widgetImporter(titlebar);
|
|
42
|
+
return (
|
|
43
|
+
<ThemeContext
|
|
44
|
+
labId={id}
|
|
45
|
+
currentTheme={theme}
|
|
46
|
+
themeContext={themeContext}
|
|
47
|
+
>
|
|
48
|
+
<TitlebarWidget id={titlebarId}>
|
|
49
|
+
{this.renderContent()}
|
|
50
|
+
</TitlebarWidget>
|
|
51
|
+
</ThemeContext>
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
return (
|
|
55
|
+
<ThemeContext
|
|
56
|
+
labId={id}
|
|
57
|
+
currentTheme={theme}
|
|
58
|
+
themeContext={themeContext}
|
|
59
|
+
>
|
|
60
|
+
{this.renderContent()}
|
|
61
|
+
</ThemeContext>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const Laboratory = Widget.connect((state, props) => {
|
|
68
|
+
const labState = state.get('backend').get(props.id);
|
|
69
|
+
if (!labState) {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let overlay = false;
|
|
74
|
+
let message = '';
|
|
75
|
+
const hasOverlay = state.get('network.hasOverlay');
|
|
76
|
+
if (hasOverlay) {
|
|
77
|
+
const hordes = state.get('network.hordes');
|
|
78
|
+
const payload = hordes.find(({overlay}) => overlay);
|
|
79
|
+
if (payload) {
|
|
80
|
+
overlay = payload.overlay;
|
|
81
|
+
message = payload.message;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
root: labState.get('root'),
|
|
87
|
+
rootId: labState.get('rootId'),
|
|
88
|
+
titlebar: labState.get('titlebar'),
|
|
89
|
+
titlebarId: labState.get('titlebarId'),
|
|
90
|
+
theme: labState.get('theme'),
|
|
91
|
+
themeContext: labState.get('themeContext'),
|
|
92
|
+
status: state.get('backend.workshop.maintenance.status'),
|
|
93
|
+
overlay,
|
|
94
|
+
message,
|
|
95
|
+
};
|
|
96
|
+
})(LaboratoryNC);
|
|
97
|
+
|
|
98
|
+
export default Laboratory;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
//T:2019-02-27
|
|
2
|
-
|
|
3
|
-
export const propNames = ['zIndex'];
|
|
4
|
-
|
|
5
|
-
export default function styles(theme, props) {
|
|
6
|
-
const {zIndex} = props;
|
|
7
|
-
|
|
8
|
-
const fullScreenStyle = {
|
|
9
|
-
visibility: 'visible',
|
|
10
|
-
position: 'fixed',
|
|
11
|
-
zIndex: zIndex || 10,
|
|
12
|
-
top: '0px',
|
|
13
|
-
left: '0px',
|
|
14
|
-
width: '100%',
|
|
15
|
-
height: '100%',
|
|
16
|
-
display: 'flex',
|
|
17
|
-
flexDirection: 'column',
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
userSelect: 'none',
|
|
21
|
-
cursor: 'default',
|
|
22
|
-
backgroundColor: theme.palette.flyingDialogFullScreenBackground,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const gaugeStyle = {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
width: '300px',
|
|
28
|
-
height: '10px',
|
|
29
|
-
transform: 'scale(2)',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
fullScreen: fullScreenStyle,
|
|
34
|
-
gauge: gaugeStyle,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/******************************************************************************/
|
|
1
|
+
//T:2019-02-27
|
|
2
|
+
|
|
3
|
+
export const propNames = ['zIndex'];
|
|
4
|
+
|
|
5
|
+
export default function styles(theme, props) {
|
|
6
|
+
const {zIndex} = props;
|
|
7
|
+
|
|
8
|
+
const fullScreenStyle = {
|
|
9
|
+
visibility: 'visible',
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
zIndex: zIndex || 10,
|
|
12
|
+
top: '0px',
|
|
13
|
+
left: '0px',
|
|
14
|
+
width: '100%',
|
|
15
|
+
height: '100%',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
userSelect: 'none',
|
|
21
|
+
cursor: 'default',
|
|
22
|
+
backgroundColor: theme.palette.flyingDialogFullScreenBackground,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const gaugeStyle = {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
width: '300px',
|
|
28
|
+
height: '10px',
|
|
29
|
+
transform: 'scale(2)',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
fullScreen: fullScreenStyle,
|
|
34
|
+
gauge: gaugeStyle,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/******************************************************************************/
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
//T:2019-02-27
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
import Widget from 'goblin-laboratory/widgets/widget';
|
|
6
|
-
import Label from 'goblin-gadgets/widgets/label/widget';
|
|
7
|
-
import Gauge from 'goblin-gadgets/widgets/gauge/widget';
|
|
8
|
-
|
|
9
|
-
class Maintenance extends Widget {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static get wiring() {
|
|
15
|
-
return {
|
|
16
|
-
id: 'id',
|
|
17
|
-
status: 'maintenance.status',
|
|
18
|
-
progress: 'maintenance.progress',
|
|
19
|
-
message: 'maintenance.message',
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
render() {
|
|
24
|
-
const {id, status, progress, message} = this.props;
|
|
25
|
-
|
|
26
|
-
if (!id) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const fullScreenClass = this.styles.classNames.fullScreen;
|
|
31
|
-
const gaugeClass = this.styles.classNames.gauge;
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className={fullScreenClass}>
|
|
35
|
-
<Label
|
|
36
|
-
height="350px"
|
|
37
|
-
justify="center"
|
|
38
|
-
kind="footer"
|
|
39
|
-
glyphPosition="center"
|
|
40
|
-
glyph="solid/lock-alt"
|
|
41
|
-
glyphSize="1000%"
|
|
42
|
-
/>
|
|
43
|
-
<div className={gaugeClass}>
|
|
44
|
-
<Gauge
|
|
45
|
-
kind="rounded"
|
|
46
|
-
gradient="red-yellow-green"
|
|
47
|
-
width="300px"
|
|
48
|
-
height="10px"
|
|
49
|
-
direction="horizontal"
|
|
50
|
-
value={progress * 100}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
<Label
|
|
54
|
-
height="200px"
|
|
55
|
-
justify="center"
|
|
56
|
-
kind="footer"
|
|
57
|
-
fontSize="300%"
|
|
58
|
-
text={message}
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default Widget.Wired(Maintenance)('workshop');
|
|
1
|
+
//T:2019-02-27
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import Widget from 'goblin-laboratory/widgets/widget';
|
|
6
|
+
import Label from 'goblin-gadgets/widgets/label/widget';
|
|
7
|
+
import Gauge from 'goblin-gadgets/widgets/gauge/widget';
|
|
8
|
+
|
|
9
|
+
class Maintenance extends Widget {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get wiring() {
|
|
15
|
+
return {
|
|
16
|
+
id: 'id',
|
|
17
|
+
status: 'maintenance.status',
|
|
18
|
+
progress: 'maintenance.progress',
|
|
19
|
+
message: 'maintenance.message',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
const {id, status, progress, message} = this.props;
|
|
25
|
+
|
|
26
|
+
if (!id) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const fullScreenClass = this.styles.classNames.fullScreen;
|
|
31
|
+
const gaugeClass = this.styles.classNames.gauge;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className={fullScreenClass}>
|
|
35
|
+
<Label
|
|
36
|
+
height="350px"
|
|
37
|
+
justify="center"
|
|
38
|
+
kind="footer"
|
|
39
|
+
glyphPosition="center"
|
|
40
|
+
glyph="solid/lock-alt"
|
|
41
|
+
glyphSize="1000%"
|
|
42
|
+
/>
|
|
43
|
+
<div className={gaugeClass}>
|
|
44
|
+
<Gauge
|
|
45
|
+
kind="rounded"
|
|
46
|
+
gradient="red-yellow-green"
|
|
47
|
+
width="300px"
|
|
48
|
+
height="10px"
|
|
49
|
+
direction="horizontal"
|
|
50
|
+
value={progress * 100}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
<Label
|
|
54
|
+
height="200px"
|
|
55
|
+
justify="center"
|
|
56
|
+
kind="footer"
|
|
57
|
+
fontSize="300%"
|
|
58
|
+
text={message}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default Widget.Wired(Maintenance)('workshop');
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import Widget from 'goblin-laboratory/widgets/widget';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
export default (Component) => {
|
|
5
|
-
const ConnectedComponent = Widget.connect(
|
|
6
|
-
(state, props) => {
|
|
7
|
-
const {model, ...otherProps} = props;
|
|
8
|
-
return Object.entries(otherProps).reduce((properties, [key, path]) => {
|
|
9
|
-
if (key === 'value') {
|
|
10
|
-
return properties;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//do binding
|
|
14
|
-
if (path.startsWith('.')) {
|
|
15
|
-
path = `${model}${path}`;
|
|
16
|
-
properties[key] = state.get(path);
|
|
17
|
-
return properties;
|
|
18
|
-
} else if (path.startsWith('state.')) {
|
|
19
|
-
path = `${path.substring(2)}`;
|
|
20
|
-
properties[key] = state.get(path);
|
|
21
|
-
return properties;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return properties;
|
|
25
|
-
}, {});
|
|
26
|
-
},
|
|
27
|
-
() => ({}) // Do not add "dispatch" to the props
|
|
28
|
-
)(Component);
|
|
29
|
-
|
|
30
|
-
return class PropsBinder extends Widget {
|
|
31
|
-
constructor() {
|
|
32
|
-
super(...arguments);
|
|
33
|
-
|
|
34
|
-
if (this.context.register) {
|
|
35
|
-
this.context.register(this.props);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
render() {
|
|
40
|
-
return (
|
|
41
|
-
<ConnectedComponent
|
|
42
|
-
{...this.props}
|
|
43
|
-
model={this.props.model || this.context.model}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
};
|
|
1
|
+
import Widget from 'goblin-laboratory/widgets/widget';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
export default (Component) => {
|
|
5
|
+
const ConnectedComponent = Widget.connect(
|
|
6
|
+
(state, props) => {
|
|
7
|
+
const {model, ...otherProps} = props;
|
|
8
|
+
return Object.entries(otherProps).reduce((properties, [key, path]) => {
|
|
9
|
+
if (key === 'value') {
|
|
10
|
+
return properties;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//do binding
|
|
14
|
+
if (path.startsWith('.')) {
|
|
15
|
+
path = `${model}${path}`;
|
|
16
|
+
properties[key] = state.get(path);
|
|
17
|
+
return properties;
|
|
18
|
+
} else if (path.startsWith('state.')) {
|
|
19
|
+
path = `${path.substring(2)}`;
|
|
20
|
+
properties[key] = state.get(path);
|
|
21
|
+
return properties;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return properties;
|
|
25
|
+
}, {});
|
|
26
|
+
},
|
|
27
|
+
() => ({}) // Do not add "dispatch" to the props
|
|
28
|
+
)(Component);
|
|
29
|
+
|
|
30
|
+
return class PropsBinder extends Widget {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
|
|
34
|
+
if (this.context.register) {
|
|
35
|
+
this.context.register(this.props);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
return (
|
|
41
|
+
<ConnectedComponent
|
|
42
|
+
{...this.props}
|
|
43
|
+
model={this.props.model || this.context.model}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
package/widgets/renderer.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
if (process.env.NODE_ENV === 'development') {
|
|
2
|
-
require('./devtools.js');
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
|
-
import Root from 'goblin-laboratory/widgets/root';
|
|
8
|
-
import {createHashHistory} from 'history';
|
|
9
|
-
import {push} from 'connected-react-router/immutable';
|
|
10
|
-
import configureStore from 'goblin-laboratory/widgets/store/store';
|
|
11
|
-
|
|
12
|
-
class Renderer {
|
|
13
|
-
constructor(send, options = {}) {
|
|
14
|
-
this.send = send;
|
|
15
|
-
this.push = push;
|
|
16
|
-
this.options = options;
|
|
17
|
-
|
|
18
|
-
this.history = undefined;
|
|
19
|
-
if (this.options.useRouter !== false) {
|
|
20
|
-
this.history = createHashHistory();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
this._store = configureStore(
|
|
24
|
-
window.__INITIAL_STATE__,
|
|
25
|
-
this.history,
|
|
26
|
-
this.send
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
document.addEventListener('drop', (e) => {
|
|
30
|
-
e.preventDefault();
|
|
31
|
-
e.stopPropagation();
|
|
32
|
-
|
|
33
|
-
const filePaths = [];
|
|
34
|
-
for (const file of e.dataTransfer.files) {
|
|
35
|
-
filePaths.push(file.path);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (filePaths.length) {
|
|
39
|
-
send('DATA_TRANSFER', {filePaths});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
document.addEventListener('dragover', (e) => {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
e.stopPropagation();
|
|
46
|
-
e.dataTransfer.dropEffect = 'copy';
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
get store() {
|
|
51
|
-
return this._store;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
newBackendState(transitState) {
|
|
55
|
-
this.store.dispatch({
|
|
56
|
-
type: 'NEW_BACKEND_STATE',
|
|
57
|
-
data: transitState,
|
|
58
|
-
renderer: this,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
main(labId) {
|
|
63
|
-
//PUT LABID IN WINDOW STATE
|
|
64
|
-
//USEFULL IN SOME CONNECT()
|
|
65
|
-
window.labId = labId;
|
|
66
|
-
|
|
67
|
-
const rootElement = document.getElementById('root');
|
|
68
|
-
const isHydratable = rootElement.hasAttribute('data-hydratable');
|
|
69
|
-
let render = ReactDOM.render;
|
|
70
|
-
if (isHydratable) {
|
|
71
|
-
render = ReactDOM.hydrate;
|
|
72
|
-
}
|
|
73
|
-
render(
|
|
74
|
-
<Root
|
|
75
|
-
store={this.store}
|
|
76
|
-
labId={labId}
|
|
77
|
-
useRouter={this.options.useRouter !== false}
|
|
78
|
-
history={this.history}
|
|
79
|
-
/>,
|
|
80
|
-
rootElement
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default Renderer;
|
|
1
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2
|
+
require('./devtools.js');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import Root from 'goblin-laboratory/widgets/root';
|
|
8
|
+
import {createHashHistory} from 'history';
|
|
9
|
+
import {push} from 'connected-react-router/immutable';
|
|
10
|
+
import configureStore from 'goblin-laboratory/widgets/store/store';
|
|
11
|
+
|
|
12
|
+
class Renderer {
|
|
13
|
+
constructor(send, options = {}) {
|
|
14
|
+
this.send = send;
|
|
15
|
+
this.push = push;
|
|
16
|
+
this.options = options;
|
|
17
|
+
|
|
18
|
+
this.history = undefined;
|
|
19
|
+
if (this.options.useRouter !== false) {
|
|
20
|
+
this.history = createHashHistory();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
this._store = configureStore(
|
|
24
|
+
window.__INITIAL_STATE__,
|
|
25
|
+
this.history,
|
|
26
|
+
this.send
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
document.addEventListener('drop', (e) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
|
|
33
|
+
const filePaths = [];
|
|
34
|
+
for (const file of e.dataTransfer.files) {
|
|
35
|
+
filePaths.push(file.path);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (filePaths.length) {
|
|
39
|
+
send('DATA_TRANSFER', {filePaths});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
document.addEventListener('dragover', (e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get store() {
|
|
51
|
+
return this._store;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
newBackendState(transitState) {
|
|
55
|
+
this.store.dispatch({
|
|
56
|
+
type: 'NEW_BACKEND_STATE',
|
|
57
|
+
data: transitState,
|
|
58
|
+
renderer: this,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
main(labId) {
|
|
63
|
+
//PUT LABID IN WINDOW STATE
|
|
64
|
+
//USEFULL IN SOME CONNECT()
|
|
65
|
+
window.labId = labId;
|
|
66
|
+
|
|
67
|
+
const rootElement = document.getElementById('root');
|
|
68
|
+
const isHydratable = rootElement.hasAttribute('data-hydratable');
|
|
69
|
+
let render = ReactDOM.render;
|
|
70
|
+
if (isHydratable) {
|
|
71
|
+
render = ReactDOM.hydrate;
|
|
72
|
+
}
|
|
73
|
+
render(
|
|
74
|
+
<Root
|
|
75
|
+
store={this.store}
|
|
76
|
+
labId={labId}
|
|
77
|
+
useRouter={this.options.useRouter !== false}
|
|
78
|
+
history={this.history}
|
|
79
|
+
/>,
|
|
80
|
+
rootElement
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default Renderer;
|