@baleada/logic 0.22.4 → 0.22.6

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/lib/index.cjs CHANGED
@@ -47,7 +47,7 @@ function createFilterAsync(condition) {
47
47
  return createFilter((_, index) => transformedAsync[index])(array);
48
48
  };
49
49
  }
50
- function createDelete(index) {
50
+ function createRemove(index) {
51
51
  return (array) => {
52
52
  return createConcat(
53
53
  createSlice(0, index)(array),
@@ -66,7 +66,7 @@ function createInsert(item, index) {
66
66
  }
67
67
  function createReorder(from, to) {
68
68
  return (array) => {
69
- const [itemsToMoveStartIndex, itemsToMoveCount] = isObject(from) ? [from.start, from.itemCount] : [from, 1], insertIndex = to;
69
+ const [itemsToMoveStartIndex, itemsToMoveCount] = predicateObject(from) ? [from.start, from.itemCount] : [from, 1], insertIndex = to;
70
70
  if (insertIndex > itemsToMoveStartIndex && insertIndex < itemsToMoveStartIndex + itemsToMoveCount) {
71
71
  return array;
72
72
  }
@@ -92,7 +92,7 @@ function createReorder(from, to) {
92
92
  return array;
93
93
  };
94
94
  }
95
- function isObject(value) {
95
+ function predicateObject(value) {
96
96
  return typeof value === "object";
97
97
  }
98
98
  function createSwap(indices) {
@@ -220,6 +220,46 @@ function createToEntries() {
220
220
  return entries;
221
221
  };
222
222
  }
223
+ function createToKeys() {
224
+ return (object) => {
225
+ const keys = [];
226
+ for (const key in object) {
227
+ keys.push(key);
228
+ }
229
+ return keys;
230
+ };
231
+ }
232
+ function createMatchesKeycombo(keycombo) {
233
+ return (event) => eventMatchesKeycombo(event, narrowKeycombo(keycombo));
234
+ }
235
+ function createMatchesMousecombo(mousecombo) {
236
+ return (event) => eventMatchesMousecombo(event, narrowMousecombo(mousecombo));
237
+ }
238
+ function createMatchesPointercombo(pointercombo) {
239
+ return (event) => eventMatchesPointercombo(event, narrowPointercombo(pointercombo));
240
+ }
241
+ function createToFocusable(order, elementIsCandidate) {
242
+ return (element) => {
243
+ if (elementIsCandidate && predicateFocusable(element))
244
+ return element;
245
+ switch (order) {
246
+ case "first":
247
+ for (let i = 0; i < element.children.length; i++) {
248
+ const focusable = createToFocusable(order, true)(element.children[i]);
249
+ if (focusable)
250
+ return focusable;
251
+ }
252
+ break;
253
+ case "last":
254
+ for (let i = element.children.length - 1; i > -1; i--) {
255
+ const focusable = createToFocusable(order, true)(element.children[i]);
256
+ if (focusable)
257
+ return focusable;
258
+ }
259
+ break;
260
+ }
261
+ };
262
+ }
223
263
  class Pipeable {
224
264
  constructor(state) {
225
265
  this.state = state;
@@ -287,16 +327,16 @@ const keysByName = {
287
327
  f20: "F20"
288
328
  };
289
329
  const toListenableKeycomboItems = createMap((name) => ({ name, type: fromComboItemNameToType(name) }));
290
- function ensureKeycombo(type) {
330
+ function narrowKeycombo(type) {
291
331
  return new Pipeable(type).pipe(
292
332
  toCombo,
293
333
  toListenableKeycomboItems
294
334
  );
295
335
  }
296
- function ensureClickcombo(type) {
336
+ function narrowMousecombo(type) {
297
337
  return toCombo(type);
298
338
  }
299
- function ensurePointercombo(type) {
339
+ function narrowPointercombo(type) {
300
340
  return toCombo(type);
301
341
  }
302
342
  const toUnique$1 = lazyCollections.unique();
@@ -343,45 +383,39 @@ function createExceptAndOnlyEffect(type, effect, options) {
343
383
  const { except = [], only = [] } = options;
344
384
  if (type === "keydown" || type === "keyup") {
345
385
  return (event) => {
346
- const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
347
- matches: (keycombo) => eventMatchesKeycombo(event, ensureKeycombo(keycombo))
348
- };
386
+ const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true];
349
387
  if (matchesOnly) {
350
- effect(event, api);
388
+ effect(event);
351
389
  return;
352
390
  }
353
391
  if (only.length === 0 && !matchesExcept) {
354
- effect(event, api);
392
+ effect(event);
355
393
  return;
356
394
  }
357
395
  };
358
396
  }
359
397
  if (type === "click" || type === "dblclick" || type === "contextmenu" || type.startsWith("mouse")) {
360
398
  return (event) => {
361
- const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
362
- matches: (clickcombo) => eventMatchesClickcombo(event, ensureClickcombo(clickcombo))
363
- };
399
+ const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true];
364
400
  if (matchesOnly) {
365
- effect(event, api);
401
+ effect(event);
366
402
  return;
367
403
  }
368
404
  if (only.length === 0 && !matchesExcept) {
369
- effect(event, api);
405
+ effect(event);
370
406
  return;
371
407
  }
372
408
  };
373
409
  }
374
410
  if (type.startsWith("pointer")) {
375
411
  return (event) => {
376
- const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
377
- matches: (pointercombo) => eventMatchesPointercombo(event, ensurePointercombo(pointercombo))
378
- };
412
+ const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true];
379
413
  if (matchesOnly) {
380
- effect(event, api);
414
+ effect(event);
381
415
  return;
382
416
  }
383
417
  if (only.length === 0 && !matchesExcept) {
384
- effect(event, api);
418
+ effect(event);
385
419
  return;
386
420
  }
387
421
  };
@@ -398,7 +432,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
398
432
  }
399
433
  };
400
434
  }
401
- function isModified({ event, alias }) {
435
+ function predicateModified({ event, alias }) {
402
436
  return predicatesByModifier[alias]?.(event);
403
437
  }
404
438
  const predicatesByModifier = {
@@ -419,24 +453,43 @@ function domIsAvailable() {
419
453
  return false;
420
454
  }
421
455
  }
422
- function isArray(value) {
456
+ function predicateArray(value) {
423
457
  return Array.isArray(value);
424
458
  }
425
- function isUndefined(value) {
459
+ function predicateUndefined(value) {
426
460
  return value === void 0;
427
461
  }
428
- function isFunction(value) {
462
+ function predicateFunction(value) {
429
463
  return typeof value === "function";
430
464
  }
431
- function isNull(value) {
465
+ function predicateNull(value) {
432
466
  return value === null;
433
467
  }
434
- function isNumber(value) {
468
+ function predicateNumber(value) {
435
469
  return typeof value === "number";
436
470
  }
437
- function isString(value) {
471
+ function predicateString(value) {
438
472
  return typeof value === "string";
439
473
  }
474
+ const tabbableSelector = lazyCollections.join(':not([hidden]):not([tabindex="-1"]),')([
475
+ "input:not([disabled]):not([type=hidden])",
476
+ "select:not([disabled])",
477
+ "textarea:not([disabled])",
478
+ "button:not([disabled])",
479
+ "a[href]",
480
+ "area[href]",
481
+ "summary",
482
+ "iframe",
483
+ "object",
484
+ "embed",
485
+ "audio[controls]",
486
+ "video[controls]",
487
+ "[contenteditable]",
488
+ "[tabindex]:not([disabled])"
489
+ ]);
490
+ function predicateFocusable(element) {
491
+ return element.matches(tabbableSelector);
492
+ }
440
493
 
441
494
  class Recognizeable {
442
495
  maxSequenceLength;
@@ -456,7 +509,10 @@ class Recognizeable {
456
509
  getMetadata: () => this.metadata,
457
510
  setMetadata: (metadata) => this.computedMetadata = metadata,
458
511
  recognized: () => this.recognized(),
459
- denied: () => this.denied()
512
+ denied: () => this.denied(),
513
+ recognizedUntilReady: () => this.recognizedUntilReady(),
514
+ deniedUntilReady: () => this.deniedUntilReady(),
515
+ ready: () => this.ready()
460
516
  };
461
517
  this.ready();
462
518
  }
@@ -470,6 +526,12 @@ class Recognizeable {
470
526
  denied() {
471
527
  this.computedStatus = "denied";
472
528
  }
529
+ recognizedUntilReady() {
530
+ this.computedStatus = "recognized until ready";
531
+ }
532
+ deniedUntilReady() {
533
+ this.computedStatus = "denied until ready";
534
+ }
473
535
  computedStatus;
474
536
  ready() {
475
537
  this.computedStatus = "ready";
@@ -491,18 +553,21 @@ class Recognizeable {
491
553
  this.computedSequence = sequence;
492
554
  return this;
493
555
  }
494
- recognize(sequenceItem, api, { onRecognized } = {}) {
495
- this.recognizing();
496
- const type = this.toType(sequenceItem), excess = isNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
556
+ recognize(sequenceItem, { onRecognized } = {}) {
557
+ if (!this.status.includes("until ready"))
558
+ this.recognizing();
559
+ const type = this.toType(sequenceItem), excess = predicateNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
497
560
  createSlice(excess)(this.sequence),
498
561
  [sequenceItem]
499
562
  )([]);
500
563
  this.effectApi.getSequence = () => newSequence;
501
564
  this.effectApi.onRecognized = onRecognized || (() => {
502
565
  });
503
- this.effects.get(type)?.(sequenceItem, { ...api, ...this.effectApi });
566
+ this.effects.get(type)?.(sequenceItem, { ...this.effectApi });
504
567
  switch (this.status) {
568
+ case "ready":
505
569
  case "denied":
570
+ case "denied until ready":
506
571
  this.resetComputedMetadata();
507
572
  this.setSequence([]);
508
573
  break;
@@ -517,7 +582,7 @@ class Recognizeable {
517
582
  this.computedStatus = "recognizing";
518
583
  }
519
584
  toType(sequenceItem) {
520
- if (isArray(sequenceItem)) {
585
+ if (predicateArray(sequenceItem)) {
521
586
  if (sequenceItem[0] instanceof IntersectionObserverEntry) {
522
587
  return "intersect";
523
588
  }
@@ -629,27 +694,40 @@ class Listenable {
629
694
  }
630
695
  mediaQueryListen(effect, options) {
631
696
  const target = window.matchMedia(this.type);
632
- if (isFunction(options.instantEffect)) {
697
+ if (predicateFunction(options.instantEffect)) {
633
698
  options.instantEffect(target);
634
699
  }
635
- const withApi = (event) => effect(event, {});
700
+ const withApi = (event) => effect(event);
636
701
  target.addEventListener("change", withApi);
637
702
  this.active.add({ target, id: ["change", withApi] });
638
703
  }
639
704
  idleListen(effect, options) {
640
- const { requestIdleCallback } = options, id = window.requestIdleCallback((deadline) => effect(deadline, {}), requestIdleCallback);
705
+ const { requestIdleCallback } = options, id = window.requestIdleCallback((deadline) => effect(deadline), requestIdleCallback);
641
706
  this.active.add({ target: window, id });
642
707
  }
643
708
  messageListen(effect, options) {
644
709
  const { target = new BroadcastChannel("baleada") } = options;
645
- target.addEventListener(this.type, (event) => effect(event, {}));
710
+ target.addEventListener(this.type, (event) => effect(event));
646
711
  this.active.add({ target, id: [this.type, effect] });
647
712
  }
648
713
  recognizeableListen(effect, options) {
649
- const guardedEffect = (sequenceItem, api) => {
650
- this.recognizeable.recognize(sequenceItem, api, { onRecognized: (sequenceItem2) => effect(sequenceItem2, api) });
651
- if (this.recognizeable.status === "recognized") {
652
- effect(sequenceItem, api);
714
+ let effectStatus = "ready";
715
+ const guardedEffect = (sequenceItem) => {
716
+ this.recognizeable.recognize(sequenceItem, { onRecognized: (sequenceItem2) => effect(sequenceItem2) });
717
+ switch (this.recognizeable.status) {
718
+ case "recognized until ready":
719
+ if (effectStatus === "ready") {
720
+ effect(sequenceItem);
721
+ effectStatus = "performed";
722
+ }
723
+ break;
724
+ case "recognized":
725
+ effect(sequenceItem);
726
+ effectStatus = "ready";
727
+ break;
728
+ default:
729
+ effectStatus = "ready";
730
+ break;
653
731
  }
654
732
  };
655
733
  for (const type of this.recognizeableEffectsKeys) {
@@ -659,11 +737,11 @@ class Listenable {
659
737
  }
660
738
  }
661
739
  documentEventListen(effect, options) {
662
- const ensuredOptions = {
740
+ const narrowedOptions = {
663
741
  ...options,
664
742
  target: document
665
743
  };
666
- this.eventListen(effect, ensuredOptions);
744
+ this.eventListen(effect, narrowedOptions);
667
745
  }
668
746
  eventListen(effect, options) {
669
747
  const { exceptAndOnlyEffect, effectOptions } = toAddEventListenerParams(this.type, effect, options), eventListeners = [[this.type, exceptAndOnlyEffect, ...effectOptions]];
@@ -717,7 +795,7 @@ function stop(stoppable) {
717
795
  target2.removeEventListener(id2[0], id2[1]);
718
796
  return;
719
797
  }
720
- if (isNumber(stoppable.id)) {
798
+ if (predicateNumber(stoppable.id)) {
721
799
  const { target: target2, id: id2 } = stoppable;
722
800
  target2.cancelIdleCallback(id2);
723
801
  return;
@@ -790,9 +868,8 @@ function eventMatchesKeycombo(event, keycombo) {
790
868
  return lazyCollections.every(({ name, type }, index) => {
791
869
  switch (type) {
792
870
  case "singleCharacter":
793
- if (name === "!") {
871
+ if (name === "!")
794
872
  return event.key === "!";
795
- }
796
873
  const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
797
874
  return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
798
875
  case "other":
@@ -806,7 +883,7 @@ function eventMatchesKeycombo(event, keycombo) {
806
883
  if (index === keycombo.length - 1) {
807
884
  return name.startsWith("!") ? event.key.toLowerCase() !== toModifier(name.slice(1)).toLowerCase() : event.key.toLowerCase() === toModifier(name).toLowerCase();
808
885
  }
809
- return name.startsWith("!") ? !isModified({ event, alias: name.slice(1) }) : isModified({ event, alias: name });
886
+ return name.startsWith("!") ? !predicateModified({ event, alias: name.slice(1) }) : predicateModified({ event, alias: name });
810
887
  }
811
888
  })(keycombo);
812
889
  }
@@ -870,11 +947,11 @@ const predicatesByArrow = /* @__PURE__ */ new Map([
870
947
  const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
871
948
  const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
872
949
  const horizontalArrows = /* @__PURE__ */ new Set(["arrowright", "arrowleft"]);
873
- function eventMatchesClickcombo(event, clickcombo) {
874
- return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(clickcombo);
950
+ function eventMatchesMousecombo(event, Mousecombo) {
951
+ return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(Mousecombo);
875
952
  }
876
953
  function eventMatchesPointercombo(event, pointercombo) {
877
- return lazyCollections.every((name) => fromComboItemNameToType(name) === "pointer" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(pointercombo);
954
+ return lazyCollections.every((name) => fromComboItemNameToType(name) === "pointer" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(pointercombo);
878
955
  }
879
956
  const observerAssertionsByType = {
880
957
  intersect: (observer) => observer instanceof IntersectionObserver,
@@ -1002,13 +1079,13 @@ class Animateable {
1002
1079
  duration;
1003
1080
  totalTimeInvisible;
1004
1081
  setPlaybackRate(playbackRate) {
1005
- const ensuredPlaybackRate = Math.max(0, playbackRate);
1006
- this.computedPlaybackRate = ensuredPlaybackRate;
1007
- this.duration = 1 / ensuredPlaybackRate * this.initialDuration;
1082
+ const narrowedPlaybackRate = Math.max(0, playbackRate);
1083
+ this.computedPlaybackRate = narrowedPlaybackRate;
1084
+ this.duration = 1 / narrowedPlaybackRate * this.initialDuration;
1008
1085
  switch (this.status) {
1009
1086
  case "playing":
1010
1087
  case "reversing":
1011
- this.totalTimeInvisible = 1 / ensuredPlaybackRate * this.totalTimeInvisible;
1088
+ this.totalTimeInvisible = 1 / narrowedPlaybackRate * this.totalTimeInvisible;
1012
1089
  this.seek(this.progress.time);
1013
1090
  break;
1014
1091
  }
@@ -1397,51 +1474,51 @@ class Animateable {
1397
1474
  seek(timeProgress, options = {}) {
1398
1475
  const iterations = Math.floor(timeProgress), naiveIterationProgress = timeProgress - iterations, { effect: naiveEffect } = options;
1399
1476
  this.computedIterations = iterations;
1400
- let ensuredTimeProgress, effect;
1477
+ let narrowedTimeProgress, effect;
1401
1478
  if (this.alternates) {
1402
1479
  if (naiveIterationProgress <= 0.5) {
1403
- ensuredTimeProgress = naiveIterationProgress * 2;
1480
+ narrowedTimeProgress = naiveIterationProgress * 2;
1404
1481
  switch (this.alternateCache.status) {
1405
1482
  case "playing":
1406
1483
  this.cancelAnimate();
1407
- this.seekCache = { timeProgress: ensuredTimeProgress };
1484
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1408
1485
  this.sought();
1409
- effect = isFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1486
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1410
1487
  this.play(effect, this.playCache.options);
1411
1488
  break;
1412
1489
  case "reversing":
1413
1490
  this.cancelAnimate();
1414
- this.seekCache = { timeProgress: ensuredTimeProgress };
1491
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1415
1492
  this.sought();
1416
- effect = isFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1493
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1417
1494
  this.reverse(effect, this.reverseCache.options);
1418
1495
  break;
1419
1496
  default:
1420
- this.seekCache = { timeProgress: ensuredTimeProgress };
1497
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1421
1498
  this.sought();
1422
1499
  effect = naiveEffect;
1423
1500
  this.createAnimate("seek")(effect, options);
1424
1501
  break;
1425
1502
  }
1426
1503
  } else {
1427
- ensuredTimeProgress = (naiveIterationProgress - 0.5) * 2;
1504
+ narrowedTimeProgress = (naiveIterationProgress - 0.5) * 2;
1428
1505
  switch (this.alternateCache.status) {
1429
1506
  case "playing":
1430
1507
  this.cancelAnimate();
1431
- this.seekCache = { timeProgress: ensuredTimeProgress };
1508
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1432
1509
  this.sought();
1433
- effect = isFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1510
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1434
1511
  this.reverse(effect, this.reverseCache.options);
1435
1512
  break;
1436
1513
  case "reversing":
1437
1514
  this.cancelAnimate();
1438
- this.seekCache = { timeProgress: ensuredTimeProgress };
1515
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1439
1516
  this.sought();
1440
- effect = isFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1517
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1441
1518
  this.play(effect, this.playCache.options);
1442
1519
  break;
1443
1520
  default:
1444
- this.seekCache = { timeProgress: ensuredTimeProgress };
1521
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1445
1522
  this.sought();
1446
1523
  effect = naiveEffect;
1447
1524
  if (effect) {
@@ -1451,24 +1528,24 @@ class Animateable {
1451
1528
  }
1452
1529
  }
1453
1530
  } else {
1454
- ensuredTimeProgress = naiveIterationProgress;
1531
+ narrowedTimeProgress = naiveIterationProgress;
1455
1532
  switch (this.status) {
1456
1533
  case "playing":
1457
1534
  this.cancelAnimate();
1458
- this.seekCache = { timeProgress: ensuredTimeProgress };
1535
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1459
1536
  this.sought();
1460
- effect = isFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1537
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1461
1538
  this.play(effect, this.playCache.options);
1462
1539
  break;
1463
1540
  case "reversing":
1464
1541
  this.cancelAnimate();
1465
- this.seekCache = { timeProgress: ensuredTimeProgress };
1542
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1466
1543
  this.sought();
1467
- effect = isFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1544
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1468
1545
  this.reverse(effect, this.reverseCache.options);
1469
1546
  break;
1470
1547
  default:
1471
- this.seekCache = { timeProgress: ensuredTimeProgress };
1548
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1472
1549
  this.sought();
1473
1550
  effect = naiveEffect;
1474
1551
  if (effect) {
@@ -1594,13 +1671,13 @@ function createToAnimationProgress(points) {
1594
1671
  return BezierEasing(point1x, point1y, point2x, point2y);
1595
1672
  }
1596
1673
  function toInterpolated({ previous, next, progress }, options = {}) {
1597
- if (isUndefined(previous)) {
1674
+ if (predicateUndefined(previous)) {
1598
1675
  return next;
1599
1676
  }
1600
- if (isNumber(previous) && isNumber(next)) {
1677
+ if (predicateNumber(previous) && predicateNumber(next)) {
1601
1678
  return (next - previous) * progress + previous;
1602
1679
  }
1603
- if (isString(previous) && isString(next)) {
1680
+ if (predicateString(previous) && predicateString(next)) {
1604
1681
  return color.mix(
1605
1682
  options.colorModel,
1606
1683
  {
@@ -1610,7 +1687,7 @@ function toInterpolated({ previous, next, progress }, options = {}) {
1610
1687
  }
1611
1688
  ).toRgb().toRgbString();
1612
1689
  }
1613
- if (isArray(previous) && isArray(next)) {
1690
+ if (predicateArray(previous) && predicateArray(next)) {
1614
1691
  const exactSliceEnd = (next.length - previous.length) * progress + previous.length, nextIsLonger = next.length > previous.length, sliceEnd = nextIsLonger ? Math.floor(exactSliceEnd) : Math.ceil(exactSliceEnd), sliceTarget = nextIsLonger ? next : previous;
1615
1692
  return createSlice(0, sliceEnd)(sliceTarget);
1616
1693
  }
@@ -1976,7 +2053,7 @@ class Completeable {
1976
2053
  complete(completion, options = {}) {
1977
2054
  this.completing();
1978
2055
  const { select } = { ...defaultCompleteOptions, ...options }, before = this.getBefore(), after = this.getAfter(), completedString = before + completion + after, completedSelection = (() => {
1979
- if (isFunction(select)) {
2056
+ if (predicateFunction(select)) {
1980
2057
  return select({ before, completion, after });
1981
2058
  }
1982
2059
  switch (select) {
@@ -2381,7 +2458,7 @@ class Resolveable {
2381
2458
  this.resolving();
2382
2459
  try {
2383
2460
  const promises = this.getPromise(...args);
2384
- this.computedValue = isArray(promises) ? await createMapAsync(async (promise) => await promise)(promises) : await promises;
2461
+ this.computedValue = predicateArray(promises) ? await createMapAsync(async (promise) => await promise)(promises) : await promises;
2385
2462
  this.resolved();
2386
2463
  } catch (error) {
2387
2464
  this.computedValue = error;
@@ -2466,7 +2543,7 @@ class Fetchable {
2466
2543
  async fetch(options = {}) {
2467
2544
  this.fetching();
2468
2545
  try {
2469
- this.computedResponse = await fetch(this.resource, { signal: this.abortController.signal, ...ensureOptions(options) });
2546
+ this.computedResponse = await fetch(this.resource, { signal: this.abortController.signal, ...narrowOptions(options) });
2470
2547
  this.fetched();
2471
2548
  } catch (error) {
2472
2549
  this.computedError = error;
@@ -2490,23 +2567,23 @@ class Fetchable {
2490
2567
  this.computedStatus = "errored";
2491
2568
  }
2492
2569
  async get(options = {}) {
2493
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "get" });
2570
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "get" });
2494
2571
  return this;
2495
2572
  }
2496
2573
  async patch(options = {}) {
2497
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "patch" });
2574
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "patch" });
2498
2575
  return this;
2499
2576
  }
2500
2577
  async post(options = {}) {
2501
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "post" });
2578
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "post" });
2502
2579
  return this;
2503
2580
  }
2504
2581
  async put(options = {}) {
2505
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "put" });
2582
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "put" });
2506
2583
  return this;
2507
2584
  }
2508
2585
  async delete(options = {}) {
2509
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "delete" });
2586
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "delete" });
2510
2587
  return this;
2511
2588
  }
2512
2589
  abort() {
@@ -2514,8 +2591,8 @@ class Fetchable {
2514
2591
  return this;
2515
2592
  }
2516
2593
  }
2517
- function ensureOptions(options) {
2518
- return isFunction(options) ? options({ withJson }) : options;
2594
+ function narrowOptions(options) {
2595
+ return predicateFunction(options) ? options({ withJson }) : options;
2519
2596
  }
2520
2597
  function withJson(data) {
2521
2598
  return {
@@ -2698,7 +2775,7 @@ class Navigateable {
2698
2775
  }
2699
2776
  _navigate(location, options = {}) {
2700
2777
  const { allow } = { ...defaultNavigateOptions, ...options };
2701
- const ensuredLocation = (() => {
2778
+ const narrowedLocation = (() => {
2702
2779
  if (allow === "possible") {
2703
2780
  if (location < 0 && allow === "possible") {
2704
2781
  return 0;
@@ -2709,7 +2786,7 @@ class Navigateable {
2709
2786
  }
2710
2787
  return location;
2711
2788
  })();
2712
- this.computedLocation = ensuredLocation;
2789
+ this.computedLocation = narrowedLocation;
2713
2790
  }
2714
2791
  next(options = {}) {
2715
2792
  const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
@@ -2853,7 +2930,7 @@ class Pickable {
2853
2930
  pick(indexOrIndices, options = {}) {
2854
2931
  const { replace, allowsDuplicates } = { ...defaultPickOptions, ...options };
2855
2932
  this.computedPicks = new Pipeable(indexOrIndices).pipe(
2856
- ensureIndices,
2933
+ narrowIndices,
2857
2934
  this.toPossiblePicks,
2858
2935
  (possiblePicks) => {
2859
2936
  if (replace === "all") {
@@ -2906,7 +2983,7 @@ class Pickable {
2906
2983
  this.computedStatus = "picked";
2907
2984
  }
2908
2985
  omit(indexOrIndices, options = { reference: "array" }) {
2909
- if (isUndefined(indexOrIndices)) {
2986
+ if (predicateUndefined(indexOrIndices)) {
2910
2987
  this.computedPicks = [];
2911
2988
  this.computedFirst = void 0;
2912
2989
  this.computedLast = void 0;
@@ -2914,9 +2991,9 @@ class Pickable {
2914
2991
  this.omitted();
2915
2992
  return this;
2916
2993
  }
2917
- const omits = ensureIndices(indexOrIndices);
2994
+ const omits = narrowIndices(indexOrIndices);
2918
2995
  this.computedPicks = createFilter(
2919
- (pick, index) => options.reference === "array" ? isUndefined(lazyCollections.find((omit) => pick === omit)(omits)) : isUndefined(lazyCollections.find((omit) => index === omit)(omits))
2996
+ (pick, index) => options.reference === "array" ? predicateUndefined(lazyCollections.find((omit) => pick === omit)(omits)) : predicateUndefined(lazyCollections.find((omit) => index === omit)(omits))
2920
2997
  )(this.computedPicks);
2921
2998
  this.computedFirst = Math.min(...this.picks);
2922
2999
  this.computedLast = Math.max(...this.picks);
@@ -2928,7 +3005,7 @@ class Pickable {
2928
3005
  this.computedStatus = "omitted";
2929
3006
  }
2930
3007
  }
2931
- function ensureIndices(indexOrIndices) {
3008
+ function narrowIndices(indexOrIndices) {
2932
3009
  return Array.isArray(indexOrIndices) ? indexOrIndices : [indexOrIndices];
2933
3010
  }
2934
3011
  const toUnique = createUnique();
@@ -3100,7 +3177,7 @@ class Storeable {
3100
3177
  ready() {
3101
3178
  this.computedStatus = "ready";
3102
3179
  if (domIsAvailable()) {
3103
- if (isNull(this.storage.getItem(this.computedStatusKey))) {
3180
+ if (predicateNull(this.storage.getItem(this.computedStatusKey))) {
3104
3181
  this.storeStatus();
3105
3182
  }
3106
3183
  }
@@ -3114,7 +3191,7 @@ class Storeable {
3114
3191
  get status() {
3115
3192
  if (domIsAvailable()) {
3116
3193
  const storedStatus = this.storage.getItem(this.computedStatusKey);
3117
- if (this.computedStatus !== storedStatus && isString(storedStatus)) {
3194
+ if (this.computedStatus !== storedStatus && predicateString(storedStatus)) {
3118
3195
  this.computedStatus = storedStatus;
3119
3196
  }
3120
3197
  }
@@ -3222,7 +3299,6 @@ exports.Storeable = Storeable;
3222
3299
  exports.createClamp = createClamp;
3223
3300
  exports.createClip = createClip;
3224
3301
  exports.createConcat = createConcat;
3225
- exports.createDelete = createDelete;
3226
3302
  exports.createDetermine = createDetermine;
3227
3303
  exports.createFilter = createFilter;
3228
3304
  exports.createFilterAsync = createFilterAsync;
@@ -3230,8 +3306,12 @@ exports.createForEachAsync = createForEachAsync;
3230
3306
  exports.createInsert = createInsert;
3231
3307
  exports.createMap = createMap;
3232
3308
  exports.createMapAsync = createMapAsync;
3309
+ exports.createMatchesKeycombo = createMatchesKeycombo;
3310
+ exports.createMatchesMousecombo = createMatchesMousecombo;
3311
+ exports.createMatchesPointercombo = createMatchesPointercombo;
3233
3312
  exports.createReduce = createReduce;
3234
3313
  exports.createReduceAsync = createReduceAsync;
3314
+ exports.createRemove = createRemove;
3235
3315
  exports.createRename = createRename;
3236
3316
  exports.createReorder = createReorder;
3237
3317
  exports.createReplace = createReplace;
@@ -3241,6 +3321,8 @@ exports.createSlug = createSlug;
3241
3321
  exports.createSort = createSort;
3242
3322
  exports.createSwap = createSwap;
3243
3323
  exports.createToEntries = createToEntries;
3324
+ exports.createToFocusable = createToFocusable;
3325
+ exports.createToKeys = createToKeys;
3244
3326
  exports.createUnique = createUnique;
3245
3327
  exports.easingsNetInBack = easingsNetInBack;
3246
3328
  exports.easingsNetInCirc = easingsNetInCirc;