goblin-laboratory 4.3.0 → 4.5.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 +2 -2
- package/widgets/store/widgets-reducer.js +1 -3
- package/widgets/widget/index.js +5 -5
- package/widgets/widget/style/build-style.js +3 -3
- package/widgets/widget/style/compute-style-hash.js +2 -2
- package/widgets/widget/utils/shallowEqualShredder.js +6 -3
- package/widgets/with-model/widget.js +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goblin-laboratory",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"description": "Laboratory",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"aphrodite": "^2.2.2",
|
|
24
24
|
"connected-react-router": "^6.3.2",
|
|
25
25
|
"css-key": "^1.0.0",
|
|
26
|
-
"faster-stable-stringify": "^1.0.0",
|
|
27
26
|
"@fortawesome/react-fontawesome": "^0.1.9",
|
|
28
27
|
"history": "^4.6.1",
|
|
29
28
|
"immutable": "4.0.0-rc.14",
|
|
@@ -36,6 +35,7 @@
|
|
|
36
35
|
"react-redux": "^7.1.0",
|
|
37
36
|
"react-router": "^5.0.0",
|
|
38
37
|
"redux-thunk": "^2.3.0",
|
|
38
|
+
"safe-stable-stringify": "^2.5.0",
|
|
39
39
|
"xcraft-core-shredder": "^5.3.0",
|
|
40
40
|
"xcraft-dev-prettier": "^2.0.0",
|
|
41
41
|
"xcraft-dev-rules": "^4.4.2",
|
package/widgets/widget/index.js
CHANGED
|
@@ -28,10 +28,6 @@ const throttle250 = _.throttle((fct) => fct(), 250);
|
|
|
28
28
|
// );
|
|
29
29
|
// }
|
|
30
30
|
|
|
31
|
-
function getWidgetName(constructorName) {
|
|
32
|
-
return constructorName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
31
|
class Widget extends React.Component {
|
|
36
32
|
constructor() {
|
|
37
33
|
super(...arguments);
|
|
@@ -47,6 +43,10 @@ class Widget extends React.Component {
|
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
|
|
46
|
+
static getWidgetName(constructorName) {
|
|
47
|
+
return constructorName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
50
|
_getInheritedNames() {
|
|
51
51
|
let p = this;
|
|
52
52
|
const names = new Set();
|
|
@@ -55,7 +55,7 @@ class Widget extends React.Component {
|
|
|
55
55
|
if (constructorName === 'Widget') {
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
|
-
const widgetName = getWidgetName(constructorName);
|
|
58
|
+
const widgetName = Widget.getWidgetName(constructorName);
|
|
59
59
|
names.add(widgetName);
|
|
60
60
|
}
|
|
61
61
|
return [...names];
|
|
@@ -17,10 +17,10 @@ const {StyleSheet, css} = Aphrodite.extend([
|
|
|
17
17
|
const nestedTags = [];
|
|
18
18
|
const selectors = selector.split(',');
|
|
19
19
|
_.each(selectors, (subselector, key) => {
|
|
20
|
-
if (
|
|
21
|
-
const tag =
|
|
20
|
+
if (subselector.includes('&')) {
|
|
21
|
+
const tag = subselector.replace(/&/g, baseSelector);
|
|
22
22
|
const nestedTag = generateSubtreeStyles(
|
|
23
|
-
`${
|
|
23
|
+
`${tag}`.replace(/ +(?= )/g, '')
|
|
24
24
|
);
|
|
25
25
|
nestedTags.push(nestedTag);
|
|
26
26
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import safeStringify from 'safe-stable-stringify';
|
|
2
2
|
|
|
3
3
|
export default function computeStyleHash(myStyle, theme, styleProps) {
|
|
4
4
|
let hashProps = '';
|
|
5
5
|
if (myStyle.hasPropsParam) {
|
|
6
|
-
hashProps =
|
|
6
|
+
hashProps = safeStringify(styleProps);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
let hashTheme = '';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
export function isEqual(x, y) {
|
|
6
6
|
if (x && typeof x.equals === 'function') {
|
|
7
7
|
return x.equals(y);
|
|
8
8
|
}
|
|
@@ -10,7 +10,7 @@ function is(x, y) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export default function shallowEqualShredder(objA, objB) {
|
|
13
|
-
if (
|
|
13
|
+
if (isEqual(objA, objB)) return true;
|
|
14
14
|
|
|
15
15
|
if (
|
|
16
16
|
typeof objA !== 'object' ||
|
|
@@ -27,7 +27,10 @@ export default function shallowEqualShredder(objA, objB) {
|
|
|
27
27
|
if (keysA.length !== keysB.length) return false;
|
|
28
28
|
|
|
29
29
|
for (let i = 0; i < keysA.length; i++) {
|
|
30
|
-
if (
|
|
30
|
+
if (
|
|
31
|
+
!hasOwn.call(objB, keysA[i]) ||
|
|
32
|
+
!isEqual(objA[keysA[i]], objB[keysA[i]])
|
|
33
|
+
) {
|
|
31
34
|
return false;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -3,8 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import Widget from 'goblin-laboratory/widgets/widget';
|
|
4
4
|
import joinModels from '../connect-helpers/join-models';
|
|
5
5
|
import ModelContext from './context';
|
|
6
|
+
import withC from '../connect-helpers/with-c.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
class WithModelNC extends Widget {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
10
11
|
}
|
|
@@ -40,3 +41,7 @@ export default class WithModel extends Widget {
|
|
|
40
41
|
);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
const WithModel = withC(WithModelNC);
|
|
46
|
+
|
|
47
|
+
export default WithModel;
|