@enact/core 4.6.1 → 4.7.0

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 (36) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +1 -1
  3. package/dispatcher/dispatcher.d.ts +21 -0
  4. package/handle/handle.d.ts +618 -0
  5. package/handle/handle.js +21 -21
  6. package/handle/tests/handle-specs.js +102 -1
  7. package/hoc/hoc.d.ts +43 -0
  8. package/hoc/tests/hoc-specs.js +3 -1
  9. package/index.d.ts +0 -0
  10. package/internal/ApiDecorator/ApiDecorator.d.ts +0 -0
  11. package/internal/ApiDecorator/ApiDecorator.js +10 -4
  12. package/internal/ApiDecorator/tests/ApiDecorator-specs.js +3 -1
  13. package/internal/Registry/Registry.d.ts +0 -0
  14. package/internal/Registry/tests/Registry-specs.js +4 -2
  15. package/internal/deprecate/deprecate.d.ts +0 -0
  16. package/internal/prop-types/prop-types.d.ts +0 -0
  17. package/internal/prop-types/tests/prop-types-specs.js +3 -1
  18. package/keymap/index.d.ts +37 -0
  19. package/kind/kind.d.ts +126 -0
  20. package/kind/kind.js +24 -15
  21. package/kind/tests/kind-specs.js +5 -3
  22. package/package.json +1 -1
  23. package/platform/platform.d.ts +45 -0
  24. package/platform/platform.js +18 -2
  25. package/platform/tests/platform-specs.js +10 -0
  26. package/snapshot/snapshot.d.ts +30 -0
  27. package/useChainRefs/tests/useChainRefs-specs.js +1 -1
  28. package/useChainRefs/useChainRefs.d.ts +0 -0
  29. package/useClass/tests/useClass-specs.js +3 -1
  30. package/useClass/useClass.d.ts +0 -0
  31. package/useHandlers/Handlers.js +3 -1
  32. package/useHandlers/tests/useHandlers-specs.js +3 -1
  33. package/useHandlers/useHandlers.d.ts +0 -0
  34. package/usePublicClassNames/usePublicClassNames.d.ts +0 -0
  35. package/util/Job.js +121 -1
  36. package/util/util.d.ts +162 -0
@@ -0,0 +1,45 @@
1
+ // Type definitions for core/platform
2
+
3
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
4
+ type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
5
+
6
+ export interface PlatformDescription {
7
+ /**
8
+ * Additional information about the detected platform
9
+ */
10
+ extra?: object
11
+ /**
12
+ * `true` if the platform has native double-finger events
13
+ */;
14
+ gesture: boolean
15
+ /**
16
+ * `true` only if `window` is `undefined`
17
+ */;
18
+ node: boolean
19
+ /**
20
+ * The name of the platform, if detected
21
+ */;
22
+ platformName?: string
23
+ /**
24
+ * `true` if the platform has native single-finger events
25
+ */;
26
+ touch: boolean
27
+ /**
28
+ * `true` if the platform has a touch screen
29
+ */;
30
+ touchscreen: boolean
31
+ /**
32
+ * `true` for any unknown system
33
+ */;
34
+ unknown: boolean;
35
+ }
36
+ /**
37
+ * Returns the object.
38
+ */
39
+ export function detect(): PlatformDescription;
40
+ /**
41
+ * Provides basic information about the running platform.
42
+ */
43
+ export declare const platform: PlatformDescription;
44
+
45
+ export default platform;
@@ -5,16 +5,26 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.platform = exports.parseUserAgent = exports.detect = exports["default"] = void 0;
7
7
  var _uniq = _interopRequireDefault(require("ramda/src/uniq"));
8
+ var _deprecate = _interopRequireDefault(require("../internal/deprecate"));
8
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
10
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
11
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
13
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
14
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
21
+ * Utilities for detecting basic platform capabilities.
22
+ *
23
+ * @module core/platform
24
+ * @exports detect
25
+ * @exports platform
26
+ * @public
27
+ */
18
28
  var hasGesture = function hasGesture() {
19
29
  return Boolean('ongesturestart' in window || 'onmsgesturestart' in window && (window.navigator.msMaxTouchPoints > 1 || window.navigator.maxTouchPoints > 1));
20
30
  };
@@ -236,6 +246,12 @@ var parseUserAgent = function parseUserAgent(userAgent) {
236
246
  break;
237
247
  }
238
248
  }
249
+ if (plat.platformName === 'windowsPhone') {
250
+ (0, _deprecate["default"])({
251
+ name: 'Windows Phone platform',
252
+ until: '5.0.0'
253
+ });
254
+ }
239
255
  return plat;
240
256
  };
241
257
 
@@ -106,6 +106,16 @@ describe('platform', function () {
106
106
  expect((0, _platform.parseUserAgent)(webOS2)).toMatchObject(expected);
107
107
  });
108
108
  });
109
+ describe('parseUserAgent for Windows Phone', function () {
110
+ var windowsPhone = 'Mozilla/5.0 (Windows Phone 8.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4103.84 Mobile Safari/537.36';
111
+ test('should return platformName `windowsPhone`', function () {
112
+ var expected = {
113
+ platformName: 'windowsPhone'
114
+ };
115
+ var actual = (0, _platform.parseUserAgent)(windowsPhone);
116
+ expect(actual).toMatchObject(expected);
117
+ });
118
+ });
109
119
  describe('parseUserAgent for User-Agent Reduction', function () {
110
120
  var testVersion = '113';
111
121
  var uaGenerator = function uaGenerator(unifiedPlatform) {
@@ -0,0 +1,30 @@
1
+ // Type definitions for core/snapshot
2
+
3
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
4
+ type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
5
+
6
+ /**
7
+ * Determines if the `window` is available
8
+ */
9
+ export function isWindowReady(): boolean;
10
+ /**
11
+ * Executes a callback, such as registering event handlers, when a valid `window` is available.
12
+ *
13
+ * During normal operation, the callback will be executed immediately. During a pre-rendering pass,
14
+ the callback is not be executed at all. When using snapshot, the callback is added to a queue
15
+ and is executed in order once the window is available.
16
+ *
17
+ * _Important Notes_
18
+ * * The callback should not alter the initial HTML state. If it does, it will invalidate the
19
+ pre-render state and interfere with React rehydration.
20
+ * * The callback should be limited to module-scoped actions and not component instance actions. If
21
+ the action is tied to a component, it should be invoked from within the component's lifecycle
22
+ methods.
23
+ */
24
+ export function onWindowReady(callback: Function): void;
25
+ /**
26
+ * Executes all queued window callbacks.
27
+ *
28
+ * Requires that the window be, in fact, available and will throw an `Error` if not.
29
+ */
30
+ export function windowReady(): void;
@@ -11,7 +11,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
11
11
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
12
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
13
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
15
  describe('useChainRefs', function () {
16
16
  function Component(props) {
17
17
  var ref = _useChainRefs["default"].apply(void 0, _toConsumableArray(props.refs));
File without changes
@@ -5,8 +5,10 @@ var _react = require("@testing-library/react");
5
5
  var _useClass = _interopRequireDefault(require("../useClass"));
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
8
- 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); } }
8
+ 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, _toPropertyKey(descriptor.key), descriptor); } }
9
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
12
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
13
  describe('useClass', function () {
12
14
  var Class = /*#__PURE__*/_createClass(function Class(arg) {
File without changes
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = exports.Handlers = void 0;
7
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
- 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); } }
8
+ 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, _toPropertyKey(descriptor.key), descriptor); } }
9
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
12
  var Handlers = /*#__PURE__*/function () {
11
13
  function Handlers(_handlers) {
12
14
  var _this = this;
@@ -7,7 +7,9 @@ var _jsxRuntime = require("react/jsx-runtime");
7
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
13
  describe('useHandlers', function () {
12
14
  var data = {};
13
15
  var context = {
File without changes
File without changes
package/util/Job.js CHANGED
@@ -7,8 +7,10 @@ exports["default"] = exports.Job = void 0;
7
7
  var _invariant = _interopRequireDefault(require("invariant"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
- 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); } }
10
+ 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, _toPropertyKey(descriptor.key), descriptor); } }
11
11
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
14
  /**
13
15
  * Provides a convenient way to manage timed execution of functions.
14
16
  *
@@ -161,6 +163,124 @@ var Job = /*#__PURE__*/function () {
161
163
  * @memberof core/util.Job.prototype
162
164
  * @public
163
165
  */
166
+
167
+ /**
168
+ * Starts the job in `timeout` milliseconds
169
+ *
170
+ * @method
171
+ * @param {Number} timeout The number of milliseconds to wait before starting the job.
172
+ * This supersedes the timeout set at construction.
173
+ * @param {...*} [args] Any args passed are forwarded to the callback
174
+ *
175
+ * @returns {undefined}
176
+ * @memberof core/util.Job.prototype
177
+ * @public
178
+ */
179
+
180
+ /**
181
+ * Stops the job.
182
+ *
183
+ * @method
184
+ *
185
+ * @returns {undefined}
186
+ * @memberof core/util.Job.prototype
187
+ * @public
188
+ */
189
+
190
+ /**
191
+ * Executes the job immediately, then prevents any other calls to `throttle()` from running
192
+ * until the `timeout` configured at construction passes.
193
+ *
194
+ * @method
195
+ * @param {...*} args Any args passed are forwarded to the callback
196
+ *
197
+ * @returns {undefined}
198
+ * @memberof core/util.Job.prototype
199
+ * @public
200
+ */
201
+
202
+ /**
203
+ * Executes the job immediately, then prevents any other calls to `throttle()` from running for
204
+ * `timeout` milliseconds.
205
+ *
206
+ * @method
207
+ * @param {Number} timeout The number of milliseconds to wait before allowing the job to
208
+ * be ran again. This supersedes the timeout set at construction.
209
+ * @param {...*} [args] Any args passed are forwarded to the callback
210
+ *
211
+ * @returns {undefined}
212
+ * @memberof core/util.Job.prototype
213
+ * @public
214
+ */
215
+
216
+ /**
217
+ * Executes job when the CPU is idle.
218
+ *
219
+ * @method
220
+ * @param {...*} [args] Any args passed are forwarded to the callback
221
+ *
222
+ * @returns {undefined}
223
+ * @memberof core/util.Job.prototype
224
+ * @public
225
+ */
226
+
227
+ /**
228
+ * Executes job when the CPU is idle, or when the timeout is reached, whichever occurs first.
229
+ *
230
+ * @method
231
+ * @param {Number} timeout The number of milliseconds to wait before executing the
232
+ * job. This guarantees that the job is run, if a positive value
233
+ * is specified.
234
+ * @param {...*} [args] Any args passed are forwarded to the callback
235
+ *
236
+ * @returns {undefined}
237
+ * @memberof core/util.Job.prototype
238
+ * @public
239
+ */
240
+
241
+ /**
242
+ * Executes job before the next repaint.
243
+ *
244
+ * @method
245
+ * @param {...*} [args] Any args passed are forwarded to the callback
246
+ *
247
+ * @returns {undefined}
248
+ * @memberof core/util.Job.prototype
249
+ * @public
250
+ */
251
+
252
+ /**
253
+ * Executes job before the next repaint after a given amount of timeout.
254
+ *
255
+ * @method
256
+ * @param {Number} timeout The number of milliseconds to wait before running `requestAnimationFrame`.
257
+ * @param {...*} [args] Any args passed are forwarded to the callback
258
+ *
259
+ * @returns {undefined}
260
+ * @memberof core/util.Job.prototype
261
+ * @public
262
+ */
263
+
264
+ /**
265
+ * Starts the job when `promise` resolves.
266
+ *
267
+ * The job execution is tied to the resolution of the last `Promise` passed. Like other methods
268
+ * on `Job`, calling `promise()` again with a new `Promise` will block execution of the job
269
+ * until that new `Promise` resolves. Any previous `Promise`s will still resolve normally but
270
+ * will not trigger job execution.
271
+ *
272
+ * Unlike other methods on `Job`, `promise()` returns a `Promise` which is the result of calling
273
+ * `then()` on the passed `promise`. That `Promise` resolves with either the result of job
274
+ * execution or `undefined` if `Promise` was superseded by a subsequent `Promise` passed as
275
+ * described above.
276
+ *
277
+ * @method
278
+ * @param {Promise} promise The promise that must resolve before the job is executed
279
+ *
280
+ * @returns {Promise}
281
+ * @memberof core/util.Job.prototype
282
+ * @public
283
+ */
164
284
  }]);
165
285
  return Job;
166
286
  }();
package/util/util.d.ts ADDED
@@ -0,0 +1,162 @@
1
+ // Type definitions for core/util
2
+
3
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
4
+ type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
5
+
6
+ /**
7
+ * Provides a convenient way to manage timed execution of functions.
8
+ */
9
+
10
+ export declare class Job {
11
+ constructor
12
+ /**
13
+ * Function to execute as the requested job.
14
+ */(
15
+ fn: Function
16
+ /**
17
+ * The number of milliseconds to wait before starting the job.
18
+ */,
19
+ timeout: number
20
+ );
21
+ /**
22
+ * Starts the job.
23
+ */
24
+ start(args?: any[]): void;
25
+ /**
26
+ * Starts the job in `timeout` milliseconds
27
+ */
28
+ startAfter(timeout: number, args?: any[]): void;
29
+ /**
30
+ * Stops the job.
31
+ */
32
+ stop(): void;
33
+ /**
34
+ * Executes the job immediately, then prevents any other calls to `throttle()` from running
35
+ until the `timeout` configured at construction passes.
36
+ */
37
+ throttle(...args: any[]): void;
38
+ /**
39
+ * Executes the job immediately, then prevents any other calls to `throttle()` from running for
40
+ `timeout` milliseconds.
41
+ */
42
+ throttleUntil(timeout: number, args?: any[]): void;
43
+ /**
44
+ * Executes job when the CPU is idle.
45
+ */
46
+ idle(args?: any[]): void;
47
+ /**
48
+ * Executes job when the CPU is idle, or when the timeout is reached, whichever occurs first.
49
+ */
50
+ idleUntil(timeout: number, args?: any[]): void;
51
+ /**
52
+ * Executes job before the next repaint.
53
+ */
54
+ startRaf(args?: any[]): void;
55
+ /**
56
+ * Executes job before the next repaint after a given amount of timeout.
57
+ */
58
+ startRafAfter(timeout: number, args?: any[]): void;
59
+ /**
60
+ * Starts the job when `promise` resolves.
61
+ *
62
+ * The job execution is tied to the resolution of the last `Promise` passed. Like other methods
63
+ on `Job` , calling `promise()` again with a new `Promise` will block execution of the job
64
+ until that new `Promise` resolves. Any previous `Promise` s will still resolve normally but
65
+ will not trigger job execution.
66
+ *
67
+ * Unlike other methods on `Job` , `promise()` returns a `Promise` which is the result of calling
68
+ `then()` on the passed `promise` . That `Promise` resolves with either the result of job
69
+ execution or `undefined` if `Promise` was superseded by a subsequent `Promise` passed as
70
+ described above.
71
+ */
72
+ promise(promise: Promise): Promise;
73
+ }
74
+
75
+ /**
76
+ * Capitalizes a given string (not locale-aware).
77
+ */
78
+ export function cap(str: string): string;
79
+ /**
80
+ * Limits `value` to be between `min` and `max` .
81
+ *
82
+ * If `min` is greater than `max` , `min` is returned.
83
+ */
84
+ export function clamp(min: number, max: number, value: number): number;
85
+ /**
86
+ * If `arg` is a function, return it. Otherwise returns a function that returns `arg` .
87
+ *
88
+ * Example:
89
+ * ```
90
+ const returnsZero = coerceFunction(0);
91
+ const returnsArg = coerceFunction(() => 0);
92
+ ```
93
+ */
94
+ export function coerceFunction(arg: any): Function;
95
+ /**
96
+ * If `arg` is array-like, return it. Otherwise returns a single element array containing `arg` .
97
+ *
98
+ * Example:
99
+ * ```
100
+ const returnsArray = coerceArray(0); // [0]
101
+ const returnsArg = coerceArray([0]); // [0]
102
+ const returnsObjArg = coerceArray({0: 'zeroth', length: 1});
103
+ ```
104
+ */
105
+ export function coerceArray(array: any): Array<any>;
106
+ /**
107
+ * Loosely determines if `tag` is a renderable component (either a string or a function).
108
+ */
109
+ export function isRenderable(tag: any): boolean;
110
+ /**
111
+ * Removes ARIA-related props from `props` and returns them in a new object.
112
+ *
113
+ * Specifically, it removes the `role` prop and any prop prefixed with `aria-` . This is useful when
114
+ redirecting ARIA-related props from a non-focusable root element to a focusable child element.
115
+ */
116
+ export function extractAriaProps(props: object): object;
117
+ /**
118
+ * Gets the current timestamp of either `window.performance.now` or `Date.now`
119
+ */
120
+ export function perfNow(): number;
121
+ /**
122
+ * Merges two class name maps into one.
123
+ *
124
+ * The resulting map will only contain the class names defined in the `baseMap` and will be appended
125
+ with the value from `additiveMap` if it exists. Further, `allowedClassNames` may optionally limit
126
+ which keys will be merged from `additiveMap` into `baseMap` .
127
+ *
128
+ * Example:
129
+ * ```
130
+ // merges all matching class names from additiveMap1 with baseMap1
131
+ const newMap1 = mergeClassNameMaps(baseMap1, additiveMap1);
132
+
133
+ // merge only 'a' and 'b' class names from additiveMap2 with baseMap2
134
+ const newMap2 = mergeClassNameMaps(baseMap2, additiveMap2, ['a', 'b']);
135
+ ```
136
+ */
137
+ export function mergeClassNameMaps(
138
+ baseMap: object,
139
+ additiveMap: object,
140
+ allowedClassNames?: string[]
141
+ ): object;
142
+ /**
143
+ * Creates a function that memoizes the result of `fn` .
144
+ *
145
+ * Note that this function is a naive implementation and only checks the first argument for
146
+ memoization.
147
+ */
148
+ export function memoize(fn: Function): Function;
149
+ /**
150
+ * Maps over the `children` , discarding any `null` children before and after calling the callback.
151
+ *
152
+ * A replacement for `React.Children.map` .
153
+ */
154
+ export function mapAndFilterChildren(
155
+ children: any,
156
+ callback: Function,
157
+ filter?: Function
158
+ ): any;
159
+ /**
160
+ * Performs shallow comparison for given objects.
161
+ */
162
+ export function shallowEqual(a: Obejct, b: Obejct): boolean;