@enact/core 3.4.9-experimental-3 → 3.4.9-experimental-7
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 +16 -0
- package/{build/dispatcher → dispatcher}/dispatcher.d.ts +0 -0
- package/dispatcher/dispatcher.js +76 -57
- package/dispatcher/listeners.js +31 -19
- package/dispatcher/tests/dispatcher-specs.js +75 -100
- package/{build/handle → handle}/handle.d.ts +0 -0
- package/handle/handle.js +260 -212
- package/handle/tests/handle-specs.js +476 -601
- package/{build/hoc → hoc}/hoc.d.ts +0 -0
- package/hoc/hoc.js +47 -33
- package/hoc/tests/hoc-specs.js +85 -126
- package/{build/index.d.ts → index.d.ts} +0 -0
- package/index.js +1 -0
- package/{build/internal → internal}/ApiDecorator/ApiDecorator.d.ts +0 -0
- package/internal/ApiDecorator/ApiDecorator.js +107 -61
- package/internal/ApiDecorator/tests/ApiDecorator-specs.js +106 -97
- package/{build/internal → internal}/Registry/Registry.d.ts +0 -0
- package/internal/Registry/Registry.js +68 -51
- package/internal/Registry/tests/Registry-specs.js +201 -143
- package/{build/internal → internal}/deprecate/deprecate.d.ts +0 -0
- package/internal/deprecate/deprecate.js +85 -60
- package/{build/internal → internal}/prop-types/prop-types.d.ts +0 -0
- package/internal/prop-types/prop-types.js +68 -61
- package/{build/keymap → keymap}/index.d.ts +0 -0
- package/keymap/index.js +27 -15
- package/keymap/keymap.js +67 -52
- package/keymap/tests/keymap-specs.js +75 -104
- package/kind/computed.js +29 -16
- package/{build/kind → kind}/kind.d.ts +0 -0
- package/kind/kind.js +150 -114
- package/kind/styles.js +62 -47
- package/kind/tests/computed-specs.js +87 -86
- package/kind/tests/kind-specs.js +216 -214
- package/kind/tests/styles-specs.js +170 -223
- package/kind/util.js +15 -7
- package/package.json +1 -1
- package/{build/platform → platform}/platform.d.ts +0 -0
- package/platform/platform.js +263 -169
- package/platform/tests/platform-specs.js +92 -90
- package/{build/snapshot → snapshot}/snapshot.d.ts +0 -0
- package/snapshot/snapshot.js +34 -27
- package/useChainRefs/tests/useChainRefs-specs.js +46 -30
- package/{build/useChainRefs → useChainRefs}/useChainRefs.d.ts +0 -0
- package/useChainRefs/useChainRefs.js +49 -29
- package/useClass/tests/useClass-specs.js +51 -46
- package/{build/useClass → useClass}/useClass.d.ts +0 -0
- package/useClass/useClass.js +27 -9
- package/useHandlers/Handlers.js +55 -30
- package/useHandlers/tests/useHandlers-specs.js +79 -95
- package/{build/useHandlers → useHandlers}/useHandlers.d.ts +0 -0
- package/useHandlers/useHandlers.js +18 -11
- package/util/Job.js +203 -241
- package/util/tests/Job-specs.js +216 -204
- package/util/tests/util-specs.js +123 -146
- package/{build/util → util}/util.d.ts +0 -0
- package/util/util.js +146 -103
- package/build/CHANGELOG.md +0 -699
- package/build/README.md +0 -33
- package/build/dispatcher/dispatcher.js +0 -160
- package/build/dispatcher/listeners.js +0 -37
- package/build/dispatcher/package.json +0 -3
- package/build/dispatcher/tests/dispatcher-specs.js +0 -75
- package/build/handle/handle.js +0 -846
- package/build/handle/package.json +0 -3
- package/build/handle/tests/handle-specs.js +0 -476
- package/build/hoc/hoc.js +0 -102
- package/build/hoc/package.json +0 -3
- package/build/hoc/tests/hoc-specs.js +0 -90
- package/build/index.js +0 -2
- package/build/internal/ApiDecorator/ApiDecorator.js +0 -143
- package/build/internal/ApiDecorator/package.json +0 -3
- package/build/internal/ApiDecorator/tests/ApiDecorator-specs.js +0 -106
- package/build/internal/Registry/Registry.js +0 -76
- package/build/internal/Registry/package.json +0 -3
- package/build/internal/Registry/tests/Registry-specs.js +0 -201
- package/build/internal/deprecate/deprecate.js +0 -116
- package/build/internal/deprecate/package.json +0 -3
- package/build/internal/prop-types/package.json +0 -3
- package/build/internal/prop-types/prop-types.js +0 -90
- package/build/keymap/index.js +0 -54
- package/build/keymap/keymap.js +0 -201
- package/build/keymap/package.json +0 -3
- package/build/keymap/tests/keymap-specs.js +0 -75
- package/build/kind/computed.js +0 -60
- package/build/kind/kind.js +0 -266
- package/build/kind/package.json +0 -3
- package/build/kind/styles.js +0 -105
- package/build/kind/tests/computed-specs.js +0 -87
- package/build/kind/tests/kind-specs.js +0 -216
- package/build/kind/tests/styles-specs.js +0 -170
- package/build/kind/util.js +0 -17
- package/build/package-lock.json +0 -206
- package/build/package.json +0 -38
- package/build/platform/package.json +0 -3
- package/build/platform/platform.js +0 -306
- package/build/platform/tests/platform-specs.js +0 -92
- package/build/snapshot/package.json +0 -3
- package/build/snapshot/snapshot.js +0 -89
- package/build/useChainRefs/package.json +0 -3
- package/build/useChainRefs/tests/useChainRefs-specs.js +0 -57
- package/build/useChainRefs/useChainRefs.js +0 -78
- package/build/useClass/package.json +0 -3
- package/build/useClass/tests/useClass-specs.js +0 -51
- package/build/useClass/useClass.js +0 -59
- package/build/useHandlers/Handlers.js +0 -55
- package/build/useHandlers/package.json +0 -3
- package/build/useHandlers/tests/useHandlers-specs.js +0 -84
- package/build/useHandlers/useHandlers.js +0 -36
- package/build/util/Job.js +0 -211
- package/build/util/package.json +0 -3
- package/build/util/tests/Job-specs.js +0 -216
- package/build/util/tests/util-specs.js +0 -123
- package/build/util/util.js +0 -322
|
@@ -1,97 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _enzyme = require("enzyme");
|
|
6
|
+
|
|
7
|
+
var _ApiDecorator = _interopRequireDefault(require("../ApiDecorator"));
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
|
|
13
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
14
|
+
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
16
|
+
|
|
17
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
|
+
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
+
|
|
21
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
22
|
+
|
|
23
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
24
|
+
|
|
25
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
26
|
+
|
|
27
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
28
|
+
|
|
29
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
|
+
|
|
31
|
+
describe('ApiDecorator', function () {
|
|
32
|
+
var _class, _temp;
|
|
33
|
+
|
|
34
|
+
var ApiProvider = (_temp = _class = /*#__PURE__*/function (_React$Component) {
|
|
35
|
+
_inherits(ApiProvider, _React$Component);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(ApiProvider);
|
|
38
|
+
|
|
39
|
+
function ApiProvider(props) {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
42
|
+
_classCallCheck(this, ApiProvider);
|
|
43
|
+
|
|
44
|
+
_this = _super.call(this); // eslint-disable-next-line
|
|
45
|
+
|
|
46
|
+
_this.arrowFunction = function () {
|
|
47
|
+
return 'arrow';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
_this.instanceProperty = 'property';
|
|
51
|
+
props.setApiProvider(_assertThisInitialized(_this));
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_createClass(ApiProvider, [{
|
|
56
|
+
key: "instanceFunction",
|
|
57
|
+
value: function instanceFunction() {
|
|
58
|
+
return 'instance';
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "render",
|
|
62
|
+
value: function render() {
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement("div", null);
|
|
64
|
+
}
|
|
65
|
+
}]);
|
|
66
|
+
|
|
67
|
+
return ApiProvider;
|
|
68
|
+
}(_react["default"].Component), _class.displayName = 'ApiProvider', _temp);
|
|
69
|
+
test('should invoke arrow function on wrapped component', function () {
|
|
70
|
+
var Component = (0, _ApiDecorator["default"])({
|
|
71
|
+
api: ['arrowFunction']
|
|
72
|
+
}, ApiProvider);
|
|
73
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
74
|
+
var expected = 'arrow';
|
|
75
|
+
var actual = subject.instance().arrowFunction();
|
|
76
|
+
expect(actual).toBe(expected);
|
|
77
|
+
});
|
|
78
|
+
test('should invoke instance function on wrapped component', function () {
|
|
79
|
+
var Component = (0, _ApiDecorator["default"])({
|
|
80
|
+
api: ['instanceFunction']
|
|
81
|
+
}, ApiProvider);
|
|
82
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
83
|
+
var expected = 'instance';
|
|
84
|
+
var actual = subject.instance().instanceFunction();
|
|
85
|
+
expect(actual).toBe(expected);
|
|
86
|
+
});
|
|
87
|
+
test('should get an instance property on wrapped component', function () {
|
|
88
|
+
var Component = (0, _ApiDecorator["default"])({
|
|
89
|
+
api: ['instanceProperty']
|
|
90
|
+
}, ApiProvider);
|
|
91
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
92
|
+
var expected = 'property';
|
|
93
|
+
var actual = subject.instance().instanceProperty;
|
|
94
|
+
expect(actual).toBe(expected);
|
|
95
|
+
});
|
|
96
|
+
test('should set an instance property on wrapped component', function () {
|
|
97
|
+
var Component = (0, _ApiDecorator["default"])({
|
|
98
|
+
api: ['instanceProperty']
|
|
99
|
+
}, ApiProvider);
|
|
100
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
101
|
+
subject.instance().instanceProperty = 'updated';
|
|
102
|
+
var expected = 'updated';
|
|
103
|
+
var actual = subject.instance().instanceProperty;
|
|
104
|
+
expect(actual).toBe(expected);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
File without changes
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Registry = exports["default"] = void 0;
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
9
|
* Allows components to register parents to cascade context changes and trigger functions
|
|
3
10
|
*
|
|
@@ -5,55 +12,65 @@
|
|
|
5
12
|
* @memberof core/Registry
|
|
6
13
|
* @private
|
|
7
14
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
notify (ev) {
|
|
36
|
-
if (handler) {
|
|
37
|
-
handler(ev, instance);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
unregister () {
|
|
41
|
-
const i = instances.indexOf(instance);
|
|
42
|
-
if (i >= 0) {
|
|
43
|
-
instances.splice(i, 1);
|
|
44
|
-
|
|
45
|
-
if (handler) {
|
|
46
|
-
handler({action: 'register'}, instance);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return registry;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
15
|
+
var Registry = {
|
|
16
|
+
create: function create(handler) {
|
|
17
|
+
var instances = [];
|
|
18
|
+
var currentParent;
|
|
19
|
+
var registry = Object.freeze({
|
|
20
|
+
set parent(register) {
|
|
21
|
+
if (currentParent && currentParent.unregister) {
|
|
22
|
+
currentParent.unregister();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (register && typeof register === 'function') {
|
|
26
|
+
currentParent = register(registry.notify);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
notify: function notify(ev) {
|
|
31
|
+
var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
instances.filter(exclude).forEach(function (f) {
|
|
35
|
+
return f(ev);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
register: function register(instance) {
|
|
39
|
+
if (instances.indexOf(instance) === -1) {
|
|
40
|
+
instances.push(instance);
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
if (handler) {
|
|
43
|
+
handler({
|
|
44
|
+
action: 'register'
|
|
45
|
+
}, instance);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
notify: function notify(ev) {
|
|
51
|
+
if (handler) {
|
|
52
|
+
handler(ev, instance);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
unregister: function unregister() {
|
|
56
|
+
var i = instances.indexOf(instance);
|
|
57
|
+
|
|
58
|
+
if (i >= 0) {
|
|
59
|
+
instances.splice(i, 1);
|
|
60
|
+
|
|
61
|
+
if (handler) {
|
|
62
|
+
handler({
|
|
63
|
+
action: 'register'
|
|
64
|
+
}, instance);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return registry;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.Registry = Registry;
|
|
75
|
+
var _default = Registry;
|
|
76
|
+
exports["default"] = _default;
|