@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
package/handle/handle.js CHANGED
@@ -1,3 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.stopImmediate = exports.stop = exports.returnsTrue = exports.preventDefault = exports.oneOf = exports.not = exports.log = exports.handle = exports.forProp = exports.forKeyCode = exports.forKey = exports.forEventProp = exports.forwardWithPrevent = exports.forwardCustom = exports.forward = exports.callOnEvent = exports.call = exports.adaptEvent = exports["default"] = void 0;
7
+
8
+ var _cond = _interopRequireDefault(require("ramda/src/cond"));
9
+
10
+ var _curry = _interopRequireDefault(require("ramda/src/curry"));
11
+
12
+ var _keymap = require("../keymap");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
1
16
  /**
2
17
  * `core/handle` provides a set of utilities to support handling events for `kind()`s and
3
18
  * `React.Component`s. The default export, `handle()`, generates an event handler function from a
@@ -77,11 +92,6 @@
77
92
  * @exports stopImmediate
78
93
  */
79
94
 
80
- import cond from 'ramda/src/cond';
81
- import curry from 'ramda/src/curry';
82
-
83
- import {is} from '../keymap';
84
-
85
95
  /**
86
96
  * The signature for event handlers
87
97
  *
@@ -110,67 +120,72 @@ import {is} from '../keymap';
110
120
  * @param {Object<string, any>} context
111
121
  * @returns {any}
112
122
  */
113
-
114
123
  // Accepts an array of handlers, sanitizes them, and returns a handler function
115
124
  // compose(allPass, map(makeSafeHandler));
116
- const makeHandler = (handlers) => {
117
- // allowing shadowing here to provide a meaningful function name in dev tools
118
- // eslint-disable-next-line no-shadow
119
- return function handle (...args) {
120
- for (let i = 0; i < handlers.length; i++) {
121
- const fn = handlers[i];
122
- if (typeof fn !== 'function' || fn.apply(this, args)) {
123
- continue;
124
- }
125
-
126
- return false;
127
- }
128
-
129
- return true;
130
- };
125
+ var makeHandler = function makeHandler(handlers) {
126
+ // allowing shadowing here to provide a meaningful function name in dev tools
127
+ // eslint-disable-next-line no-shadow
128
+ return function handle() {
129
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
130
+ args[_key] = arguments[_key];
131
+ }
132
+
133
+ for (var i = 0; i < handlers.length; i++) {
134
+ var fn = handlers[i];
135
+
136
+ if (typeof fn !== 'function' || fn.apply(this, args)) {
137
+ continue;
138
+ }
139
+
140
+ return false;
141
+ }
142
+
143
+ return true;
144
+ };
145
+ }; // Loose check to determine if obj is component-ish if it has both props and context members
146
+
147
+
148
+ var hasPropsAndContext = function hasPropsAndContext(obj) {
149
+ return obj && Object.prototype.hasOwnProperty.call(obj, 'props') && Object.prototype.hasOwnProperty.call(obj, 'context');
131
150
  };
132
151
 
133
- // Loose check to determine if obj is component-ish if it has both props and context members
134
- const hasPropsAndContext = (obj) => (
135
- obj &&
136
- Object.prototype.hasOwnProperty.call(obj, 'props') &&
137
- Object.prototype.hasOwnProperty.call(obj, 'context')
138
- );
139
-
140
- const named = (fn, name) => {
141
- if (__DEV__) {
142
- try {
143
- Object.defineProperty(fn, 'name', {
144
- value: name,
145
- writeable: false,
146
- enumerable: false
147
- });
148
- } catch (err) {
149
- // unable to set name of function
150
- }
151
- }
152
-
153
- return fn;
152
+ var named = function named(fn, name) {
153
+ if (process.env.NODE_ENV !== "production") {
154
+ try {
155
+ Object.defineProperty(fn, 'name', {
156
+ value: name,
157
+ writeable: false,
158
+ enumerable: false
159
+ });
160
+ } catch (err) {// unable to set name of function
161
+ }
162
+ }
163
+
164
+ return fn;
154
165
  };
155
166
 
156
- const bindAs = (fn, obj, name) => {
157
- const namedFunction = name ? named(fn, name) : fn;
158
- const bound = namedFunction.bind(obj);
167
+ var bindAs = function bindAs(fn, obj, name) {
168
+ var namedFunction = name ? named(fn, name) : fn;
169
+ var bound = namedFunction.bind(obj);
159
170
 
160
- if (name) {
161
- obj[name] = bound;
162
- }
171
+ if (name) {
172
+ obj[name] = bound;
173
+ }
163
174
 
164
- return bound;
175
+ return bound;
165
176
  };
166
177
 
167
- const decorateHandleFunction = (fn) => {
168
- fn.named = (name) => named(fn, name);
169
- fn.bindAs = (obj, name) => bindAs(fn, obj, name);
178
+ var decorateHandleFunction = function decorateHandleFunction(fn) {
179
+ fn.named = function (name) {
180
+ return named(fn, name);
181
+ };
170
182
 
171
- return fn;
172
- };
183
+ fn.bindAs = function (obj, name) {
184
+ return bindAs(fn, obj, name);
185
+ };
173
186
 
187
+ return fn;
188
+ };
174
189
  /**
175
190
  * Allows generating event handlers by chaining input functions to filter or short-circuit the
176
191
  * handling flow. Any input function that returns a falsy value will stop the chain.
@@ -187,54 +202,57 @@ const decorateHandleFunction = (fn) => {
187
202
  * @memberof core/handle
188
203
  * @public
189
204
  */
190
- const handle = function (...handlers) {
191
- const h = makeHandler(handlers);
192
-
193
- // In order to support binding either handle (handle.bind(this)) or a handler
194
- // (a = handle(), a.bind(this)), we cache `this` here and use it as the fallback for props and
195
- // context if fn() doesn't have its own `this`.
196
- const _outer = this;
197
-
198
- const fn = function prepareHandleArgs (ev, props, context) {
199
- let caller = null;
200
-
201
- // if handle() was bound to a class, use its props and context. otherwise, we accept
202
- // incoming props/context as would be provided by computed/handlers from kind()
203
- if (hasPropsAndContext(this)) {
204
- caller = this;
205
- props = this.props;
206
- context = this.context;
207
- } else if (hasPropsAndContext(_outer)) {
208
- caller = _outer;
209
- props = _outer.props;
210
- context = _outer.context;
211
- }
212
-
213
- return h.call(caller, ev, props, context);
214
- };
215
-
216
- fn.finally = function (cleanup) {
217
- return decorateHandleFunction(function handleWithFinally (ev, props, context) {
218
- let result = false;
219
-
220
- if (hasPropsAndContext(this)) {
221
- props = this.props;
222
- context = this.context;
223
- }
224
-
225
- try {
226
- result = fn.call(this, ev, props, context);
227
- } finally {
228
- cleanup.call(this, ev, props, context);
229
- }
230
-
231
- return result;
232
- });
233
- };
234
-
235
- return decorateHandleFunction(fn);
236
- };
237
205
 
206
+
207
+ var handle = function handle() {
208
+ for (var _len2 = arguments.length, handlers = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
209
+ handlers[_key2] = arguments[_key2];
210
+ }
211
+
212
+ var h = makeHandler(handlers); // In order to support binding either handle (handle.bind(this)) or a handler
213
+ // (a = handle(), a.bind(this)), we cache `this` here and use it as the fallback for props and
214
+ // context if fn() doesn't have its own `this`.
215
+
216
+ var _outer = this;
217
+
218
+ var fn = function prepareHandleArgs(ev, props, context) {
219
+ var caller = null; // if handle() was bound to a class, use its props and context. otherwise, we accept
220
+ // incoming props/context as would be provided by computed/handlers from kind()
221
+
222
+ if (hasPropsAndContext(this)) {
223
+ caller = this;
224
+ props = this.props;
225
+ context = this.context;
226
+ } else if (hasPropsAndContext(_outer)) {
227
+ caller = _outer;
228
+ props = _outer.props;
229
+ context = _outer.context;
230
+ }
231
+
232
+ return h.call(caller, ev, props, context);
233
+ };
234
+
235
+ fn["finally"] = function (cleanup) {
236
+ return decorateHandleFunction(function handleWithFinally(ev, props, context) {
237
+ var result = false;
238
+
239
+ if (hasPropsAndContext(this)) {
240
+ props = this.props;
241
+ context = this.context;
242
+ }
243
+
244
+ try {
245
+ result = fn.call(this, ev, props, context);
246
+ } finally {
247
+ cleanup.call(this, ev, props, context);
248
+ }
249
+
250
+ return result;
251
+ });
252
+ };
253
+
254
+ return decorateHandleFunction(fn);
255
+ };
238
256
  /**
239
257
  * Calls the first handler whose condition passes. Each branch must be passed as an array with the
240
258
  * first element being the condition function and the second being the handler function. The same
@@ -258,10 +276,17 @@ const handle = function (...handlers) {
258
276
  * @memberof core/handle
259
277
  * @public
260
278
  */
261
- const oneOf = handle.oneOf = function (...handlers) {
262
- return handle.call(this, cond(handlers));
263
- };
264
279
 
280
+
281
+ exports.handle = handle;
282
+
283
+ var oneOf = handle.oneOf = function () {
284
+ for (var _len3 = arguments.length, handlers = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
285
+ handlers[_key3] = arguments[_key3];
286
+ }
287
+
288
+ return handle.call(this, (0, _cond["default"])(handlers));
289
+ };
265
290
  /**
266
291
  * A function that always returns `true`. Optionally accepts a `handler` function which is called
267
292
  * before returning `true`.
@@ -288,18 +313,24 @@ const oneOf = handle.oneOf = function (...handlers) {
288
313
  * @memberof core/handle
289
314
  * @public
290
315
  */
291
- const returnsTrue = handle.returnsTrue = function (handler) {
292
- if (handler && typeof handler === 'function') {
293
- return named(function (...args) {
294
- handler.apply(this, args);
295
316
 
296
- return true;
297
- }, 'returnsTrue');
298
- }
299
317
 
300
- return true;
301
- };
318
+ exports.oneOf = oneOf;
319
+
320
+ var returnsTrue = handle.returnsTrue = function (handler) {
321
+ if (handler && typeof handler === 'function') {
322
+ return named(function () {
323
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
324
+ args[_key4] = arguments[_key4];
325
+ }
302
326
 
327
+ handler.apply(this, args);
328
+ return true;
329
+ }, 'returnsTrue');
330
+ }
331
+
332
+ return true;
333
+ };
303
334
  /**
304
335
  * Calls a named function on the event and returns `true`.
305
336
  *
@@ -322,17 +353,20 @@ const returnsTrue = handle.returnsTrue = function (handler) {
322
353
  * @memberof core/handle
323
354
  * @private
324
355
  */
325
- const callOnEvent = handle.callOnEvent = curry((methodName, ev) => {
326
- if (ev[methodName]) {
327
- ev[methodName]();
328
- } else if (ev.nativeEvent && ev.nativeEvent[methodName]) {
329
- // In some cases (notably stopImmediatePropagation), React doesn't include a desired method
330
- // on its proxy so we check the native event as well.
331
- ev.nativeEvent[methodName]();
332
- }
333
- return true;
334
- });
335
356
 
357
+
358
+ exports.returnsTrue = returnsTrue;
359
+ var callOnEvent = handle.callOnEvent = (0, _curry["default"])(function (methodName, ev) {
360
+ if (ev[methodName]) {
361
+ ev[methodName]();
362
+ } else if (ev.nativeEvent && ev.nativeEvent[methodName]) {
363
+ // In some cases (notably stopImmediatePropagation), React doesn't include a desired method
364
+ // on its proxy so we check the native event as well.
365
+ ev.nativeEvent[methodName]();
366
+ }
367
+
368
+ return true;
369
+ });
336
370
  /**
337
371
  * Allows handling to continue if the value of `prop` on the event strictly equals `value`
338
372
  *
@@ -356,10 +390,11 @@ const callOnEvent = handle.callOnEvent = curry((methodName, ev) => {
356
390
  * @memberof core/handle
357
391
  * @public
358
392
  */
359
- const forEventProp = handle.forEventProp = curry((prop, value, ev) => {
360
- return ev[prop] === value;
361
- });
362
393
 
394
+ exports.callOnEvent = callOnEvent;
395
+ var forEventProp = handle.forEventProp = (0, _curry["default"])(function (prop, value, ev) {
396
+ return ev[prop] === value;
397
+ });
363
398
  /**
364
399
  * Forwards the event to a function at `name` on `props`. If the specified prop is `undefined` or
365
400
  * is not a function, it is ignored. The return value of the forwarded function is ignored and
@@ -385,15 +420,17 @@ const forEventProp = handle.forEventProp = curry((prop, value, ev) => {
385
420
  * @memberof core/handle
386
421
  * @public
387
422
  */
388
- const forward = handle.forward = curry(named((name, ev, props) => {
389
- const fn = props && props[name];
390
- if (typeof fn === 'function') {
391
- fn(ev);
392
- }
393
423
 
394
- return true;
395
- }, 'forward'));
424
+ exports.forEventProp = forEventProp;
425
+ var forward = handle.forward = (0, _curry["default"])(named(function (name, ev, props) {
426
+ var fn = props && props[name];
427
+
428
+ if (typeof fn === 'function') {
429
+ fn(ev);
430
+ }
396
431
 
432
+ return true;
433
+ }, 'forward'));
397
434
  /**
398
435
  * Calls `event.preventDefault()` and returns `true`.
399
436
  *
@@ -414,8 +451,10 @@ const forward = handle.forward = curry(named((name, ev, props) => {
414
451
  * @memberof core/handle
415
452
  * @public
416
453
  */
417
- const preventDefault = handle.preventDefault = callOnEvent('preventDefault');
418
454
 
455
+ exports.forward = forward;
456
+
457
+ var _preventDefault = handle.preventDefault = callOnEvent('preventDefault');
419
458
  /**
420
459
  * Forwards the event to a function at `name` on `props` with capability to prevent default
421
460
  * behavior. If the specified prop is `undefined` or is not a function, it is ignored. Returns
@@ -441,19 +480,21 @@ const preventDefault = handle.preventDefault = callOnEvent('preventDefault');
441
480
  * @memberof core/handle
442
481
  * @private
443
482
  */
444
- const forwardWithPrevent = handle.forwardWithPrevent = curry(named((name, ev, props) => {
445
- let prevented = false;
446
- const wrappedEvent = Object.assign({}, ev, {
447
- preventDefault: () => {
448
- prevented = true;
449
- preventDefault(ev);
450
- }
451
- });
452
- forward(name, wrappedEvent, props);
453
-
454
- return !prevented;
455
- }, 'forwardWithPrevent'));
456
483
 
484
+
485
+ exports.preventDefault = _preventDefault;
486
+ var forwardWithPrevent = handle.forwardWithPrevent = (0, _curry["default"])(named(function (name, ev, props) {
487
+ var prevented = false;
488
+ var wrappedEvent = Object.assign({}, ev, {
489
+ preventDefault: function preventDefault() {
490
+ prevented = true;
491
+
492
+ _preventDefault(ev);
493
+ }
494
+ });
495
+ forward(name, wrappedEvent, props);
496
+ return !prevented;
497
+ }, 'forwardWithPrevent'));
457
498
  /**
458
499
  * Calls `event.stopPropagation()` and returns `true`
459
500
  *
@@ -475,8 +516,9 @@ const forwardWithPrevent = handle.forwardWithPrevent = curry(named((name, ev, pr
475
516
  * @memberof core/handle
476
517
  * @public
477
518
  */
478
- const stop = handle.stop = named(callOnEvent('stopPropagation'), 'stop');
479
519
 
520
+ exports.forwardWithPrevent = forwardWithPrevent;
521
+ var stop = handle.stop = named(callOnEvent('stopPropagation'), 'stop');
480
522
  /**
481
523
  * Calls `event.stopImmediatePropagation()` and returns `true`
482
524
  *
@@ -498,8 +540,9 @@ const stop = handle.stop = named(callOnEvent('stopPropagation'), 'stop');
498
540
  * @memberof core/handle
499
541
  * @public
500
542
  */
501
- const stopImmediate = handle.stopImmediate = callOnEvent('stopImmediatePropagation');
502
543
 
544
+ exports.stop = stop;
545
+ var stopImmediate = handle.stopImmediate = callOnEvent('stopImmediatePropagation');
503
546
  /**
504
547
  * Allows event handling to continue if `event.keyCode === value`.
505
548
  *
@@ -522,8 +565,9 @@ const stopImmediate = handle.stopImmediate = callOnEvent('stopImmediatePropagati
522
565
  * @memberof core/handle
523
566
  * @public
524
567
  */
525
- const forKeyCode = handle.forKeyCode = forEventProp('keyCode');
526
568
 
569
+ exports.stopImmediate = stopImmediate;
570
+ var forKeyCode = handle.forKeyCode = forEventProp('keyCode');
527
571
  /**
528
572
  * Allows handling to continue if the event's keyCode is mapped to `name` within
529
573
  * {@link core/keymap}.
@@ -548,10 +592,11 @@ const forKeyCode = handle.forKeyCode = forEventProp('keyCode');
548
592
  * @memberof core/handle
549
593
  * @public
550
594
  */
551
- const forKey = handle.forKey = curry((name, ev) => {
552
- return is(name, ev.keyCode);
553
- });
554
595
 
596
+ exports.forKeyCode = forKeyCode;
597
+ var forKey = handle.forKey = (0, _curry["default"])(function (name, ev) {
598
+ return (0, _keymap.is)(name, ev.keyCode);
599
+ });
555
600
  /**
556
601
  * Allows handling to continue if the value of `prop` on the props strictly equals `value`.
557
602
  *
@@ -576,10 +621,11 @@ const forKey = handle.forKey = curry((name, ev) => {
576
621
  * @memberof core/handle
577
622
  * @public
578
623
  */
579
- const forProp = handle.forProp = curry((prop, value, ev, props) => {
580
- return props[prop] === value;
581
- });
582
624
 
625
+ exports.forKey = forKey;
626
+ var forProp = handle.forProp = (0, _curry["default"])(function (prop, value, ev, props) {
627
+ return props[prop] === value;
628
+ });
583
629
  /**
584
630
  * Logs the event, props, and context optionally preceded by a custom message. Will only log in
585
631
  * development mode.
@@ -604,15 +650,22 @@ const forProp = handle.forProp = curry((prop, value, ev, props) => {
604
650
  * @memberof core/handle
605
651
  * @public
606
652
  */
607
- const log = handle.log = curry((message, ev, ...args) => {
608
- if (__DEV__) {
609
- // eslint-disable-next-line no-console
610
- console.log(message, ev, ...args);
611
- }
612
653
 
613
- return true;
614
- });
654
+ exports.forProp = forProp;
655
+ var log = handle.log = (0, _curry["default"])(function (message, ev) {
656
+ if (process.env.NODE_ENV !== "production") {
657
+ var _console;
658
+
659
+ for (var _len5 = arguments.length, args = new Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
660
+ args[_key5 - 2] = arguments[_key5];
661
+ }
615
662
 
663
+ // eslint-disable-next-line no-console
664
+ (_console = console).log.apply(_console, [message, ev].concat(args));
665
+ }
666
+
667
+ return true;
668
+ });
616
669
  /**
617
670
  * Invokes a method by name on the component to which {@link core/handle.handle} is bound.
618
671
  *
@@ -651,16 +704,18 @@ const log = handle.log = curry((message, ev, ...args) => {
651
704
  * @memberof core/handle
652
705
  * @public
653
706
  */
654
- const call = function (method) {
655
- return named(function (...args) {
656
- if (this && this[method]) {
657
- return this[method](...args);
658
- }
659
-
660
- return false;
661
- }, 'call');
662
- };
663
707
 
708
+ exports.log = log;
709
+
710
+ var call = function call(method) {
711
+ return named(function () {
712
+ if (this && this[method]) {
713
+ return this[method].apply(this, arguments);
714
+ }
715
+
716
+ return false;
717
+ }, 'call');
718
+ };
664
719
  /**
665
720
  * Adapts an event with `adapter` before calling `handler`.
666
721
  *
@@ -691,12 +746,18 @@ const call = function (method) {
691
746
  * @memberof core/handle
692
747
  * @public
693
748
  */
694
- const adaptEvent = handle.adaptEvent = curry(function (adapter, handler) {
695
- return named(function (ev, ...args) {
696
- return handler.call(this, adapter.call(this, ev, ...args), ...args);
697
- }, 'adaptEvent');
698
- });
699
749
 
750
+
751
+ exports.call = call;
752
+ var adaptEvent = handle.adaptEvent = (0, _curry["default"])(function (adapter, handler) {
753
+ return named(function (ev) {
754
+ for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
755
+ args[_key6 - 1] = arguments[_key6];
756
+ }
757
+
758
+ return handler.call.apply(handler, [this, adapter.call.apply(adapter, [this, ev].concat(args))].concat(args));
759
+ }, 'adaptEvent');
760
+ });
700
761
  /**
701
762
  * Creates a handler that will forward the event to a function at `name` on `props`.
702
763
  *
@@ -730,24 +791,21 @@ const adaptEvent = handle.adaptEvent = curry(function (adapter, handler) {
730
791
  * @memberof core/handle
731
792
  * @public
732
793
  */
733
- const forwardCustom = handle.forwardCustom = (name, adapter) => handle(
734
- adaptEvent(
735
- (...args) => {
736
- let ev = adapter ? adapter(...args) : null;
737
794
 
738
- // Handle either no adapter or a non-object return from the adapter
739
- if (!ev || typeof ev !== 'object') {
740
- ev = {};
741
- }
795
+ exports.adaptEvent = adaptEvent;
742
796
 
743
- ev.type = name;
797
+ var forwardCustom = handle.forwardCustom = function (name, adapter) {
798
+ return handle(adaptEvent(function () {
799
+ var ev = adapter ? adapter.apply(void 0, arguments) : null; // Handle either no adapter or a non-object return from the adapter
744
800
 
745
- return ev;
746
- },
747
- forward(name)
748
- )
749
- ).named('forwardCustom');
801
+ if (!ev || typeof ev !== 'object') {
802
+ ev = {};
803
+ }
750
804
 
805
+ ev.type = name;
806
+ return ev;
807
+ }, forward(name))).named('forwardCustom');
808
+ };
751
809
  /**
752
810
  * Accepts a handler and returns the logical complement of the value returned from the handler.
753
811
  *
@@ -773,26 +831,16 @@ const forwardCustom = handle.forwardCustom = (name, adapter) => handle(
773
831
  * @memberof core/handle
774
832
  * @public
775
833
  */
776
- const not = handle.not = (handler) => (...args) => !handler(...args);
777
-
778
- export default handle;
779
- export {
780
- adaptEvent,
781
- call,
782
- callOnEvent,
783
- forward,
784
- forwardCustom,
785
- forwardWithPrevent,
786
- forEventProp,
787
- forKey,
788
- forKeyCode,
789
- forProp,
790
- handle,
791
- log,
792
- not,
793
- oneOf,
794
- preventDefault,
795
- returnsTrue,
796
- stop,
797
- stopImmediate
834
+
835
+
836
+ exports.forwardCustom = forwardCustom;
837
+
838
+ var not = handle.not = function (handler) {
839
+ return function () {
840
+ return !handler.apply(void 0, arguments);
841
+ };
798
842
  };
843
+
844
+ exports.not = not;
845
+ var _default = handle;
846
+ exports["default"] = _default;