@instructure/ui-react-utils 8.8.1-snapshot.8 → 8.9.1
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 +10 -0
- package/es/windowMessageListener.js +2 -2
- package/lib/windowMessageListener.js +1 -1
- package/package.json +9 -10
- package/src/deprecated.ts +2 -3
- package/src/experimental.ts +1 -5
- package/src/hack.ts +26 -32
- package/src/windowMessageListener.ts +2 -3
- package/types/deprecated.d.ts.map +1 -1
- package/types/experimental.d.ts +1 -1
- package/types/experimental.d.ts.map +1 -1
- package/types/hack.d.ts +1 -1
- package/types/hack.d.ts.map +1 -1
- package/types/windowMessageListener.d.ts +3 -2
- package/types/windowMessageListener.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.9.1](https://github.com/instructure/instructure-ui/compare/v8.9.0...v8.9.1) (2021-09-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-react-utils
|
|
9
|
+
|
|
10
|
+
# [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
15
|
+
|
|
6
16
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @instructure/ui-react-utils
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { decorator } from '@instructure/ui-decorator';
|
|
25
25
|
import { ownerWindow } from '@instructure/ui-dom-utils';
|
|
26
|
-
|
|
27
26
|
/**
|
|
28
27
|
* ---
|
|
29
28
|
* category: utilities/react
|
|
@@ -33,10 +32,11 @@ import { ownerWindow } from '@instructure/ui-dom-utils';
|
|
|
33
32
|
*
|
|
34
33
|
* see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
35
34
|
* @module windowMessageListener
|
|
36
|
-
* @param {Function} messageHandler a handler for messages
|
|
35
|
+
* @param {Function} messageHandler a handler for messages receieved by the component
|
|
37
36
|
* @param {Function} validSource an optional function that would restrict message handling to a specified source.
|
|
38
37
|
* @returns {Function} a function that decorates a React component with the behavior
|
|
39
38
|
*/
|
|
39
|
+
|
|
40
40
|
const windowMessageListener = decorator((ComposedComponent, messageHandler, validSource) => {
|
|
41
41
|
var _class, _temp;
|
|
42
42
|
|
|
@@ -43,7 +43,7 @@ var _ownerWindow = require("@instructure/ui-dom-utils/lib/ownerWindow.js");
|
|
|
43
43
|
*
|
|
44
44
|
* see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
45
45
|
* @module windowMessageListener
|
|
46
|
-
* @param {Function} messageHandler a handler for messages
|
|
46
|
+
* @param {Function} messageHandler a handler for messages receieved by the component
|
|
47
47
|
* @param {Function} validSource an optional function that would restrict message handling to a specified source.
|
|
48
48
|
* @returns {Function} a function that decorates a React component with the behavior
|
|
49
49
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-react-utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.1",
|
|
4
4
|
"description": "A React utility library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.
|
|
27
|
-
"@instructure/ui-test-utils": "8.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.9.1",
|
|
27
|
+
"@instructure/ui-test-utils": "8.9.1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.13.10",
|
|
31
31
|
"@emotion/is-prop-valid": "^1",
|
|
32
|
-
"@instructure/console": "8.
|
|
33
|
-
"@instructure/shared-types": "8.
|
|
34
|
-
"@instructure/ui-decorator": "8.
|
|
35
|
-
"@instructure/ui-dom-utils": "8.
|
|
36
|
-
"@instructure/ui-utils": "8.
|
|
32
|
+
"@instructure/console": "8.9.1",
|
|
33
|
+
"@instructure/shared-types": "8.9.1",
|
|
34
|
+
"@instructure/ui-decorator": "8.9.1",
|
|
35
|
+
"@instructure/ui-dom-utils": "8.9.1",
|
|
36
|
+
"@instructure/ui-utils": "8.9.1",
|
|
37
37
|
"prop-types": "^15"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -43,6 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"sideEffects": false
|
|
47
|
-
"gitHead": "7b83164f4c5872f3a217e010563f59bf584ae4fc"
|
|
46
|
+
"sideEffects": false
|
|
48
47
|
}
|
package/src/deprecated.ts
CHANGED
|
@@ -48,7 +48,7 @@ const deprecated = (() => {
|
|
|
48
48
|
}
|
|
49
49
|
const deprecated = decorator(
|
|
50
50
|
(
|
|
51
|
-
ComposedComponent
|
|
51
|
+
ComposedComponent,
|
|
52
52
|
version: string,
|
|
53
53
|
oldProps?: Record<string, any>,
|
|
54
54
|
message = ''
|
|
@@ -216,8 +216,7 @@ const deprecated = (() => {
|
|
|
216
216
|
* @param {String} componentName the name of the component or Function.name of the utility function
|
|
217
217
|
* @param {String} message a message to display as a console error in DEV env when condition is false
|
|
218
218
|
*/
|
|
219
|
-
;(deprecated as DeprecatedDecorator).warnDeprecatedComponent =
|
|
220
|
-
warnDeprecatedComponent
|
|
219
|
+
;(deprecated as DeprecatedDecorator).warnDeprecatedComponent = warnDeprecatedComponent
|
|
221
220
|
|
|
222
221
|
/**
|
|
223
222
|
* ---
|
package/src/experimental.ts
CHANGED
|
@@ -29,11 +29,7 @@ const experimental =
|
|
|
29
29
|
process.env.NODE_ENV == 'production'
|
|
30
30
|
? () => (ReactComponent: ComponentClass<any>) => ReactComponent
|
|
31
31
|
: decorator(
|
|
32
|
-
(
|
|
33
|
-
ComposedComponent: ComponentClass<any>,
|
|
34
|
-
experimentalProps: string[],
|
|
35
|
-
message: string
|
|
36
|
-
) => {
|
|
32
|
+
(ComposedComponent, experimentalProps: string[], message: string) => {
|
|
37
33
|
return class ExperimentalComponent<
|
|
38
34
|
P,
|
|
39
35
|
S,
|
package/src/hack.ts
CHANGED
|
@@ -49,45 +49,39 @@ import { logWarn as warn } from '@instructure/console'
|
|
|
49
49
|
const hack =
|
|
50
50
|
process.env.NODE_ENV == 'production'
|
|
51
51
|
? () => (Component: React.ComponentClass<any>) => Component
|
|
52
|
-
: decorator(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.props,
|
|
64
|
-
hackProps,
|
|
65
|
-
message
|
|
66
|
-
)
|
|
67
|
-
}
|
|
52
|
+
: decorator((ComposedComponent, hackProps: string[], message: string) => {
|
|
53
|
+
return class HackComponent<P, S, SS> extends ComposedComponent {
|
|
54
|
+
componentDidMount() {
|
|
55
|
+
if (hackProps) {
|
|
56
|
+
warnHackProps(
|
|
57
|
+
ComposedComponent.name,
|
|
58
|
+
this.props,
|
|
59
|
+
hackProps,
|
|
60
|
+
message
|
|
61
|
+
)
|
|
62
|
+
}
|
|
68
63
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
64
|
+
if (super.componentDidMount) {
|
|
65
|
+
super.componentDidMount()
|
|
72
66
|
}
|
|
67
|
+
}
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
componentDidUpdate(prevProps: P, prevState: S, prevContext: SS) {
|
|
70
|
+
if (hackProps) {
|
|
71
|
+
warnHackProps(
|
|
72
|
+
ComposedComponent.name,
|
|
73
|
+
this.props,
|
|
74
|
+
hackProps,
|
|
75
|
+
message
|
|
76
|
+
)
|
|
77
|
+
}
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
79
|
+
if (super.componentDidUpdate) {
|
|
80
|
+
super.componentDidUpdate(prevProps, prevState, prevContext)
|
|
87
81
|
}
|
|
88
82
|
}
|
|
89
83
|
}
|
|
90
|
-
)
|
|
84
|
+
})
|
|
91
85
|
|
|
92
86
|
function warnHackProps(
|
|
93
87
|
name: string,
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { decorator } from '@instructure/ui-decorator'
|
|
25
25
|
import { ownerWindow } from '@instructure/ui-dom-utils'
|
|
26
|
-
import { ComponentClass } from 'react'
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
28
|
* ---
|
|
@@ -34,13 +33,13 @@ import { ComponentClass } from 'react'
|
|
|
34
33
|
*
|
|
35
34
|
* see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
36
35
|
* @module windowMessageListener
|
|
37
|
-
* @param {Function} messageHandler a handler for messages
|
|
36
|
+
* @param {Function} messageHandler a handler for messages receieved by the component
|
|
38
37
|
* @param {Function} validSource an optional function that would restrict message handling to a specified source.
|
|
39
38
|
* @returns {Function} a function that decorates a React component with the behavior
|
|
40
39
|
*/
|
|
41
40
|
const windowMessageListener = decorator(
|
|
42
41
|
(
|
|
43
|
-
ComposedComponent
|
|
42
|
+
ComposedComponent,
|
|
44
43
|
messageHandler: (data: any) => void,
|
|
45
44
|
validSource: string | (() => string)
|
|
46
45
|
) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../src/deprecated.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,mBAAmB;IAClC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAC1E,iBAAiB,EAAE,GAAG,KACnB,GAAG,CAAA;IACR,mBAAmB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,GAAG,IAAI,CAAA;IAC3E,mBAAmB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC7C,uBAAuB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACjD,qBAAqB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAA;CAClD;AAED,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../src/deprecated.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,mBAAmB;IAClC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAC1E,iBAAiB,EAAE,GAAG,KACnB,GAAG,CAAA;IACR,mBAAmB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,GAAG,IAAI,CAAA;IAC3E,mBAAmB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC7C,uBAAuB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACjD,qBAAqB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAA;CAClD;AAED,QAAA,MAAM,UAAU,qBAuMZ,CAAA;AAEJ,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
package/types/experimental.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentClass } from 'react';
|
|
2
|
-
declare const experimental: (
|
|
2
|
+
declare const experimental: (...args: unknown[]) => (ComposedComponent: ComponentClass<any, any>) => any;
|
|
3
3
|
export default experimental;
|
|
4
4
|
export {
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC,QAAA,MAAM,YAAY,8EAqDX,CAAA;AAuBP,eAAe,YAAY,CAAA;AAC3B,OAAO;AACL;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,YAAY,EACb,CAAA"}
|
package/types/hack.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @param {string} message
|
|
21
21
|
* @return {function} React component flagged as having hack props
|
|
22
22
|
*/
|
|
23
|
-
declare const hack: (
|
|
23
|
+
declare const hack: (...args: unknown[]) => (ComposedComponent: import("react").ComponentClass<any, any>) => any;
|
|
24
24
|
export default hack;
|
|
25
25
|
export {
|
|
26
26
|
/**
|
package/types/hack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hack.d.ts","sourceRoot":"","sources":["../src/hack.ts"],"names":[],"mappings":";AA2BA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"hack.d.ts","sourceRoot":"","sources":["../src/hack.ts"],"names":[],"mappings":";AA2BA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,8FAmCF,CAAA;AAgBR,eAAe,IAAI,CAAA;AACnB,OAAO;AACL;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAI,EACL,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/**
|
|
2
3
|
* ---
|
|
3
4
|
* category: utilities/react
|
|
@@ -7,11 +8,11 @@
|
|
|
7
8
|
*
|
|
8
9
|
* see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
9
10
|
* @module windowMessageListener
|
|
10
|
-
* @param {Function} messageHandler a handler for messages
|
|
11
|
+
* @param {Function} messageHandler a handler for messages receieved by the component
|
|
11
12
|
* @param {Function} validSource an optional function that would restrict message handling to a specified source.
|
|
12
13
|
* @returns {Function} a function that decorates a React component with the behavior
|
|
13
14
|
*/
|
|
14
|
-
declare const windowMessageListener: (...args:
|
|
15
|
+
declare const windowMessageListener: (...args: unknown[]) => (ComposedComponent: import("react").ComponentClass<any, any>) => any;
|
|
15
16
|
/**
|
|
16
17
|
* Return the origin of the owner window of the DOM element
|
|
17
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"windowMessageListener.d.ts","sourceRoot":"","sources":["../src/windowMessageListener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"windowMessageListener.d.ts","sourceRoot":"","sources":["../src/windowMessageListener.ts"],"names":[],"mappings":";AA0BA;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,qBAAqB,8FA+D1B,CAAA;AAED;;;;;;;GAOG;AACH,iBAAS,MAAM,CAAC,IAAI,EAAE,OAAO,UAc5B;AAED,eAAe,qBAAqB,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAA"}
|
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The MIT License (MIT)
|
|
3
|
-
category: Getting Started
|
|
4
|
-
order: 9
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# The MIT License (MIT)
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
-
|
|
11
|
-
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions.**
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|