@baleada/logic 0.22.4 → 0.22.5

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,37 @@ function createToEntries() {
220
220
  return entries;
221
221
  };
222
222
  }
223
+ function createMatchesKeycombo(keycombo) {
224
+ return (event) => eventMatchesKeycombo(event, narrowKeycombo(keycombo));
225
+ }
226
+ function createMatchesMousecombo(mousecombo) {
227
+ return (event) => eventMatchesMousecombo(event, narrowMousecombo(mousecombo));
228
+ }
229
+ function createMatchesPointercombo(pointercombo) {
230
+ return (event) => eventMatchesPointercombo(event, narrowPointercombo(pointercombo));
231
+ }
232
+ function createToFocusable(order, elementIsCandidate) {
233
+ return (element) => {
234
+ if (elementIsCandidate && predicateFocusable(element))
235
+ return element;
236
+ switch (order) {
237
+ case "first":
238
+ for (let i = 0; i < element.children.length; i++) {
239
+ const focusable = createToFocusable(order, true)(element.children[i]);
240
+ if (focusable)
241
+ return focusable;
242
+ }
243
+ break;
244
+ case "last":
245
+ for (let i = element.children.length - 1; i > -1; i--) {
246
+ const focusable = createToFocusable(order, true)(element.children[i]);
247
+ if (focusable)
248
+ return focusable;
249
+ }
250
+ break;
251
+ }
252
+ };
253
+ }
223
254
  class Pipeable {
224
255
  constructor(state) {
225
256
  this.state = state;
@@ -287,16 +318,16 @@ const keysByName = {
287
318
  f20: "F20"
288
319
  };
289
320
  const toListenableKeycomboItems = createMap((name) => ({ name, type: fromComboItemNameToType(name) }));
290
- function ensureKeycombo(type) {
321
+ function narrowKeycombo(type) {
291
322
  return new Pipeable(type).pipe(
292
323
  toCombo,
293
324
  toListenableKeycomboItems
294
325
  );
295
326
  }
296
- function ensureClickcombo(type) {
327
+ function narrowMousecombo(type) {
297
328
  return toCombo(type);
298
329
  }
299
- function ensurePointercombo(type) {
330
+ function narrowPointercombo(type) {
300
331
  return toCombo(type);
301
332
  }
302
333
  const toUnique$1 = lazyCollections.unique();
@@ -343,45 +374,39 @@ function createExceptAndOnlyEffect(type, effect, options) {
343
374
  const { except = [], only = [] } = options;
344
375
  if (type === "keydown" || type === "keyup") {
345
376
  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
- };
377
+ const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true];
349
378
  if (matchesOnly) {
350
- effect(event, api);
379
+ effect(event);
351
380
  return;
352
381
  }
353
382
  if (only.length === 0 && !matchesExcept) {
354
- effect(event, api);
383
+ effect(event);
355
384
  return;
356
385
  }
357
386
  };
358
387
  }
359
388
  if (type === "click" || type === "dblclick" || type === "contextmenu" || type.startsWith("mouse")) {
360
389
  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
- };
390
+ const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true];
364
391
  if (matchesOnly) {
365
- effect(event, api);
392
+ effect(event);
366
393
  return;
367
394
  }
368
395
  if (only.length === 0 && !matchesExcept) {
369
- effect(event, api);
396
+ effect(event);
370
397
  return;
371
398
  }
372
399
  };
373
400
  }
374
401
  if (type.startsWith("pointer")) {
375
402
  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
- };
403
+ const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true];
379
404
  if (matchesOnly) {
380
- effect(event, api);
405
+ effect(event);
381
406
  return;
382
407
  }
383
408
  if (only.length === 0 && !matchesExcept) {
384
- effect(event, api);
409
+ effect(event);
385
410
  return;
386
411
  }
387
412
  };
@@ -398,7 +423,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
398
423
  }
399
424
  };
400
425
  }
401
- function isModified({ event, alias }) {
426
+ function predicateModified({ event, alias }) {
402
427
  return predicatesByModifier[alias]?.(event);
403
428
  }
404
429
  const predicatesByModifier = {
@@ -419,24 +444,43 @@ function domIsAvailable() {
419
444
  return false;
420
445
  }
421
446
  }
422
- function isArray(value) {
447
+ function predicateArray(value) {
423
448
  return Array.isArray(value);
424
449
  }
425
- function isUndefined(value) {
450
+ function predicateUndefined(value) {
426
451
  return value === void 0;
427
452
  }
428
- function isFunction(value) {
453
+ function predicateFunction(value) {
429
454
  return typeof value === "function";
430
455
  }
431
- function isNull(value) {
456
+ function predicateNull(value) {
432
457
  return value === null;
433
458
  }
434
- function isNumber(value) {
459
+ function predicateNumber(value) {
435
460
  return typeof value === "number";
436
461
  }
437
- function isString(value) {
462
+ function predicateString(value) {
438
463
  return typeof value === "string";
439
464
  }
465
+ const tabbableSelector = lazyCollections.join(':not([hidden]):not([tabindex="-1"]),')([
466
+ "input:not([disabled]):not([type=hidden])",
467
+ "select:not([disabled])",
468
+ "textarea:not([disabled])",
469
+ "button:not([disabled])",
470
+ "a[href]",
471
+ "area[href]",
472
+ "summary",
473
+ "iframe",
474
+ "object",
475
+ "embed",
476
+ "audio[controls]",
477
+ "video[controls]",
478
+ "[contenteditable]",
479
+ "[tabindex]:not([disabled])"
480
+ ]);
481
+ function predicateFocusable(element) {
482
+ return element.matches(tabbableSelector);
483
+ }
440
484
 
441
485
  class Recognizeable {
442
486
  maxSequenceLength;
@@ -491,16 +535,16 @@ class Recognizeable {
491
535
  this.computedSequence = sequence;
492
536
  return this;
493
537
  }
494
- recognize(sequenceItem, api, { onRecognized } = {}) {
538
+ recognize(sequenceItem, { onRecognized } = {}) {
495
539
  this.recognizing();
496
- const type = this.toType(sequenceItem), excess = isNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
540
+ const type = this.toType(sequenceItem), excess = predicateNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
497
541
  createSlice(excess)(this.sequence),
498
542
  [sequenceItem]
499
543
  )([]);
500
544
  this.effectApi.getSequence = () => newSequence;
501
545
  this.effectApi.onRecognized = onRecognized || (() => {
502
546
  });
503
- this.effects.get(type)?.(sequenceItem, { ...api, ...this.effectApi });
547
+ this.effects.get(type)?.(sequenceItem, { ...this.effectApi });
504
548
  switch (this.status) {
505
549
  case "denied":
506
550
  this.resetComputedMetadata();
@@ -517,7 +561,7 @@ class Recognizeable {
517
561
  this.computedStatus = "recognizing";
518
562
  }
519
563
  toType(sequenceItem) {
520
- if (isArray(sequenceItem)) {
564
+ if (predicateArray(sequenceItem)) {
521
565
  if (sequenceItem[0] instanceof IntersectionObserverEntry) {
522
566
  return "intersect";
523
567
  }
@@ -629,27 +673,27 @@ class Listenable {
629
673
  }
630
674
  mediaQueryListen(effect, options) {
631
675
  const target = window.matchMedia(this.type);
632
- if (isFunction(options.instantEffect)) {
676
+ if (predicateFunction(options.instantEffect)) {
633
677
  options.instantEffect(target);
634
678
  }
635
- const withApi = (event) => effect(event, {});
679
+ const withApi = (event) => effect(event);
636
680
  target.addEventListener("change", withApi);
637
681
  this.active.add({ target, id: ["change", withApi] });
638
682
  }
639
683
  idleListen(effect, options) {
640
- const { requestIdleCallback } = options, id = window.requestIdleCallback((deadline) => effect(deadline, {}), requestIdleCallback);
684
+ const { requestIdleCallback } = options, id = window.requestIdleCallback((deadline) => effect(deadline), requestIdleCallback);
641
685
  this.active.add({ target: window, id });
642
686
  }
643
687
  messageListen(effect, options) {
644
688
  const { target = new BroadcastChannel("baleada") } = options;
645
- target.addEventListener(this.type, (event) => effect(event, {}));
689
+ target.addEventListener(this.type, (event) => effect(event));
646
690
  this.active.add({ target, id: [this.type, effect] });
647
691
  }
648
692
  recognizeableListen(effect, options) {
649
- const guardedEffect = (sequenceItem, api) => {
650
- this.recognizeable.recognize(sequenceItem, api, { onRecognized: (sequenceItem2) => effect(sequenceItem2, api) });
693
+ const guardedEffect = (sequenceItem) => {
694
+ this.recognizeable.recognize(sequenceItem, { onRecognized: (sequenceItem2) => effect(sequenceItem2) });
651
695
  if (this.recognizeable.status === "recognized") {
652
- effect(sequenceItem, api);
696
+ effect(sequenceItem);
653
697
  }
654
698
  };
655
699
  for (const type of this.recognizeableEffectsKeys) {
@@ -659,11 +703,11 @@ class Listenable {
659
703
  }
660
704
  }
661
705
  documentEventListen(effect, options) {
662
- const ensuredOptions = {
706
+ const narrowedOptions = {
663
707
  ...options,
664
708
  target: document
665
709
  };
666
- this.eventListen(effect, ensuredOptions);
710
+ this.eventListen(effect, narrowedOptions);
667
711
  }
668
712
  eventListen(effect, options) {
669
713
  const { exceptAndOnlyEffect, effectOptions } = toAddEventListenerParams(this.type, effect, options), eventListeners = [[this.type, exceptAndOnlyEffect, ...effectOptions]];
@@ -717,7 +761,7 @@ function stop(stoppable) {
717
761
  target2.removeEventListener(id2[0], id2[1]);
718
762
  return;
719
763
  }
720
- if (isNumber(stoppable.id)) {
764
+ if (predicateNumber(stoppable.id)) {
721
765
  const { target: target2, id: id2 } = stoppable;
722
766
  target2.cancelIdleCallback(id2);
723
767
  return;
@@ -806,7 +850,7 @@ function eventMatchesKeycombo(event, keycombo) {
806
850
  if (index === keycombo.length - 1) {
807
851
  return name.startsWith("!") ? event.key.toLowerCase() !== toModifier(name.slice(1)).toLowerCase() : event.key.toLowerCase() === toModifier(name).toLowerCase();
808
852
  }
809
- return name.startsWith("!") ? !isModified({ event, alias: name.slice(1) }) : isModified({ event, alias: name });
853
+ return name.startsWith("!") ? !predicateModified({ event, alias: name.slice(1) }) : predicateModified({ event, alias: name });
810
854
  }
811
855
  })(keycombo);
812
856
  }
@@ -870,11 +914,11 @@ const predicatesByArrow = /* @__PURE__ */ new Map([
870
914
  const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
871
915
  const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
872
916
  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);
917
+ function eventMatchesMousecombo(event, Mousecombo) {
918
+ return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(Mousecombo);
875
919
  }
876
920
  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);
921
+ return lazyCollections.every((name) => fromComboItemNameToType(name) === "pointer" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(pointercombo);
878
922
  }
879
923
  const observerAssertionsByType = {
880
924
  intersect: (observer) => observer instanceof IntersectionObserver,
@@ -1002,13 +1046,13 @@ class Animateable {
1002
1046
  duration;
1003
1047
  totalTimeInvisible;
1004
1048
  setPlaybackRate(playbackRate) {
1005
- const ensuredPlaybackRate = Math.max(0, playbackRate);
1006
- this.computedPlaybackRate = ensuredPlaybackRate;
1007
- this.duration = 1 / ensuredPlaybackRate * this.initialDuration;
1049
+ const narrowedPlaybackRate = Math.max(0, playbackRate);
1050
+ this.computedPlaybackRate = narrowedPlaybackRate;
1051
+ this.duration = 1 / narrowedPlaybackRate * this.initialDuration;
1008
1052
  switch (this.status) {
1009
1053
  case "playing":
1010
1054
  case "reversing":
1011
- this.totalTimeInvisible = 1 / ensuredPlaybackRate * this.totalTimeInvisible;
1055
+ this.totalTimeInvisible = 1 / narrowedPlaybackRate * this.totalTimeInvisible;
1012
1056
  this.seek(this.progress.time);
1013
1057
  break;
1014
1058
  }
@@ -1397,51 +1441,51 @@ class Animateable {
1397
1441
  seek(timeProgress, options = {}) {
1398
1442
  const iterations = Math.floor(timeProgress), naiveIterationProgress = timeProgress - iterations, { effect: naiveEffect } = options;
1399
1443
  this.computedIterations = iterations;
1400
- let ensuredTimeProgress, effect;
1444
+ let narrowedTimeProgress, effect;
1401
1445
  if (this.alternates) {
1402
1446
  if (naiveIterationProgress <= 0.5) {
1403
- ensuredTimeProgress = naiveIterationProgress * 2;
1447
+ narrowedTimeProgress = naiveIterationProgress * 2;
1404
1448
  switch (this.alternateCache.status) {
1405
1449
  case "playing":
1406
1450
  this.cancelAnimate();
1407
- this.seekCache = { timeProgress: ensuredTimeProgress };
1451
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1408
1452
  this.sought();
1409
- effect = isFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1453
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1410
1454
  this.play(effect, this.playCache.options);
1411
1455
  break;
1412
1456
  case "reversing":
1413
1457
  this.cancelAnimate();
1414
- this.seekCache = { timeProgress: ensuredTimeProgress };
1458
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1415
1459
  this.sought();
1416
- effect = isFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1460
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1417
1461
  this.reverse(effect, this.reverseCache.options);
1418
1462
  break;
1419
1463
  default:
1420
- this.seekCache = { timeProgress: ensuredTimeProgress };
1464
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1421
1465
  this.sought();
1422
1466
  effect = naiveEffect;
1423
1467
  this.createAnimate("seek")(effect, options);
1424
1468
  break;
1425
1469
  }
1426
1470
  } else {
1427
- ensuredTimeProgress = (naiveIterationProgress - 0.5) * 2;
1471
+ narrowedTimeProgress = (naiveIterationProgress - 0.5) * 2;
1428
1472
  switch (this.alternateCache.status) {
1429
1473
  case "playing":
1430
1474
  this.cancelAnimate();
1431
- this.seekCache = { timeProgress: ensuredTimeProgress };
1475
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1432
1476
  this.sought();
1433
- effect = isFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1477
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1434
1478
  this.reverse(effect, this.reverseCache.options);
1435
1479
  break;
1436
1480
  case "reversing":
1437
1481
  this.cancelAnimate();
1438
- this.seekCache = { timeProgress: ensuredTimeProgress };
1482
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1439
1483
  this.sought();
1440
- effect = isFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1484
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1441
1485
  this.play(effect, this.playCache.options);
1442
1486
  break;
1443
1487
  default:
1444
- this.seekCache = { timeProgress: ensuredTimeProgress };
1488
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1445
1489
  this.sought();
1446
1490
  effect = naiveEffect;
1447
1491
  if (effect) {
@@ -1451,24 +1495,24 @@ class Animateable {
1451
1495
  }
1452
1496
  }
1453
1497
  } else {
1454
- ensuredTimeProgress = naiveIterationProgress;
1498
+ narrowedTimeProgress = naiveIterationProgress;
1455
1499
  switch (this.status) {
1456
1500
  case "playing":
1457
1501
  this.cancelAnimate();
1458
- this.seekCache = { timeProgress: ensuredTimeProgress };
1502
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1459
1503
  this.sought();
1460
- effect = isFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1504
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.playCache.effect;
1461
1505
  this.play(effect, this.playCache.options);
1462
1506
  break;
1463
1507
  case "reversing":
1464
1508
  this.cancelAnimate();
1465
- this.seekCache = { timeProgress: ensuredTimeProgress };
1509
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1466
1510
  this.sought();
1467
- effect = isFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1511
+ effect = predicateFunction(naiveEffect) ? naiveEffect : this.reverseCache.effect;
1468
1512
  this.reverse(effect, this.reverseCache.options);
1469
1513
  break;
1470
1514
  default:
1471
- this.seekCache = { timeProgress: ensuredTimeProgress };
1515
+ this.seekCache = { timeProgress: narrowedTimeProgress };
1472
1516
  this.sought();
1473
1517
  effect = naiveEffect;
1474
1518
  if (effect) {
@@ -1594,13 +1638,13 @@ function createToAnimationProgress(points) {
1594
1638
  return BezierEasing(point1x, point1y, point2x, point2y);
1595
1639
  }
1596
1640
  function toInterpolated({ previous, next, progress }, options = {}) {
1597
- if (isUndefined(previous)) {
1641
+ if (predicateUndefined(previous)) {
1598
1642
  return next;
1599
1643
  }
1600
- if (isNumber(previous) && isNumber(next)) {
1644
+ if (predicateNumber(previous) && predicateNumber(next)) {
1601
1645
  return (next - previous) * progress + previous;
1602
1646
  }
1603
- if (isString(previous) && isString(next)) {
1647
+ if (predicateString(previous) && predicateString(next)) {
1604
1648
  return color.mix(
1605
1649
  options.colorModel,
1606
1650
  {
@@ -1610,7 +1654,7 @@ function toInterpolated({ previous, next, progress }, options = {}) {
1610
1654
  }
1611
1655
  ).toRgb().toRgbString();
1612
1656
  }
1613
- if (isArray(previous) && isArray(next)) {
1657
+ if (predicateArray(previous) && predicateArray(next)) {
1614
1658
  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
1659
  return createSlice(0, sliceEnd)(sliceTarget);
1616
1660
  }
@@ -1976,7 +2020,7 @@ class Completeable {
1976
2020
  complete(completion, options = {}) {
1977
2021
  this.completing();
1978
2022
  const { select } = { ...defaultCompleteOptions, ...options }, before = this.getBefore(), after = this.getAfter(), completedString = before + completion + after, completedSelection = (() => {
1979
- if (isFunction(select)) {
2023
+ if (predicateFunction(select)) {
1980
2024
  return select({ before, completion, after });
1981
2025
  }
1982
2026
  switch (select) {
@@ -2381,7 +2425,7 @@ class Resolveable {
2381
2425
  this.resolving();
2382
2426
  try {
2383
2427
  const promises = this.getPromise(...args);
2384
- this.computedValue = isArray(promises) ? await createMapAsync(async (promise) => await promise)(promises) : await promises;
2428
+ this.computedValue = predicateArray(promises) ? await createMapAsync(async (promise) => await promise)(promises) : await promises;
2385
2429
  this.resolved();
2386
2430
  } catch (error) {
2387
2431
  this.computedValue = error;
@@ -2466,7 +2510,7 @@ class Fetchable {
2466
2510
  async fetch(options = {}) {
2467
2511
  this.fetching();
2468
2512
  try {
2469
- this.computedResponse = await fetch(this.resource, { signal: this.abortController.signal, ...ensureOptions(options) });
2513
+ this.computedResponse = await fetch(this.resource, { signal: this.abortController.signal, ...narrowOptions(options) });
2470
2514
  this.fetched();
2471
2515
  } catch (error) {
2472
2516
  this.computedError = error;
@@ -2490,23 +2534,23 @@ class Fetchable {
2490
2534
  this.computedStatus = "errored";
2491
2535
  }
2492
2536
  async get(options = {}) {
2493
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "get" });
2537
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "get" });
2494
2538
  return this;
2495
2539
  }
2496
2540
  async patch(options = {}) {
2497
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "patch" });
2541
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "patch" });
2498
2542
  return this;
2499
2543
  }
2500
2544
  async post(options = {}) {
2501
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "post" });
2545
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "post" });
2502
2546
  return this;
2503
2547
  }
2504
2548
  async put(options = {}) {
2505
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "put" });
2549
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "put" });
2506
2550
  return this;
2507
2551
  }
2508
2552
  async delete(options = {}) {
2509
- await this.fetch({ signal: this.abortController.signal, ...ensureOptions(options), method: "delete" });
2553
+ await this.fetch({ signal: this.abortController.signal, ...narrowOptions(options), method: "delete" });
2510
2554
  return this;
2511
2555
  }
2512
2556
  abort() {
@@ -2514,8 +2558,8 @@ class Fetchable {
2514
2558
  return this;
2515
2559
  }
2516
2560
  }
2517
- function ensureOptions(options) {
2518
- return isFunction(options) ? options({ withJson }) : options;
2561
+ function narrowOptions(options) {
2562
+ return predicateFunction(options) ? options({ withJson }) : options;
2519
2563
  }
2520
2564
  function withJson(data) {
2521
2565
  return {
@@ -2698,7 +2742,7 @@ class Navigateable {
2698
2742
  }
2699
2743
  _navigate(location, options = {}) {
2700
2744
  const { allow } = { ...defaultNavigateOptions, ...options };
2701
- const ensuredLocation = (() => {
2745
+ const narrowedLocation = (() => {
2702
2746
  if (allow === "possible") {
2703
2747
  if (location < 0 && allow === "possible") {
2704
2748
  return 0;
@@ -2709,7 +2753,7 @@ class Navigateable {
2709
2753
  }
2710
2754
  return location;
2711
2755
  })();
2712
- this.computedLocation = ensuredLocation;
2756
+ this.computedLocation = narrowedLocation;
2713
2757
  }
2714
2758
  next(options = {}) {
2715
2759
  const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
@@ -2853,7 +2897,7 @@ class Pickable {
2853
2897
  pick(indexOrIndices, options = {}) {
2854
2898
  const { replace, allowsDuplicates } = { ...defaultPickOptions, ...options };
2855
2899
  this.computedPicks = new Pipeable(indexOrIndices).pipe(
2856
- ensureIndices,
2900
+ narrowIndices,
2857
2901
  this.toPossiblePicks,
2858
2902
  (possiblePicks) => {
2859
2903
  if (replace === "all") {
@@ -2906,7 +2950,7 @@ class Pickable {
2906
2950
  this.computedStatus = "picked";
2907
2951
  }
2908
2952
  omit(indexOrIndices, options = { reference: "array" }) {
2909
- if (isUndefined(indexOrIndices)) {
2953
+ if (predicateUndefined(indexOrIndices)) {
2910
2954
  this.computedPicks = [];
2911
2955
  this.computedFirst = void 0;
2912
2956
  this.computedLast = void 0;
@@ -2914,9 +2958,9 @@ class Pickable {
2914
2958
  this.omitted();
2915
2959
  return this;
2916
2960
  }
2917
- const omits = ensureIndices(indexOrIndices);
2961
+ const omits = narrowIndices(indexOrIndices);
2918
2962
  this.computedPicks = createFilter(
2919
- (pick, index) => options.reference === "array" ? isUndefined(lazyCollections.find((omit) => pick === omit)(omits)) : isUndefined(lazyCollections.find((omit) => index === omit)(omits))
2963
+ (pick, index) => options.reference === "array" ? predicateUndefined(lazyCollections.find((omit) => pick === omit)(omits)) : predicateUndefined(lazyCollections.find((omit) => index === omit)(omits))
2920
2964
  )(this.computedPicks);
2921
2965
  this.computedFirst = Math.min(...this.picks);
2922
2966
  this.computedLast = Math.max(...this.picks);
@@ -2928,7 +2972,7 @@ class Pickable {
2928
2972
  this.computedStatus = "omitted";
2929
2973
  }
2930
2974
  }
2931
- function ensureIndices(indexOrIndices) {
2975
+ function narrowIndices(indexOrIndices) {
2932
2976
  return Array.isArray(indexOrIndices) ? indexOrIndices : [indexOrIndices];
2933
2977
  }
2934
2978
  const toUnique = createUnique();
@@ -3100,7 +3144,7 @@ class Storeable {
3100
3144
  ready() {
3101
3145
  this.computedStatus = "ready";
3102
3146
  if (domIsAvailable()) {
3103
- if (isNull(this.storage.getItem(this.computedStatusKey))) {
3147
+ if (predicateNull(this.storage.getItem(this.computedStatusKey))) {
3104
3148
  this.storeStatus();
3105
3149
  }
3106
3150
  }
@@ -3114,7 +3158,7 @@ class Storeable {
3114
3158
  get status() {
3115
3159
  if (domIsAvailable()) {
3116
3160
  const storedStatus = this.storage.getItem(this.computedStatusKey);
3117
- if (this.computedStatus !== storedStatus && isString(storedStatus)) {
3161
+ if (this.computedStatus !== storedStatus && predicateString(storedStatus)) {
3118
3162
  this.computedStatus = storedStatus;
3119
3163
  }
3120
3164
  }
@@ -3222,7 +3266,6 @@ exports.Storeable = Storeable;
3222
3266
  exports.createClamp = createClamp;
3223
3267
  exports.createClip = createClip;
3224
3268
  exports.createConcat = createConcat;
3225
- exports.createDelete = createDelete;
3226
3269
  exports.createDetermine = createDetermine;
3227
3270
  exports.createFilter = createFilter;
3228
3271
  exports.createFilterAsync = createFilterAsync;
@@ -3230,8 +3273,12 @@ exports.createForEachAsync = createForEachAsync;
3230
3273
  exports.createInsert = createInsert;
3231
3274
  exports.createMap = createMap;
3232
3275
  exports.createMapAsync = createMapAsync;
3276
+ exports.createMatchesKeycombo = createMatchesKeycombo;
3277
+ exports.createMatchesMousecombo = createMatchesMousecombo;
3278
+ exports.createMatchesPointercombo = createMatchesPointercombo;
3233
3279
  exports.createReduce = createReduce;
3234
3280
  exports.createReduceAsync = createReduceAsync;
3281
+ exports.createRemove = createRemove;
3235
3282
  exports.createRename = createRename;
3236
3283
  exports.createReorder = createReorder;
3237
3284
  exports.createReplace = createReplace;
@@ -3241,6 +3288,7 @@ exports.createSlug = createSlug;
3241
3288
  exports.createSort = createSort;
3242
3289
  exports.createSwap = createSwap;
3243
3290
  exports.createToEntries = createToEntries;
3291
+ exports.createToFocusable = createToFocusable;
3244
3292
  exports.createUnique = createUnique;
3245
3293
  exports.easingsNetInBack = easingsNetInBack;
3246
3294
  exports.easingsNetInCirc = easingsNetInCirc;