@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.
Files changed (113) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/{build/dispatcher → dispatcher}/dispatcher.d.ts +0 -0
  3. package/dispatcher/dispatcher.js +76 -57
  4. package/dispatcher/listeners.js +31 -19
  5. package/dispatcher/tests/dispatcher-specs.js +75 -100
  6. package/{build/handle → handle}/handle.d.ts +0 -0
  7. package/handle/handle.js +260 -212
  8. package/handle/tests/handle-specs.js +476 -601
  9. package/{build/hoc → hoc}/hoc.d.ts +0 -0
  10. package/hoc/hoc.js +47 -33
  11. package/hoc/tests/hoc-specs.js +85 -126
  12. package/{build/index.d.ts → index.d.ts} +0 -0
  13. package/index.js +1 -0
  14. package/{build/internal → internal}/ApiDecorator/ApiDecorator.d.ts +0 -0
  15. package/internal/ApiDecorator/ApiDecorator.js +107 -61
  16. package/internal/ApiDecorator/tests/ApiDecorator-specs.js +106 -97
  17. package/{build/internal → internal}/Registry/Registry.d.ts +0 -0
  18. package/internal/Registry/Registry.js +68 -51
  19. package/internal/Registry/tests/Registry-specs.js +201 -143
  20. package/{build/internal → internal}/deprecate/deprecate.d.ts +0 -0
  21. package/internal/deprecate/deprecate.js +85 -60
  22. package/{build/internal → internal}/prop-types/prop-types.d.ts +0 -0
  23. package/internal/prop-types/prop-types.js +68 -61
  24. package/{build/keymap → keymap}/index.d.ts +0 -0
  25. package/keymap/index.js +27 -15
  26. package/keymap/keymap.js +67 -52
  27. package/keymap/tests/keymap-specs.js +75 -104
  28. package/kind/computed.js +29 -16
  29. package/{build/kind → kind}/kind.d.ts +0 -0
  30. package/kind/kind.js +150 -114
  31. package/kind/styles.js +62 -47
  32. package/kind/tests/computed-specs.js +87 -86
  33. package/kind/tests/kind-specs.js +216 -214
  34. package/kind/tests/styles-specs.js +170 -223
  35. package/kind/util.js +15 -7
  36. package/package.json +1 -1
  37. package/{build/platform → platform}/platform.d.ts +0 -0
  38. package/platform/platform.js +263 -169
  39. package/platform/tests/platform-specs.js +92 -90
  40. package/{build/snapshot → snapshot}/snapshot.d.ts +0 -0
  41. package/snapshot/snapshot.js +34 -27
  42. package/useChainRefs/tests/useChainRefs-specs.js +46 -30
  43. package/{build/useChainRefs → useChainRefs}/useChainRefs.d.ts +0 -0
  44. package/useChainRefs/useChainRefs.js +49 -29
  45. package/useClass/tests/useClass-specs.js +51 -46
  46. package/{build/useClass → useClass}/useClass.d.ts +0 -0
  47. package/useClass/useClass.js +27 -9
  48. package/useHandlers/Handlers.js +55 -30
  49. package/useHandlers/tests/useHandlers-specs.js +79 -95
  50. package/{build/useHandlers → useHandlers}/useHandlers.d.ts +0 -0
  51. package/useHandlers/useHandlers.js +18 -11
  52. package/util/Job.js +203 -241
  53. package/util/tests/Job-specs.js +216 -204
  54. package/util/tests/util-specs.js +123 -146
  55. package/{build/util → util}/util.d.ts +0 -0
  56. package/util/util.js +146 -103
  57. package/build/CHANGELOG.md +0 -699
  58. package/build/README.md +0 -33
  59. package/build/dispatcher/dispatcher.js +0 -160
  60. package/build/dispatcher/listeners.js +0 -37
  61. package/build/dispatcher/package.json +0 -3
  62. package/build/dispatcher/tests/dispatcher-specs.js +0 -75
  63. package/build/handle/handle.js +0 -846
  64. package/build/handle/package.json +0 -3
  65. package/build/handle/tests/handle-specs.js +0 -476
  66. package/build/hoc/hoc.js +0 -102
  67. package/build/hoc/package.json +0 -3
  68. package/build/hoc/tests/hoc-specs.js +0 -90
  69. package/build/index.js +0 -2
  70. package/build/internal/ApiDecorator/ApiDecorator.js +0 -143
  71. package/build/internal/ApiDecorator/package.json +0 -3
  72. package/build/internal/ApiDecorator/tests/ApiDecorator-specs.js +0 -106
  73. package/build/internal/Registry/Registry.js +0 -76
  74. package/build/internal/Registry/package.json +0 -3
  75. package/build/internal/Registry/tests/Registry-specs.js +0 -201
  76. package/build/internal/deprecate/deprecate.js +0 -116
  77. package/build/internal/deprecate/package.json +0 -3
  78. package/build/internal/prop-types/package.json +0 -3
  79. package/build/internal/prop-types/prop-types.js +0 -90
  80. package/build/keymap/index.js +0 -54
  81. package/build/keymap/keymap.js +0 -201
  82. package/build/keymap/package.json +0 -3
  83. package/build/keymap/tests/keymap-specs.js +0 -75
  84. package/build/kind/computed.js +0 -60
  85. package/build/kind/kind.js +0 -266
  86. package/build/kind/package.json +0 -3
  87. package/build/kind/styles.js +0 -105
  88. package/build/kind/tests/computed-specs.js +0 -87
  89. package/build/kind/tests/kind-specs.js +0 -216
  90. package/build/kind/tests/styles-specs.js +0 -170
  91. package/build/kind/util.js +0 -17
  92. package/build/package-lock.json +0 -206
  93. package/build/package.json +0 -38
  94. package/build/platform/package.json +0 -3
  95. package/build/platform/platform.js +0 -306
  96. package/build/platform/tests/platform-specs.js +0 -92
  97. package/build/snapshot/package.json +0 -3
  98. package/build/snapshot/snapshot.js +0 -89
  99. package/build/useChainRefs/package.json +0 -3
  100. package/build/useChainRefs/tests/useChainRefs-specs.js +0 -57
  101. package/build/useChainRefs/useChainRefs.js +0 -78
  102. package/build/useClass/package.json +0 -3
  103. package/build/useClass/tests/useClass-specs.js +0 -51
  104. package/build/useClass/useClass.js +0 -59
  105. package/build/useHandlers/Handlers.js +0 -55
  106. package/build/useHandlers/package.json +0 -3
  107. package/build/useHandlers/tests/useHandlers-specs.js +0 -84
  108. package/build/useHandlers/useHandlers.js +0 -36
  109. package/build/util/Job.js +0 -211
  110. package/build/util/package.json +0 -3
  111. package/build/util/tests/Job-specs.js +0 -216
  112. package/build/util/tests/util-specs.js +0 -123
  113. package/build/util/util.js +0 -322
@@ -1,97 +1,106 @@
1
- import React from 'react';
2
- import {mount} from 'enzyme';
3
- import ApiDecorator from '../ApiDecorator';
4
-
5
- describe('ApiDecorator', () => {
6
-
7
- const ApiProvider = class extends React.Component {
8
- static displayName = 'ApiProvider';
9
-
10
- constructor (props) {
11
- super();
12
-
13
- // eslint-disable-next-line
14
- props.setApiProvider(this);
15
- }
16
-
17
- arrowFunction = () => 'arrow';
18
-
19
- instanceFunction () {
20
- return 'instance';
21
- }
22
-
23
- instanceProperty = 'property';
24
-
25
- render () {
26
- return (
27
- <div />
28
- );
29
- }
30
- };
31
-
32
- test('should invoke arrow function on wrapped component', () => {
33
- const Component = ApiDecorator(
34
- {api: ['arrowFunction']},
35
- ApiProvider
36
- );
37
-
38
- const subject = mount(
39
- <Component />
40
- );
41
-
42
- const expected = 'arrow';
43
- const actual = subject.instance().arrowFunction();
44
-
45
- expect(actual).toBe(expected);
46
- });
47
-
48
- test('should invoke instance function on wrapped component', () => {
49
- const Component = ApiDecorator(
50
- {api: ['instanceFunction']},
51
- ApiProvider
52
- );
53
-
54
- const subject = mount(
55
- <Component />
56
- );
57
-
58
- const expected = 'instance';
59
- const actual = subject.instance().instanceFunction();
60
-
61
- expect(actual).toBe(expected);
62
- });
63
-
64
- test('should get an instance property on wrapped component', () => {
65
- const Component = ApiDecorator(
66
- {api: ['instanceProperty']},
67
- ApiProvider
68
- );
69
-
70
- const subject = mount(
71
- <Component />
72
- );
73
-
74
- const expected = 'property';
75
- const actual = subject.instance().instanceProperty;
76
-
77
- expect(actual).toBe(expected);
78
- });
79
-
80
- test('should set an instance property on wrapped component', () => {
81
- const Component = ApiDecorator(
82
- {api: ['instanceProperty']},
83
- ApiProvider
84
- );
85
-
86
- const subject = mount(
87
- <Component />
88
- );
89
-
90
- subject.instance().instanceProperty = 'updated';
91
-
92
- const expected = 'updated';
93
- const actual = subject.instance().instanceProperty;
94
-
95
- expect(actual).toBe(expected);
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
+ });
@@ -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
- const Registry = {
9
- create: (handler) => {
10
- const instances = [];
11
- let currentParent;
12
-
13
- const registry = Object.freeze({
14
- set parent (register) {
15
- if (currentParent && currentParent.unregister) {
16
- currentParent.unregister();
17
- }
18
- if (register && typeof register === 'function') {
19
- currentParent = register(registry.notify);
20
- }
21
- },
22
- notify (ev, exclude = () => true) {
23
- instances.filter(exclude).forEach(f => f(ev));
24
- },
25
- register (instance) {
26
- if (instances.indexOf(instance) === -1) {
27
- instances.push(instance);
28
-
29
- if (handler) {
30
- handler({action: 'register'}, instance);
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
- export default Registry;
59
- export {Registry};
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;