@instructure/ui-decorator 8.9.1-snapshot.0 → 8.9.2-snapshot.12
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 +4 -0
- package/README.md +0 -1
- package/es/decorator.js +3 -2
- package/lib/decorator.js +3 -2
- package/package.json +3 -3
- package/src/decorator.ts +10 -5
- package/types/decorator.d.ts +4 -3
- package/types/decorator.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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-decorator
|
|
9
|
+
|
|
6
10
|
# [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-decorator
|
package/README.md
CHANGED
package/es/decorator.js
CHANGED
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
* Wraps (decorates) a React component to add additional functionality
|
|
30
30
|
*
|
|
31
31
|
* @module decorator
|
|
32
|
-
* @param {Function}
|
|
33
|
-
* @returns {Class}
|
|
32
|
+
* @param {Function} decorate a function that returns a decorated component
|
|
33
|
+
* @returns {Class} A decorated component class
|
|
34
34
|
*/
|
|
35
35
|
function decorator(decorate) {
|
|
36
36
|
return (...args) => {
|
|
37
|
+
// parameters when the decorator is used
|
|
37
38
|
return ComposedComponent => {
|
|
38
39
|
if (typeof decorate === 'function') {
|
|
39
40
|
const displayName = ComposedComponent.displayName || ComposedComponent.name;
|
package/lib/decorator.js
CHANGED
|
@@ -37,11 +37,12 @@ exports.default = void 0;
|
|
|
37
37
|
* Wraps (decorates) a React component to add additional functionality
|
|
38
38
|
*
|
|
39
39
|
* @module decorator
|
|
40
|
-
* @param {Function}
|
|
41
|
-
* @returns {Class}
|
|
40
|
+
* @param {Function} decorate a function that returns a decorated component
|
|
41
|
+
* @returns {Class} A decorated component class
|
|
42
42
|
*/
|
|
43
43
|
function decorator(decorate) {
|
|
44
44
|
return (...args) => {
|
|
45
|
+
// parameters when the decorator is used
|
|
45
46
|
return ComposedComponent => {
|
|
46
47
|
if (typeof decorate === 'function') {
|
|
47
48
|
const displayName = ComposedComponent.displayName || ComposedComponent.name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-decorator",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.2-snapshot.12+6231ada93",
|
|
4
4
|
"description": "A utility to wrap (decorates) a React component class adding functionality.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.9.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.9.2-snapshot.12+6231ada93"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.13.10"
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "6231ada93bd4299d640b5d39d7e44b0f54852b2a"
|
|
35
35
|
}
|
package/src/decorator.ts
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import type { ComponentClass } from 'react'
|
|
26
|
+
|
|
25
27
|
/**
|
|
26
28
|
* ---
|
|
27
29
|
* category: utilities
|
|
@@ -29,12 +31,15 @@
|
|
|
29
31
|
* Wraps (decorates) a React component to add additional functionality
|
|
30
32
|
*
|
|
31
33
|
* @module decorator
|
|
32
|
-
* @param {Function}
|
|
33
|
-
* @returns {Class}
|
|
34
|
+
* @param {Function} decorate a function that returns a decorated component
|
|
35
|
+
* @returns {Class} A decorated component class
|
|
34
36
|
*/
|
|
35
|
-
function decorator(
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
function decorator(
|
|
38
|
+
decorate: (toDecorate: ComponentClass<any>, ...args: any[]) => any
|
|
39
|
+
) {
|
|
40
|
+
return (...args: unknown[]) => {
|
|
41
|
+
// parameters when the decorator is used
|
|
42
|
+
return (ComposedComponent: ComponentClass<any>) => {
|
|
38
43
|
if (typeof decorate === 'function') {
|
|
39
44
|
const displayName =
|
|
40
45
|
ComposedComponent.displayName || ComposedComponent.name
|
package/types/decorator.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ComponentClass } from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* ---
|
|
3
4
|
* category: utilities
|
|
@@ -5,10 +6,10 @@
|
|
|
5
6
|
* Wraps (decorates) a React component to add additional functionality
|
|
6
7
|
*
|
|
7
8
|
* @module decorator
|
|
8
|
-
* @param {Function}
|
|
9
|
-
* @returns {Class}
|
|
9
|
+
* @param {Function} decorate a function that returns a decorated component
|
|
10
|
+
* @returns {Class} A decorated component class
|
|
10
11
|
*/
|
|
11
|
-
declare function decorator(decorate: any): (...args:
|
|
12
|
+
declare function decorator(decorate: (toDecorate: ComponentClass<any>, ...args: any[]) => any): (...args: unknown[]) => (ComposedComponent: ComponentClass<any>) => any;
|
|
12
13
|
export default decorator;
|
|
13
14
|
export { decorator };
|
|
14
15
|
//# sourceMappingURL=decorator.d.ts.map
|
package/types/decorator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../src/decorator.ts"],"names":[],"mappings":"AAwBA;;;;;;;;;GASG;AACH,iBAAS,SAAS,
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../src/decorator.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C;;;;;;;;;GASG;AACH,iBAAS,SAAS,CAChB,QAAQ,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,aAEjD,OAAO,EAAE,yBAEG,eAAe,GAAG,CAAC,SAYjD;AACD,eAAe,SAAS,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,CAAA"}
|