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.
Files changed (62) hide show
  1. package/.editorconfig +9 -9
  2. package/.eslintrc.js +28 -28
  3. package/.zou-flow +3 -3
  4. package/README.md +107 -107
  5. package/carnotzet.js +10 -10
  6. package/config.js +13 -13
  7. package/laboratory.js +13 -13
  8. package/lib/.webpack-config.js +53 -53
  9. package/lib/carnotzet.js +118 -118
  10. package/lib/helpers.js +16 -16
  11. package/lib/index.js +66 -66
  12. package/package.json +47 -47
  13. package/widgets/connect-helpers/arrayEquals.js +5 -5
  14. package/widgets/connect-helpers/arraysEquals.js +24 -24
  15. package/widgets/connect-helpers/c.js +99 -99
  16. package/widgets/connect-helpers/join-models.js +16 -16
  17. package/widgets/connect-helpers/with-c.js +276 -276
  18. package/widgets/devtools.js +5 -5
  19. package/widgets/disconnect-overlay/styles.js +50 -50
  20. package/widgets/disconnect-overlay/widget.js +40 -40
  21. package/widgets/fields-view/widget.js +34 -34
  22. package/widgets/form/index.js +79 -79
  23. package/widgets/frame/widget.js +47 -47
  24. package/widgets/frontend-form/reducer.js +18 -18
  25. package/widgets/frontend-form/widget.js +15 -15
  26. package/widgets/importer/default.js +14 -14
  27. package/widgets/importer/importer.js +54 -53
  28. package/widgets/importer/index.js +4 -4
  29. package/widgets/index-browsers.js +195 -195
  30. package/widgets/index-electron-ws.js +153 -153
  31. package/widgets/index-electron.js +69 -69
  32. package/widgets/index.js +1 -1
  33. package/widgets/laboratory/service.js +542 -542
  34. package/widgets/laboratory/widget.js +98 -98
  35. package/widgets/maintenance/styles.js +38 -38
  36. package/widgets/maintenance/widget.js +65 -65
  37. package/widgets/props-binder/widget.js +48 -48
  38. package/widgets/renderer.js +85 -85
  39. package/widgets/root/index.js +54 -54
  40. package/widgets/searchkit/index.js +68 -68
  41. package/widgets/store/backend-reducer.js +116 -116
  42. package/widgets/store/commands-reducer.js +14 -14
  43. package/widgets/store/middlewares.js +171 -171
  44. package/widgets/store/network-reducer.js +23 -23
  45. package/widgets/store/root-reducer.js +35 -35
  46. package/widgets/store/store.js +40 -40
  47. package/widgets/store/widgets-reducer.js +95 -95
  48. package/widgets/theme-context/js-to-css.js +20 -20
  49. package/widgets/theme-context/widget.js +130 -130
  50. package/widgets/view/index.js +31 -31
  51. package/widgets/widget/index.js +1205 -1205
  52. package/widgets/widget/utils/connect.js +47 -47
  53. package/widgets/widget/utils/connectBackend.js +48 -48
  54. package/widgets/widget/utils/connectWidget.js +31 -31
  55. package/widgets/widget/utils/manifest.txt +134 -134
  56. package/widgets/widget/utils/shallowEqualShredder.js +36 -36
  57. package/widgets/widget/utils/widgets-actions.js +21 -21
  58. package/widgets/widget/utils/wrapMapStateToProps.js +26 -26
  59. package/widgets/with-desktop-id/widget.js +20 -20
  60. package/widgets/with-model/context.js +5 -5
  61. package/widgets/with-model/widget.js +42 -42
  62. package/widgets/with-workitem/widget.js +30 -30
@@ -1,40 +1,40 @@
1
- import React from 'react';
2
-
3
- import Widget from 'goblin-laboratory/widgets/widget';
4
- import Label from 'goblin-gadgets/widgets/label/widget';
5
- import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
6
-
7
- class DisconnectOverlay extends Widget {
8
- constructor() {
9
- super(...arguments);
10
- }
11
-
12
- render() {
13
- const {message} = this.props;
14
-
15
- const fullScreenClass = this.styles.classNames.fullScreen;
16
- const blinkClass = this.styles.classNames.blink;
17
- const messageClass = this.styles.classNames.message;
18
-
19
- return (
20
- <>
21
- <div className={fullScreenClass}>
22
- <div className={blinkClass}>
23
- <FontAwesomeIcon icon={['fas', 'network-wired']} size="10x" />
24
- </div>
25
- <Label
26
- className={messageClass}
27
- height="200px"
28
- justify="center"
29
- kind="footer"
30
- fontSize="300%"
31
- text={message}
32
- />
33
- </div>
34
- {this.props.children}
35
- </>
36
- );
37
- }
38
- }
39
-
40
- export default DisconnectOverlay;
1
+ import React from 'react';
2
+
3
+ import Widget from 'goblin-laboratory/widgets/widget';
4
+ import Label from 'goblin-gadgets/widgets/label/widget';
5
+ import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
6
+
7
+ class DisconnectOverlay extends Widget {
8
+ constructor() {
9
+ super(...arguments);
10
+ }
11
+
12
+ render() {
13
+ const {message} = this.props;
14
+
15
+ const fullScreenClass = this.styles.classNames.fullScreen;
16
+ const blinkClass = this.styles.classNames.blink;
17
+ const messageClass = this.styles.classNames.message;
18
+
19
+ return (
20
+ <>
21
+ <div className={fullScreenClass}>
22
+ <div className={blinkClass}>
23
+ <FontAwesomeIcon icon={['fas', 'network-wired']} size="10x" />
24
+ </div>
25
+ <Label
26
+ className={messageClass}
27
+ height="200px"
28
+ justify="center"
29
+ kind="footer"
30
+ fontSize="300%"
31
+ text={message}
32
+ />
33
+ </div>
34
+ {this.props.children}
35
+ </>
36
+ );
37
+ }
38
+ }
39
+
40
+ export default DisconnectOverlay;
@@ -1,34 +1,34 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import Widget from 'goblin-laboratory/widgets/widget';
4
-
5
- export default class FieldsView extends Widget {
6
- constructor() {
7
- super(...arguments);
8
- this.view = {};
9
- this.register = this.register.bind(this);
10
- }
11
-
12
- register(fieldPath) {
13
- this.view[fieldPath] = true;
14
- console.table(this.view);
15
- }
16
-
17
- getChildContext() {
18
- return {
19
- model: this.props.model,
20
- register: this.register,
21
- };
22
- }
23
-
24
- static get childContextTypes() {
25
- return {
26
- model: PropTypes.string,
27
- register: PropTypes.func,
28
- };
29
- }
30
-
31
- render() {
32
- return <>{this.props.children}</>;
33
- }
34
- }
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Widget from 'goblin-laboratory/widgets/widget';
4
+
5
+ export default class FieldsView extends Widget {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.view = {};
9
+ this.register = this.register.bind(this);
10
+ }
11
+
12
+ register(fieldPath) {
13
+ this.view[fieldPath] = true;
14
+ console.table(this.view);
15
+ }
16
+
17
+ getChildContext() {
18
+ return {
19
+ model: this.props.model,
20
+ register: this.register,
21
+ };
22
+ }
23
+
24
+ static get childContextTypes() {
25
+ return {
26
+ model: PropTypes.string,
27
+ register: PropTypes.func,
28
+ };
29
+ }
30
+
31
+ render() {
32
+ return <>{this.props.children}</>;
33
+ }
34
+ }
@@ -1,79 +1,79 @@
1
- //T:2019-02-27
2
- import React from 'react';
3
-
4
- import Widget from 'goblin-laboratory/widgets/widget';
5
- import WithModel from '../with-model/widget';
6
-
7
- /******************************************************************************/
8
-
9
- // TODO: Adapt code that use it and remove it
10
- const FormComponent = (props) => {
11
- const {
12
- component: Component,
13
- model,
14
- children,
15
- validateOn,
16
- ...otherProps
17
- } = props;
18
- return (
19
- <WithModel model={model}>
20
- <Component {...otherProps}>{children}</Component>
21
- </WithModel>
22
- );
23
- };
24
-
25
- /******************************************************************************/
26
-
27
- class Form extends Widget {
28
- constructor() {
29
- super(...arguments);
30
- }
31
-
32
- get Form() {
33
- return FormComponent;
34
- }
35
-
36
- get formConfig() {
37
- const style = {
38
- display: 'flex',
39
- flexDirection: 'column',
40
- };
41
- const id = this.props.id ? this.props.id : this.context.id;
42
- return {
43
- component: 'div',
44
- validateOn: 'submit',
45
- model: `backend.${id}`,
46
- style,
47
- };
48
- }
49
-
50
- get formConfigWithoutStyle() {
51
- const id = this.props.id ? this.props.id : this.context.id;
52
- return {
53
- component: React.Fragment,
54
- validateOn: 'submit',
55
- model: `backend.${id}`,
56
- };
57
- }
58
-
59
- formConfigWithComponent(component) {
60
- // FIXME: use aphrodite
61
- const style = {
62
- display: 'flex',
63
- flexDirection: 'column',
64
- };
65
- const id = this.props.id ? this.props.id : this.context.id;
66
- return {
67
- component: component,
68
- validateOn: 'submit',
69
- model: `backend.${id}`,
70
- style,
71
- };
72
- }
73
-
74
- render() {
75
- return <div>Missing widget implementation</div>;
76
- }
77
- }
78
-
79
- export default Form;
1
+ //T:2019-02-27
2
+ import React from 'react';
3
+
4
+ import Widget from 'goblin-laboratory/widgets/widget';
5
+ import WithModel from '../with-model/widget';
6
+
7
+ /******************************************************************************/
8
+
9
+ // TODO: Adapt code that use it and remove it
10
+ const FormComponent = (props) => {
11
+ const {
12
+ component: Component,
13
+ model,
14
+ children,
15
+ validateOn,
16
+ ...otherProps
17
+ } = props;
18
+ return (
19
+ <WithModel model={model}>
20
+ <Component {...otherProps}>{children}</Component>
21
+ </WithModel>
22
+ );
23
+ };
24
+
25
+ /******************************************************************************/
26
+
27
+ class Form extends Widget {
28
+ constructor() {
29
+ super(...arguments);
30
+ }
31
+
32
+ get Form() {
33
+ return FormComponent;
34
+ }
35
+
36
+ get formConfig() {
37
+ const style = {
38
+ display: 'flex',
39
+ flexDirection: 'column',
40
+ };
41
+ const id = this.props.id ? this.props.id : this.context.id;
42
+ return {
43
+ component: 'div',
44
+ validateOn: 'submit',
45
+ model: `backend.${id}`,
46
+ style,
47
+ };
48
+ }
49
+
50
+ get formConfigWithoutStyle() {
51
+ const id = this.props.id ? this.props.id : this.context.id;
52
+ return {
53
+ component: React.Fragment,
54
+ validateOn: 'submit',
55
+ model: `backend.${id}`,
56
+ };
57
+ }
58
+
59
+ formConfigWithComponent(component) {
60
+ // FIXME: use aphrodite
61
+ const style = {
62
+ display: 'flex',
63
+ flexDirection: 'column',
64
+ };
65
+ const id = this.props.id ? this.props.id : this.context.id;
66
+ return {
67
+ component: component,
68
+ validateOn: 'submit',
69
+ model: `backend.${id}`,
70
+ style,
71
+ };
72
+ }
73
+
74
+ render() {
75
+ return <div>Missing widget implementation</div>;
76
+ }
77
+ }
78
+
79
+ export default Form;
@@ -1,47 +1,47 @@
1
- //T:2019-02-27
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
-
5
- import ThemeContext from '../theme-context/widget';
6
- import {Provider} from 'react-redux';
7
-
8
- class Frame extends React.PureComponent {
9
- getChildContext() {
10
- return {
11
- labId: this.props.labId,
12
- dispatch: this.props.store.dispatch,
13
- store: this.props.store,
14
- };
15
- }
16
-
17
- static get childContextTypes() {
18
- return {
19
- labId: PropTypes.string,
20
- dispatch: PropTypes.func,
21
- store: PropTypes.object,
22
- };
23
- }
24
-
25
- render() {
26
- const {labId, store, currentTheme, themeContext, desktopId} = this.props;
27
-
28
- return (
29
- <div
30
- className={`root-${labId.replace(/@/g, '-')}`}
31
- style={this.props.style}
32
- >
33
- <Provider store={store}>
34
- <ThemeContext
35
- labId={labId}
36
- themeContext={themeContext}
37
- currentTheme={currentTheme}
38
- >
39
- {this.props.children}
40
- </ThemeContext>
41
- </Provider>
42
- </div>
43
- );
44
- }
45
- }
46
-
47
- export default Frame;
1
+ //T:2019-02-27
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+
5
+ import ThemeContext from '../theme-context/widget';
6
+ import {Provider} from 'react-redux';
7
+
8
+ class Frame extends React.PureComponent {
9
+ getChildContext() {
10
+ return {
11
+ labId: this.props.labId,
12
+ dispatch: this.props.store.dispatch,
13
+ store: this.props.store,
14
+ };
15
+ }
16
+
17
+ static get childContextTypes() {
18
+ return {
19
+ labId: PropTypes.string,
20
+ dispatch: PropTypes.func,
21
+ store: PropTypes.object,
22
+ };
23
+ }
24
+
25
+ render() {
26
+ const {labId, store, currentTheme, themeContext, desktopId} = this.props;
27
+
28
+ return (
29
+ <div
30
+ className={`root-${labId.replace(/@/g, '-')}`}
31
+ style={this.props.style}
32
+ >
33
+ <Provider store={store}>
34
+ <ThemeContext
35
+ labId={labId}
36
+ themeContext={themeContext}
37
+ currentTheme={currentTheme}
38
+ >
39
+ {this.props.children}
40
+ </ThemeContext>
41
+ </Provider>
42
+ </div>
43
+ );
44
+ }
45
+ }
46
+
47
+ export default Frame;
@@ -1,18 +1,18 @@
1
- import Shredder from 'xcraft-core-shredder';
2
-
3
- const initialState = new Shredder({});
4
-
5
- export default (state = initialState, action = {}) => {
6
- switch (action.type) {
7
- case 'INIT': {
8
- if (state.equals(initialState) && action.initialState !== undefined) {
9
- return state.set('', action.initialState);
10
- }
11
- return state;
12
- }
13
- case 'CHANGE': {
14
- return state.set(action.path, action.newValue);
15
- }
16
- }
17
- return state;
18
- };
1
+ import Shredder from 'xcraft-core-shredder';
2
+
3
+ const initialState = new Shredder({});
4
+
5
+ export default (state = initialState, action = {}) => {
6
+ switch (action.type) {
7
+ case 'INIT': {
8
+ if (state.equals(initialState) && action.initialState !== undefined) {
9
+ return state.set('', action.initialState);
10
+ }
11
+ return state;
12
+ }
13
+ case 'CHANGE': {
14
+ return state.set(action.path, action.newValue);
15
+ }
16
+ }
17
+ return state;
18
+ };
@@ -1,15 +1,15 @@
1
- import React from 'react';
2
- import Widget from 'goblin-laboratory/widgets/widget';
3
- import WithModel from '../with-model/widget';
4
-
5
- export default class FrontendForm extends Widget {
6
- constructor() {
7
- super(...arguments);
8
- }
9
-
10
- render() {
11
- const path = `widgets.${this.props.widgetId}`;
12
-
13
- return <WithModel model={path}>{this.props.children}</WithModel>;
14
- }
15
- }
1
+ import React from 'react';
2
+ import Widget from 'goblin-laboratory/widgets/widget';
3
+ import WithModel from '../with-model/widget';
4
+
5
+ export default class FrontendForm extends Widget {
6
+ constructor() {
7
+ super(...arguments);
8
+ }
9
+
10
+ render() {
11
+ const path = `widgets.${this.props.widgetId}`;
12
+
13
+ return <WithModel model={path}>{this.props.children}</WithModel>;
14
+ }
15
+ }
@@ -1,14 +1,14 @@
1
- // prettier-ignore
2
- const defaultConfig = {
3
- 'tasks': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/tasks\.js$/),
4
- 'view': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/view\.js$/),
5
- 'partial': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/partial\.js$/),
6
- 'styles': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/styles\.js$/),
7
- 'widget': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/widget\.js$/),
8
- 'ui': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/ui\.js$/),
9
- 'reducer': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/reducer\.js$/),
10
- 'compensator': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/compensator\.js$/),
11
- 'theme-context': require.context('../../../../node_modules/', true, /\/widgets\/theme-context\/index\.js$/),
12
- };
13
-
14
- export default defaultConfig;
1
+ // prettier-ignore
2
+ const defaultConfig = {
3
+ 'tasks': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/tasks\.js$/),
4
+ 'view': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/view\.js$/),
5
+ 'partial': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/partial\.js$/),
6
+ 'styles': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/styles\.js$/),
7
+ 'widget': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/widget\.js$/),
8
+ 'ui': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/ui\.js$/),
9
+ 'reducer': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/reducer\.js$/),
10
+ 'compensator': require.context('../../../../node_modules/', true, /\/widgets\/[^/]+\/compensator\.js$/),
11
+ 'theme-context': require.context('../../../../node_modules/', true, /\/widgets\/theme-context\/index\.js$/),
12
+ };
13
+
14
+ export default defaultConfig;
@@ -1,53 +1,54 @@
1
- import path from 'path';
2
-
3
- export default function importer(config) {
4
- const cache = {};
5
-
6
- const importAll = (kind, r) => {
7
- cache[kind] = {};
8
-
9
- if (r) {
10
- const files = r.keys();
11
- files.forEach((file) => {
12
- let nameSpace;
13
- switch (kind) {
14
- case 'file':
15
- nameSpace = file.replace(/^[\\/.]+/, '').replace(/\\/g, '/');
16
- break;
17
- case 'theme-context':
18
- nameSpace = file.replace(/.*[\\/.]goblin-([^\\/]+).*/, '$1');
19
- break;
20
- default:
21
- nameSpace = path.basename(path.dirname(file));
22
- break;
23
- }
24
- cache[kind][nameSpace] = r(file);
25
- });
26
- }
27
- };
28
-
29
- const getter = (kind) => (name, key) => {
30
- if (!cache[kind][name]) {
31
- return null;
32
- }
33
- if (key) {
34
- return cache[kind][name][key];
35
- }
36
- return cache[kind][name].default ?? cache[kind][name];
37
- };
38
-
39
- return (kind) => {
40
- if (cache[kind]) {
41
- return getter(kind);
42
- }
43
-
44
- if (!(kind in config)) {
45
- throw new Error(`Unsupported kind: ${kind} for importer`);
46
- }
47
-
48
- const r = config[kind];
49
- importAll(kind, r);
50
-
51
- return getter(kind);
52
- };
53
- }
1
+ import path from 'path';
2
+
3
+ export default function importer(config) {
4
+ const cache = {};
5
+
6
+ const importAll = (kind, r) => {
7
+ cache[kind] = {};
8
+
9
+ if (r) {
10
+ const files = r.keys();
11
+ files.forEach((file) => {
12
+ let nameSpace;
13
+ switch (kind) {
14
+ case 'tutorials':
15
+ case 'file':
16
+ nameSpace = file.replace(/^[\\/.]+/, '').replace(/\\/g, '/');
17
+ break;
18
+ case 'theme-context':
19
+ nameSpace = file.replace(/.*[\\/.]goblin-([^\\/]+).*/, '$1');
20
+ break;
21
+ default:
22
+ nameSpace = path.basename(path.dirname(file));
23
+ break;
24
+ }
25
+ cache[kind][nameSpace] = r(file);
26
+ });
27
+ }
28
+ };
29
+
30
+ const getter = (kind) => (name, key) => {
31
+ if (!cache[kind][name]) {
32
+ return null;
33
+ }
34
+ if (key) {
35
+ return cache[kind][name][key];
36
+ }
37
+ return cache[kind][name].default ?? cache[kind][name];
38
+ };
39
+
40
+ return (kind) => {
41
+ if (cache[kind]) {
42
+ return getter(kind);
43
+ }
44
+
45
+ if (!(kind in config)) {
46
+ throw new Error(`Unsupported kind: ${kind} for importer`);
47
+ }
48
+
49
+ const r = config[kind];
50
+ importAll(kind, r);
51
+
52
+ return getter(kind);
53
+ };
54
+ }
@@ -1,4 +1,4 @@
1
- import importer from './importer.js';
2
- import defaultConfig from './default.js';
3
-
4
- export default importer(defaultConfig);
1
+ import importer from './importer.js';
2
+ import defaultConfig from './default.js';
3
+
4
+ export default importer(defaultConfig);