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,47 +1,47 @@
1
- //T:2019-02-27
2
-
3
- import {connect} from 'react-redux';
4
- import Shredder from 'xcraft-core-shredder';
5
- import shallowEqualShredder from './shallowEqualShredder';
6
- import wrapMapStateToProps from './wrapMapStateToProps';
7
-
8
- function withShredder(mapStateToProps) {
9
- mapStateToProps = wrapMapStateToProps(mapStateToProps);
10
-
11
- const mapStateToPropsWithOwnProps = (state, ownProps) => {
12
- const s = new Shredder({
13
- backend: state.backend,
14
- widgets: state.widgets,
15
- network: state.network,
16
- });
17
- return mapStateToProps(s, ownProps);
18
- };
19
-
20
- const mapStateToPropsWithoutOwnProps = (state) => {
21
- return mapStateToPropsWithOwnProps(state);
22
- };
23
-
24
- return mapStateToProps.length > 1
25
- ? mapStateToPropsWithOwnProps
26
- : mapStateToPropsWithoutOwnProps;
27
- }
28
-
29
- export default function (
30
- mapStateToProps,
31
- mapDispatchToProps,
32
- mergeProps,
33
- options
34
- ) {
35
- return connect(
36
- withShredder(mapStateToProps),
37
- mapDispatchToProps,
38
- mergeProps,
39
- {
40
- pure: true,
41
- areOwnPropsEqual: shallowEqualShredder,
42
- areStatePropsEqual: shallowEqualShredder,
43
- areMergedPropsEqual: shallowEqualShredder,
44
- ...options,
45
- }
46
- );
47
- }
1
+ //T:2019-02-27
2
+
3
+ import {connect} from 'react-redux';
4
+ import Shredder from 'xcraft-core-shredder';
5
+ import shallowEqualShredder from './shallowEqualShredder';
6
+ import wrapMapStateToProps from './wrapMapStateToProps';
7
+
8
+ function withShredder(mapStateToProps) {
9
+ mapStateToProps = wrapMapStateToProps(mapStateToProps);
10
+
11
+ const mapStateToPropsWithOwnProps = (state, ownProps) => {
12
+ const s = new Shredder({
13
+ backend: state.backend,
14
+ widgets: state.widgets,
15
+ network: state.network,
16
+ });
17
+ return mapStateToProps(s, ownProps);
18
+ };
19
+
20
+ const mapStateToPropsWithoutOwnProps = (state) => {
21
+ return mapStateToPropsWithOwnProps(state);
22
+ };
23
+
24
+ return mapStateToProps.length > 1
25
+ ? mapStateToPropsWithOwnProps
26
+ : mapStateToPropsWithoutOwnProps;
27
+ }
28
+
29
+ export default function (
30
+ mapStateToProps,
31
+ mapDispatchToProps,
32
+ mergeProps,
33
+ options
34
+ ) {
35
+ return connect(
36
+ withShredder(mapStateToProps),
37
+ mapDispatchToProps,
38
+ mergeProps,
39
+ {
40
+ pure: true,
41
+ areOwnPropsEqual: shallowEqualShredder,
42
+ areStatePropsEqual: shallowEqualShredder,
43
+ areMergedPropsEqual: shallowEqualShredder,
44
+ ...options,
45
+ }
46
+ );
47
+ }
@@ -1,48 +1,48 @@
1
- //T:2019-02-27
2
-
3
- import React from 'react';
4
- import connect from './connect';
5
- import wrapMapStateToProps from './wrapMapStateToProps';
6
-
7
- function withBackendPath(mapStateToProps) {
8
- mapStateToProps = wrapMapStateToProps(mapStateToProps);
9
- return (state, ownProps) => {
10
- if (!ownProps.id) {
11
- throw new Error(
12
- 'Cannot connect backend state without an id. You must add a prop "id" to the connected component'
13
- );
14
- }
15
- const backendState = state.get(`backend.${ownProps.id}`);
16
- if (!backendState) {
17
- return {
18
- _loading: true,
19
- };
20
- }
21
- return mapStateToProps(backendState, ownProps);
22
- };
23
- }
24
-
25
- export default function (
26
- mapStateToProps,
27
- mapDispatchToProps,
28
- mergeProps,
29
- options
30
- ) {
31
- return (Comp) =>
32
- connect(
33
- withBackendPath(mapStateToProps),
34
- mapDispatchToProps,
35
- mergeProps,
36
- options
37
- )((props) => {
38
- if (props._loading) {
39
- if (Comp.LoadingComponent) {
40
- return <Comp.LoadingComponent />;
41
- } else {
42
- return null;
43
- }
44
- } else {
45
- return <Comp {...props} />;
46
- }
47
- });
48
- }
1
+ //T:2019-02-27
2
+
3
+ import React from 'react';
4
+ import connect from './connect';
5
+ import wrapMapStateToProps from './wrapMapStateToProps';
6
+
7
+ function withBackendPath(mapStateToProps) {
8
+ mapStateToProps = wrapMapStateToProps(mapStateToProps);
9
+ return (state, ownProps) => {
10
+ if (!ownProps.id) {
11
+ throw new Error(
12
+ 'Cannot connect backend state without an id. You must add a prop "id" to the connected component'
13
+ );
14
+ }
15
+ const backendState = state.get(`backend.${ownProps.id}`);
16
+ if (!backendState) {
17
+ return {
18
+ _loading: true,
19
+ };
20
+ }
21
+ return mapStateToProps(backendState, ownProps);
22
+ };
23
+ }
24
+
25
+ export default function (
26
+ mapStateToProps,
27
+ mapDispatchToProps,
28
+ mergeProps,
29
+ options
30
+ ) {
31
+ return (Comp) =>
32
+ connect(
33
+ withBackendPath(mapStateToProps),
34
+ mapDispatchToProps,
35
+ mergeProps,
36
+ options
37
+ )((props) => {
38
+ if (props._loading) {
39
+ if (Comp.LoadingComponent) {
40
+ return <Comp.LoadingComponent />;
41
+ } else {
42
+ return null;
43
+ }
44
+ } else {
45
+ return <Comp {...props} />;
46
+ }
47
+ });
48
+ }
@@ -1,31 +1,31 @@
1
- //T:2019-02-27
2
-
3
- import connect from './connect';
4
- import wrapMapStateToProps from './wrapMapStateToProps';
5
-
6
- function withWidgetPath(mapStateToProps) {
7
- mapStateToProps = wrapMapStateToProps(mapStateToProps);
8
- return (state, ownProps) => {
9
- const widgetId = ownProps.widgetId || ownProps.id;
10
- if (!widgetId) {
11
- throw new Error(
12
- 'Cannot connect widget state without an id. You must add a prop "widgetId" or "id" to the connected component'
13
- );
14
- }
15
- return mapStateToProps(state.get(`widgets.${widgetId}`), ownProps);
16
- };
17
- }
18
-
19
- export default function (
20
- mapStateToProps,
21
- mapDispatchToProps,
22
- mergeProps,
23
- options
24
- ) {
25
- return connect(
26
- withWidgetPath(mapStateToProps),
27
- mapDispatchToProps,
28
- mergeProps,
29
- options
30
- );
31
- }
1
+ //T:2019-02-27
2
+
3
+ import connect from './connect';
4
+ import wrapMapStateToProps from './wrapMapStateToProps';
5
+
6
+ function withWidgetPath(mapStateToProps) {
7
+ mapStateToProps = wrapMapStateToProps(mapStateToProps);
8
+ return (state, ownProps) => {
9
+ const widgetId = ownProps.widgetId || ownProps.id;
10
+ if (!widgetId) {
11
+ throw new Error(
12
+ 'Cannot connect widget state without an id. You must add a prop "widgetId" or "id" to the connected component'
13
+ );
14
+ }
15
+ return mapStateToProps(state.get(`widgets.${widgetId}`), ownProps);
16
+ };
17
+ }
18
+
19
+ export default function (
20
+ mapStateToProps,
21
+ mapDispatchToProps,
22
+ mergeProps,
23
+ options
24
+ ) {
25
+ return connect(
26
+ withWidgetPath(mapStateToProps),
27
+ mapDispatchToProps,
28
+ mergeProps,
29
+ options
30
+ );
31
+ }
@@ -1,134 +1,134 @@
1
- ------------------------------------------
2
- backend.toto@1
3
- ------------------------------------------
4
- id: toto@1
5
- collection: [tata@0,tat@1,tata@2]
6
- layout: 'modeX'
7
- ------------------------------------------
8
-
9
- ------------------------------------------
10
- widgets.toto@1
11
- ------------------------------------------
12
- id: toto@1
13
- extend: tata@0,
14
- selecteds: {tata@0: true,tat@1:false,tata@2:false}
15
- ------------------------------------------
16
-
17
- ------------------------------------------
18
- widgets.tata@0
19
- ------------------------------------------
20
- id: tata@0
21
- extend: true,
22
- selected: true
23
- ------------------------------------------
24
-
25
-
26
-
27
-
28
-
29
-
30
- class App
31
-
32
- render () {
33
- <Toto id={toto@1} />
34
- }
35
-
36
-
37
-
38
- widget.js
39
- export default ConnectBackend ((toto, ownProps) => return {
40
- collection: toto.get('collection')
41
- })(Toto);
42
- class Toto extend Widget
43
-
44
-
45
- static LoadingComponent (props) {
46
- return <j'attend la collection>
47
- }
48
-
49
- render () {
50
- this.props.collection.map (id => <Tata id={id} parent={props.id}/>)
51
- }
52
- }
53
-
54
-
55
- const TataWithBackend = ConnectBackend ((tata) => {
56
- return {
57
- info: tata.get('info')
58
- }
59
- })(Tata)
60
-
61
-
62
- export default ConnectParentWidget ((toto,ownProps) => return {
63
- extend: toto.extend === ownProps.id
64
- selected: toto.get ('selecteds.$(ownProps.id)')
65
- })(TataWithBackend)
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
- const getParentWidget = (state, props) =>
74
- state.get ('widgets.${props.parendId}')
75
-
76
-
77
- const selected = (state, props) =>
78
- state.get ('selected')
79
-
80
- const withSelectedInParent = createSelector(
81
- [ getParentInBackend, selected ],
82
- (parent,selected) => {
83
- return parent
84
- }
85
- )
86
-
87
-
88
- w
89
- state = {
90
- widgets: {
91
- parent : state.get ('widgets.${ownProps.parendId}')
92
- }
93
- }
94
-
95
- Connect ((state,ownProps) => {
96
- return {
97
- state.widgets.parent.
98
- state.backend.
99
-
100
-
101
- Connect ((state,props) => {
102
- return {
103
-
104
-
105
- extend: state.get ('widgets.${props.parendId}.extend') === ownProps.id,
106
- extend: getParentWidget(state, props,'extend') === ownProps.id,
107
- extend: getParentWidget(state, props, 'path') === ownProps.id,
108
- extend: state.widgets.parent.get('extend') === ownProps.id
109
- selected state.get ('widgets.${ownProps.parentId}).get ('selecteds.$(ownProps.id)'),
110
- selected: withSelectedInParent(state,props)
111
- mode: state.get ('backend.${ownProps.parentId}.layout),
112
- mode: getParentBackend(state,props,'layout')
113
- xxx: getBackend(state,props,'layout')
114
- yyy:getWidget (state,props,'xxxx)
115
- }
116
-
117
- return {
118
- extend: withWidget(state,ownProps,'extend') === ownProps.id
119
- }
120
- }
121
-
122
- const withBackend = expr => (state,ownProps) => withBackend (ownProps)(expr)
123
-
124
-
125
-
126
- ( Connect (withBackend((x) => x.extend === ownProps.id, 'extent').withWidget(...).withBackend()) )
127
-
128
-
129
- class Tata
130
-
131
- render () {
132
-
133
- this.props.info, this.props.extended
134
- }
1
+ ------------------------------------------
2
+ backend.toto@1
3
+ ------------------------------------------
4
+ id: toto@1
5
+ collection: [tata@0,tat@1,tata@2]
6
+ layout: 'modeX'
7
+ ------------------------------------------
8
+
9
+ ------------------------------------------
10
+ widgets.toto@1
11
+ ------------------------------------------
12
+ id: toto@1
13
+ extend: tata@0,
14
+ selecteds: {tata@0: true,tat@1:false,tata@2:false}
15
+ ------------------------------------------
16
+
17
+ ------------------------------------------
18
+ widgets.tata@0
19
+ ------------------------------------------
20
+ id: tata@0
21
+ extend: true,
22
+ selected: true
23
+ ------------------------------------------
24
+
25
+
26
+
27
+
28
+
29
+
30
+ class App
31
+
32
+ render () {
33
+ <Toto id={toto@1} />
34
+ }
35
+
36
+
37
+
38
+ widget.js
39
+ export default ConnectBackend ((toto, ownProps) => return {
40
+ collection: toto.get('collection')
41
+ })(Toto);
42
+ class Toto extend Widget
43
+
44
+
45
+ static LoadingComponent (props) {
46
+ return <j'attend la collection>
47
+ }
48
+
49
+ render () {
50
+ this.props.collection.map (id => <Tata id={id} parent={props.id}/>)
51
+ }
52
+ }
53
+
54
+
55
+ const TataWithBackend = ConnectBackend ((tata) => {
56
+ return {
57
+ info: tata.get('info')
58
+ }
59
+ })(Tata)
60
+
61
+
62
+ export default ConnectParentWidget ((toto,ownProps) => return {
63
+ extend: toto.extend === ownProps.id
64
+ selected: toto.get ('selecteds.$(ownProps.id)')
65
+ })(TataWithBackend)
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+ const getParentWidget = (state, props) =>
74
+ state.get ('widgets.${props.parendId}')
75
+
76
+
77
+ const selected = (state, props) =>
78
+ state.get ('selected')
79
+
80
+ const withSelectedInParent = createSelector(
81
+ [ getParentInBackend, selected ],
82
+ (parent,selected) => {
83
+ return parent
84
+ }
85
+ )
86
+
87
+
88
+ w
89
+ state = {
90
+ widgets: {
91
+ parent : state.get ('widgets.${ownProps.parendId}')
92
+ }
93
+ }
94
+
95
+ Connect ((state,ownProps) => {
96
+ return {
97
+ state.widgets.parent.
98
+ state.backend.
99
+
100
+
101
+ Connect ((state,props) => {
102
+ return {
103
+
104
+
105
+ extend: state.get ('widgets.${props.parendId}.extend') === ownProps.id,
106
+ extend: getParentWidget(state, props,'extend') === ownProps.id,
107
+ extend: getParentWidget(state, props, 'path') === ownProps.id,
108
+ extend: state.widgets.parent.get('extend') === ownProps.id
109
+ selected state.get ('widgets.${ownProps.parentId}).get ('selecteds.$(ownProps.id)'),
110
+ selected: withSelectedInParent(state,props)
111
+ mode: state.get ('backend.${ownProps.parentId}.layout),
112
+ mode: getParentBackend(state,props,'layout')
113
+ xxx: getBackend(state,props,'layout')
114
+ yyy:getWidget (state,props,'xxxx)
115
+ }
116
+
117
+ return {
118
+ extend: withWidget(state,ownProps,'extend') === ownProps.id
119
+ }
120
+ }
121
+
122
+ const withBackend = expr => (state,ownProps) => withBackend (ownProps)(expr)
123
+
124
+
125
+
126
+ ( Connect (withBackend((x) => x.extend === ownProps.id, 'extent').withWidget(...).withBackend()) )
127
+
128
+
129
+ class Tata
130
+
131
+ render () {
132
+
133
+ this.props.info, this.props.extended
134
+ }
@@ -1,36 +1,36 @@
1
- // See 'react-redux/src/utils/shallowEqual.js'
2
-
3
- const hasOwn = Object.prototype.hasOwnProperty;
4
-
5
- function is(x, y) {
6
- if (x && typeof x.equals === 'function') {
7
- return x.equals(y);
8
- }
9
- return Object.is(x, y);
10
- }
11
-
12
- export default function shallowEqualShredder(objA, objB) {
13
- if (is(objA, objB)) return true;
14
-
15
- if (
16
- typeof objA !== 'object' ||
17
- objA === null ||
18
- typeof objB !== 'object' ||
19
- objB === null
20
- ) {
21
- return false;
22
- }
23
-
24
- const keysA = Object.keys(objA);
25
- const keysB = Object.keys(objB);
26
-
27
- if (keysA.length !== keysB.length) return false;
28
-
29
- for (let i = 0; i < keysA.length; i++) {
30
- if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
31
- return false;
32
- }
33
- }
34
-
35
- return true;
36
- }
1
+ // See 'react-redux/src/utils/shallowEqual.js'
2
+
3
+ const hasOwn = Object.prototype.hasOwnProperty;
4
+
5
+ function is(x, y) {
6
+ if (x && typeof x.equals === 'function') {
7
+ return x.equals(y);
8
+ }
9
+ return Object.is(x, y);
10
+ }
11
+
12
+ export default function shallowEqualShredder(objA, objB) {
13
+ if (is(objA, objB)) return true;
14
+
15
+ if (
16
+ typeof objA !== 'object' ||
17
+ objA === null ||
18
+ typeof objB !== 'object' ||
19
+ objB === null
20
+ ) {
21
+ return false;
22
+ }
23
+
24
+ const keysA = Object.keys(objA);
25
+ const keysB = Object.keys(objB);
26
+
27
+ if (keysA.length !== keysB.length) return false;
28
+
29
+ for (let i = 0; i < keysA.length; i++) {
30
+ if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
31
+ return false;
32
+ }
33
+ }
34
+
35
+ return true;
36
+ }
@@ -1,21 +1,21 @@
1
- //T:2019-02-27
2
-
3
- export function collect() {
4
- return (dispatch, getState) => {
5
- const state = getState();
6
- const backendState = state.backend;
7
- const ids = state.widgets
8
- .keySeq()
9
- .filter((id) => {
10
- if (typeof id === 'string') {
11
- id = id.split('$')[0];
12
- }
13
- return id && !backendState.has(id);
14
- })
15
- .valueSeq()
16
- .toArray();
17
- if (ids.length > 0) {
18
- return dispatch({type: 'WIDGETS_COLLECT', ids});
19
- }
20
- };
21
- }
1
+ //T:2019-02-27
2
+
3
+ export function collect() {
4
+ return (dispatch, getState) => {
5
+ const state = getState();
6
+ const backendState = state.backend;
7
+ const ids = state.widgets
8
+ .keySeq()
9
+ .filter((id) => {
10
+ if (typeof id === 'string') {
11
+ id = id.split('$')[0];
12
+ }
13
+ return id && !backendState.has(id);
14
+ })
15
+ .valueSeq()
16
+ .toArray();
17
+ if (ids.length > 0) {
18
+ return dispatch({type: 'WIDGETS_COLLECT', ids});
19
+ }
20
+ };
21
+ }