@instructure/ui-react-utils 8.25.1-snapshot-10 → 8.25.1-snapshot-15
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/CHANGELOG.md +1 -1
- package/es/ComponentIdentifier.js +15 -20
- package/es/windowMessageListener.js +15 -10
- package/lib/ComponentIdentifier.js +17 -22
- package/lib/windowMessageListener.js +15 -10
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-15](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-15) (2022-06-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-react-utils
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children"];
|
|
3
3
|
|
|
4
|
-
var _dec, _class;
|
|
4
|
+
var _dec, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -69,24 +69,7 @@ Abstract component identifier. Helpful for picking out a specific child.
|
|
|
69
69
|
@module ComponentIdentifier
|
|
70
70
|
**/
|
|
71
71
|
|
|
72
|
-
let ComponentIdentifier = (_dec = deprecated('8.0.0', void 0, 'This component will be removed in InstUI 9.0 since its not used.'), _dec(_class = class ComponentIdentifier extends Component {
|
|
73
|
-
static displayName = "ComponentIdentifier";
|
|
74
|
-
static propTypes = {
|
|
75
|
-
children: PropTypes.node
|
|
76
|
-
};
|
|
77
|
-
static defaultProps = {
|
|
78
|
-
children: null
|
|
79
|
-
};
|
|
80
|
-
static pick = (component, children) => {
|
|
81
|
-
let result;
|
|
82
|
-
React.Children.forEach(children, child => {
|
|
83
|
-
if (matchComponentTypes(child, [component])) {
|
|
84
|
-
result = child;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
return result;
|
|
88
|
-
};
|
|
89
|
-
|
|
72
|
+
let ComponentIdentifier = (_dec = deprecated('8.0.0', void 0, 'This component will be removed in InstUI 9.0 since its not used.'), _dec(_class = (_class2 = class ComponentIdentifier extends Component {
|
|
90
73
|
render() {
|
|
91
74
|
const _this$props = this.props,
|
|
92
75
|
children = _this$props.children,
|
|
@@ -95,7 +78,19 @@ let ComponentIdentifier = (_dec = deprecated('8.0.0', void 0, 'This component wi
|
|
|
95
78
|
return ensureSingleChild(children, props);
|
|
96
79
|
}
|
|
97
80
|
|
|
98
|
-
}
|
|
81
|
+
}, _class2.displayName = "ComponentIdentifier", _class2.propTypes = {
|
|
82
|
+
children: PropTypes.node
|
|
83
|
+
}, _class2.defaultProps = {
|
|
84
|
+
children: null
|
|
85
|
+
}, _class2.pick = (component, children) => {
|
|
86
|
+
let result;
|
|
87
|
+
React.Children.forEach(children, child => {
|
|
88
|
+
if (matchComponentTypes(child, [component])) {
|
|
89
|
+
result = child;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
}, _class2)) || _class);
|
|
99
94
|
export default ComponentIdentifier;
|
|
100
95
|
export {
|
|
101
96
|
/**
|
|
@@ -38,10 +38,18 @@ import { ownerWindow } from '@instructure/ui-dom-utils';
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
const windowMessageListener = decorator((ComposedComponent, messageHandler, validSource) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
var _class;
|
|
42
|
+
|
|
43
|
+
return _class = class extends ComposedComponent {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
|
|
47
|
+
this.handleMessage = e => {
|
|
48
|
+
if (this.sourceIsValid(e.source) && e.origin === origin(this) && e.data) {
|
|
49
|
+
messageHandler.call(this, e.data);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
45
53
|
|
|
46
54
|
componentDidMount() {
|
|
47
55
|
const win = ownerWindow(this);
|
|
@@ -75,12 +83,9 @@ const windowMessageListener = decorator((ComposedComponent, messageHandler, vali
|
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
};
|
|
86
|
+
}, _class.postMessage = function (target, message, origin) {
|
|
87
|
+
target.postMessage(message, origin);
|
|
88
|
+
}, _class;
|
|
84
89
|
});
|
|
85
90
|
/**
|
|
86
91
|
* Return the origin of the owner window of the DOM element
|
|
@@ -23,7 +23,7 @@ var _deprecated = _interopRequireDefault(require("./deprecated"));
|
|
|
23
23
|
|
|
24
24
|
const _excluded = ["children"];
|
|
25
25
|
|
|
26
|
-
var _dec, _class;
|
|
26
|
+
var _dec, _class, _class2;
|
|
27
27
|
|
|
28
28
|
// TODO delete this class, its not used anywhere, see livegrep
|
|
29
29
|
|
|
@@ -63,26 +63,7 @@ Abstract component identifier. Helpful for picking out a specific child.
|
|
|
63
63
|
```
|
|
64
64
|
@module ComponentIdentifier
|
|
65
65
|
**/
|
|
66
|
-
let ComponentIdentifier = (_dec = (0, _deprecated.default)('8.0.0', void 0, 'This component will be removed in InstUI 9.0 since its not used.'), _dec(_class = class ComponentIdentifier extends _react.Component {
|
|
67
|
-
static displayName = "ComponentIdentifier";
|
|
68
|
-
static propTypes = {
|
|
69
|
-
children: _propTypes.default.node
|
|
70
|
-
};
|
|
71
|
-
static defaultProps = {
|
|
72
|
-
children: null
|
|
73
|
-
};
|
|
74
|
-
static pick = (component, children) => {
|
|
75
|
-
let result;
|
|
76
|
-
|
|
77
|
-
_react.default.Children.forEach(children, child => {
|
|
78
|
-
if ((0, _matchComponentTypes.matchComponentTypes)(child, [component])) {
|
|
79
|
-
result = child;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return result;
|
|
84
|
-
};
|
|
85
|
-
|
|
66
|
+
let ComponentIdentifier = (_dec = (0, _deprecated.default)('8.0.0', void 0, 'This component will be removed in InstUI 9.0 since its not used.'), _dec(_class = (_class2 = class ComponentIdentifier extends _react.Component {
|
|
86
67
|
render() {
|
|
87
68
|
const _this$props = this.props,
|
|
88
69
|
children = _this$props.children,
|
|
@@ -90,7 +71,21 @@ let ComponentIdentifier = (_dec = (0, _deprecated.default)('8.0.0', void 0, 'Thi
|
|
|
90
71
|
return (0, _ensureSingleChild.ensureSingleChild)(children, props);
|
|
91
72
|
}
|
|
92
73
|
|
|
93
|
-
}
|
|
74
|
+
}, _class2.displayName = "ComponentIdentifier", _class2.propTypes = {
|
|
75
|
+
children: _propTypes.default.node
|
|
76
|
+
}, _class2.defaultProps = {
|
|
77
|
+
children: null
|
|
78
|
+
}, _class2.pick = (component, children) => {
|
|
79
|
+
let result;
|
|
80
|
+
|
|
81
|
+
_react.default.Children.forEach(children, child => {
|
|
82
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, [component])) {
|
|
83
|
+
result = child;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return result;
|
|
88
|
+
}, _class2)) || _class);
|
|
94
89
|
exports.ComponentIdentifier = ComponentIdentifier;
|
|
95
90
|
var _default = ComponentIdentifier;
|
|
96
91
|
exports.default = _default;
|
|
@@ -49,10 +49,18 @@ var _ownerWindow = require("@instructure/ui-dom-utils/lib/ownerWindow.js");
|
|
|
49
49
|
* @returns {Function} a function that decorates a React component with the behavior
|
|
50
50
|
*/
|
|
51
51
|
const windowMessageListener = (0, _decorator.decorator)((ComposedComponent, messageHandler, validSource) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
var _class;
|
|
53
|
+
|
|
54
|
+
return _class = class extends ComposedComponent {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
|
|
58
|
+
this.handleMessage = e => {
|
|
59
|
+
if (this.sourceIsValid(e.source) && e.origin === origin(this) && e.data) {
|
|
60
|
+
messageHandler.call(this, e.data);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
56
64
|
|
|
57
65
|
componentDidMount() {
|
|
58
66
|
const win = (0, _ownerWindow.ownerWindow)(this);
|
|
@@ -86,12 +94,9 @@ const windowMessageListener = (0, _decorator.decorator)((ComposedComponent, mess
|
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
96
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
};
|
|
97
|
+
}, _class.postMessage = function (target, message, origin) {
|
|
98
|
+
target.postMessage(message, origin);
|
|
99
|
+
}, _class;
|
|
95
100
|
});
|
|
96
101
|
/**
|
|
97
102
|
* Return the origin of the owner window of the DOM element
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-react-utils",
|
|
3
|
-
"version": "8.25.1-snapshot-
|
|
3
|
+
"version": "8.25.1-snapshot-15",
|
|
4
4
|
"description": "A React utility library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@instructure/ui-babel-preset": "8.25.1-snapshot-
|
|
26
|
-
"@instructure/ui-test-utils": "8.25.1-snapshot-
|
|
25
|
+
"@instructure/ui-babel-preset": "8.25.1-snapshot-15",
|
|
26
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-15"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.13.10",
|
|
30
30
|
"@emotion/is-prop-valid": "^1",
|
|
31
|
-
"@instructure/console": "8.25.1-snapshot-
|
|
32
|
-
"@instructure/shared-types": "8.25.1-snapshot-
|
|
33
|
-
"@instructure/ui-decorator": "8.25.1-snapshot-
|
|
34
|
-
"@instructure/ui-dom-utils": "8.25.1-snapshot-
|
|
35
|
-
"@instructure/ui-utils": "8.25.1-snapshot-
|
|
31
|
+
"@instructure/console": "8.25.1-snapshot-15",
|
|
32
|
+
"@instructure/shared-types": "8.25.1-snapshot-15",
|
|
33
|
+
"@instructure/ui-decorator": "8.25.1-snapshot-15",
|
|
34
|
+
"@instructure/ui-dom-utils": "8.25.1-snapshot-15",
|
|
35
|
+
"@instructure/ui-utils": "8.25.1-snapshot-15",
|
|
36
36
|
"hoist-non-react-statics": "^3.3.2",
|
|
37
37
|
"prop-types": "^15"
|
|
38
38
|
},
|