@baleada/logic 0.24.16 → 0.24.17
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 +152 -57
- package/lib/index.d.ts +32 -7
- package/lib/index.js +151 -58
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -864,7 +864,7 @@ const observerAssertionsByType = {
|
|
|
864
864
|
resize: (observer) => observer instanceof ResizeObserver
|
|
865
865
|
};
|
|
866
866
|
|
|
867
|
-
const defaultOptions$
|
|
867
|
+
const defaultOptions$l = {
|
|
868
868
|
minDuration: 0,
|
|
869
869
|
preventsDefaultUnlessDenied: true,
|
|
870
870
|
toCode: (alias) => fromAliasToCode(alias),
|
|
@@ -880,7 +880,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
|
|
|
880
880
|
onDown,
|
|
881
881
|
onUp,
|
|
882
882
|
onVisibilitychange
|
|
883
|
-
} = { ...defaultOptions$
|
|
883
|
+
} = { ...defaultOptions$l, ...options }, {
|
|
884
884
|
matchPredicatesByKeycombo,
|
|
885
885
|
getDownCombos,
|
|
886
886
|
predicateValid,
|
|
@@ -1017,7 +1017,7 @@ class Keypress extends Listenable {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
|
-
const defaultOptions$
|
|
1020
|
+
const defaultOptions$k = {
|
|
1021
1021
|
minDuration: 0,
|
|
1022
1022
|
preventsDefaultUnlessDenied: true,
|
|
1023
1023
|
toCode: (alias) => fromAliasToCode(alias),
|
|
@@ -1033,7 +1033,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
|
|
|
1033
1033
|
onDown,
|
|
1034
1034
|
onUp,
|
|
1035
1035
|
onVisibilitychange
|
|
1036
|
-
} = { ...defaultOptions$
|
|
1036
|
+
} = { ...defaultOptions$k, ...options }, {
|
|
1037
1037
|
matchPredicatesByKeycombo,
|
|
1038
1038
|
getDownCombos,
|
|
1039
1039
|
predicateValid,
|
|
@@ -1176,7 +1176,7 @@ class Keyrelease extends Listenable {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
|
|
1179
|
-
const defaultOptions$
|
|
1179
|
+
const defaultOptions$j = {
|
|
1180
1180
|
minDuration: 0,
|
|
1181
1181
|
maxInterval: 5e3,
|
|
1182
1182
|
// VS Code default
|
|
@@ -1195,7 +1195,7 @@ function createKeychord(keycombos, options = {}) {
|
|
|
1195
1195
|
onDown,
|
|
1196
1196
|
onUp,
|
|
1197
1197
|
onVisibilitychange
|
|
1198
|
-
} = { ...defaultOptions$
|
|
1198
|
+
} = { ...defaultOptions$j, ...options }, narrowedKeycombos = keycombos.split(" "), keyStates = createMap((keycombo) => createKeyState({
|
|
1199
1199
|
keycomboOrKeycombos: keycombo,
|
|
1200
1200
|
toLonghand,
|
|
1201
1201
|
toCode,
|
|
@@ -1371,7 +1371,7 @@ class Konami extends Listenable {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
|
|
1374
|
-
const defaultOptions$
|
|
1374
|
+
const defaultOptions$i = {
|
|
1375
1375
|
minDuration: 0,
|
|
1376
1376
|
minDistance: 0
|
|
1377
1377
|
};
|
|
@@ -1380,10 +1380,10 @@ function createMousepress(options = {}) {
|
|
|
1380
1380
|
minDuration,
|
|
1381
1381
|
minDistance,
|
|
1382
1382
|
onDown,
|
|
1383
|
-
|
|
1383
|
+
onOut,
|
|
1384
1384
|
onMove,
|
|
1385
1385
|
onUp
|
|
1386
|
-
} = { ...defaultOptions$
|
|
1386
|
+
} = { ...defaultOptions$i, ...options }, stop = (target) => {
|
|
1387
1387
|
window.cancelAnimationFrame(request);
|
|
1388
1388
|
target.removeEventListener("mousemove", mousemoveEffect);
|
|
1389
1389
|
};
|
|
@@ -1393,16 +1393,16 @@ function createMousepress(options = {}) {
|
|
|
1393
1393
|
const mousedown = (event, api) => {
|
|
1394
1394
|
mouseStatus = "down";
|
|
1395
1395
|
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1396
|
-
storePointerStartMetadata(event, api);
|
|
1397
|
-
storePointerMoveMetadata(event, api);
|
|
1398
|
-
storePointerTimeMetadata(
|
|
1396
|
+
storePointerStartMetadata({ event, api });
|
|
1397
|
+
storePointerMoveMetadata({ event, api });
|
|
1398
|
+
storePointerTimeMetadata({
|
|
1399
1399
|
event,
|
|
1400
1400
|
api,
|
|
1401
|
-
() => mouseStatus === "down",
|
|
1402
|
-
(newRequest) => request = newRequest,
|
|
1401
|
+
getShouldStore: () => mouseStatus === "down",
|
|
1402
|
+
setRequest: (newRequest) => request = newRequest,
|
|
1403
1403
|
// @ts-expect-error
|
|
1404
1404
|
recognize
|
|
1405
|
-
);
|
|
1405
|
+
});
|
|
1406
1406
|
const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
|
|
1407
1407
|
target.addEventListener("mousemove", mousemoveEffect);
|
|
1408
1408
|
onDown?.(toHookApi(api));
|
|
@@ -1410,7 +1410,7 @@ function createMousepress(options = {}) {
|
|
|
1410
1410
|
const mousemove = (event, api) => {
|
|
1411
1411
|
const { pushSequence } = api;
|
|
1412
1412
|
pushSequence(event);
|
|
1413
|
-
storePointerMoveMetadata(event, api);
|
|
1413
|
+
storePointerMoveMetadata({ event, api });
|
|
1414
1414
|
recognize(event, api);
|
|
1415
1415
|
onMove?.(toHookApi(api));
|
|
1416
1416
|
};
|
|
@@ -1420,14 +1420,18 @@ function createMousepress(options = {}) {
|
|
|
1420
1420
|
recognized();
|
|
1421
1421
|
}
|
|
1422
1422
|
};
|
|
1423
|
-
const
|
|
1424
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1423
|
+
const mouseout = (event, api) => {
|
|
1424
|
+
const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
|
|
1425
|
+
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1426
|
+
onOut?.(toHookApi(api));
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1425
1429
|
if (mouseStatus === "down") {
|
|
1426
1430
|
denied();
|
|
1427
1431
|
stop(target);
|
|
1428
1432
|
mouseStatus = "leave";
|
|
1429
1433
|
}
|
|
1430
|
-
|
|
1434
|
+
onOut?.(toHookApi(api));
|
|
1431
1435
|
};
|
|
1432
1436
|
const mouseup = (event, api) => {
|
|
1433
1437
|
const { denied, listenInjection: { optionsByType: { mouseup: { target } } } } = api;
|
|
@@ -1443,7 +1447,7 @@ function createMousepress(options = {}) {
|
|
|
1443
1447
|
effect: mousedown,
|
|
1444
1448
|
stop
|
|
1445
1449
|
},
|
|
1446
|
-
|
|
1450
|
+
mouseout,
|
|
1447
1451
|
mouseup
|
|
1448
1452
|
};
|
|
1449
1453
|
}
|
|
@@ -1463,7 +1467,7 @@ class Mousepress extends Listenable {
|
|
|
1463
1467
|
}
|
|
1464
1468
|
}
|
|
1465
1469
|
|
|
1466
|
-
const defaultOptions$
|
|
1470
|
+
const defaultOptions$h = {
|
|
1467
1471
|
minDuration: 0,
|
|
1468
1472
|
minDistance: 0,
|
|
1469
1473
|
minVelocity: 0
|
|
@@ -1474,10 +1478,10 @@ function createMouserelease(options = {}) {
|
|
|
1474
1478
|
minDistance,
|
|
1475
1479
|
minVelocity,
|
|
1476
1480
|
onDown,
|
|
1477
|
-
|
|
1481
|
+
onOut,
|
|
1478
1482
|
onMove,
|
|
1479
1483
|
onUp
|
|
1480
|
-
} = { ...defaultOptions$
|
|
1484
|
+
} = { ...defaultOptions$h, ...options }, stop = (target) => {
|
|
1481
1485
|
window.cancelAnimationFrame(request);
|
|
1482
1486
|
target.removeEventListener("mousemove", mousemoveEffect);
|
|
1483
1487
|
};
|
|
@@ -1487,35 +1491,39 @@ function createMouserelease(options = {}) {
|
|
|
1487
1491
|
const mousedown = (event, api) => {
|
|
1488
1492
|
mouseStatus = "down";
|
|
1489
1493
|
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1490
|
-
storePointerStartMetadata(event, api);
|
|
1491
|
-
storePointerMoveMetadata(event, api);
|
|
1492
|
-
storePointerTimeMetadata(
|
|
1494
|
+
storePointerStartMetadata({ event, api });
|
|
1495
|
+
storePointerMoveMetadata({ event, api });
|
|
1496
|
+
storePointerTimeMetadata({
|
|
1493
1497
|
event,
|
|
1494
1498
|
api,
|
|
1495
|
-
() => mouseStatus === "down",
|
|
1496
|
-
(newRequest) => request = newRequest
|
|
1497
|
-
);
|
|
1499
|
+
getShouldStore: () => mouseStatus === "down",
|
|
1500
|
+
setRequest: (newRequest) => request = newRequest
|
|
1501
|
+
});
|
|
1498
1502
|
const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
|
|
1499
1503
|
target.addEventListener("mousemove", mousemoveEffect);
|
|
1500
1504
|
onDown?.(toHookApi(api));
|
|
1501
1505
|
};
|
|
1502
1506
|
const mousemove = (event, api) => {
|
|
1503
|
-
storePointerMoveMetadata(event, api);
|
|
1507
|
+
storePointerMoveMetadata({ event, api });
|
|
1504
1508
|
onMove?.(toHookApi(api));
|
|
1505
1509
|
};
|
|
1506
|
-
const
|
|
1507
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1510
|
+
const mouseout = (event, api) => {
|
|
1511
|
+
const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
|
|
1512
|
+
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1513
|
+
onOut?.(toHookApi(api));
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1508
1516
|
if (mouseStatus === "down") {
|
|
1509
1517
|
denied();
|
|
1510
1518
|
stop(target);
|
|
1511
1519
|
mouseStatus = "leave";
|
|
1512
1520
|
}
|
|
1513
|
-
|
|
1521
|
+
onOut?.(toHookApi(api));
|
|
1514
1522
|
};
|
|
1515
1523
|
const mouseup = (event, api) => {
|
|
1516
1524
|
if (mouseStatus !== "down")
|
|
1517
1525
|
return;
|
|
1518
|
-
storePointerMoveMetadata(event, api);
|
|
1526
|
+
storePointerMoveMetadata({ event, api });
|
|
1519
1527
|
const { listenInjection: { optionsByType: { mouseup: { target } } } } = api;
|
|
1520
1528
|
stop(target);
|
|
1521
1529
|
mouseStatus = "up";
|
|
@@ -1535,7 +1543,7 @@ function createMouserelease(options = {}) {
|
|
|
1535
1543
|
effect: mousedown,
|
|
1536
1544
|
stop
|
|
1537
1545
|
},
|
|
1538
|
-
|
|
1546
|
+
mouseout,
|
|
1539
1547
|
mouseup
|
|
1540
1548
|
};
|
|
1541
1549
|
}
|
|
@@ -1555,7 +1563,7 @@ class Mouserelease extends Listenable {
|
|
|
1555
1563
|
}
|
|
1556
1564
|
}
|
|
1557
1565
|
|
|
1558
|
-
const defaultOptions$
|
|
1566
|
+
const defaultOptions$g = {
|
|
1559
1567
|
minDuration: 0,
|
|
1560
1568
|
minDistance: 0
|
|
1561
1569
|
};
|
|
@@ -1567,7 +1575,7 @@ function createTouchpress(options = {}) {
|
|
|
1567
1575
|
onCancel,
|
|
1568
1576
|
onMove,
|
|
1569
1577
|
onEnd
|
|
1570
|
-
} = { ...defaultOptions$
|
|
1578
|
+
} = { ...defaultOptions$g, ...options }, stop = () => {
|
|
1571
1579
|
window.cancelAnimationFrame(request);
|
|
1572
1580
|
};
|
|
1573
1581
|
let request;
|
|
@@ -1581,22 +1589,22 @@ function createTouchpress(options = {}) {
|
|
|
1581
1589
|
onStart?.(toHookApi(api));
|
|
1582
1590
|
return;
|
|
1583
1591
|
}
|
|
1584
|
-
storePointerStartMetadata(event, api);
|
|
1585
|
-
storePointerMoveMetadata(event, api);
|
|
1586
|
-
storePointerTimeMetadata(
|
|
1592
|
+
storePointerStartMetadata({ event, api });
|
|
1593
|
+
storePointerMoveMetadata({ event, api });
|
|
1594
|
+
storePointerTimeMetadata({
|
|
1587
1595
|
event,
|
|
1588
1596
|
api,
|
|
1589
|
-
() => totalTouches === 1,
|
|
1590
|
-
(newRequest) => request = newRequest,
|
|
1597
|
+
getShouldStore: () => totalTouches === 1,
|
|
1598
|
+
setRequest: (newRequest) => request = newRequest,
|
|
1591
1599
|
// @ts-expect-error
|
|
1592
1600
|
recognize
|
|
1593
|
-
);
|
|
1601
|
+
});
|
|
1594
1602
|
onStart?.(toHookApi(api));
|
|
1595
1603
|
};
|
|
1596
1604
|
const touchmove = (event, api) => {
|
|
1597
1605
|
const { getStatus } = api;
|
|
1598
1606
|
if (getStatus() !== "denied") {
|
|
1599
|
-
storePointerMoveMetadata(event, api);
|
|
1607
|
+
storePointerMoveMetadata({ event, api });
|
|
1600
1608
|
recognize(event, api);
|
|
1601
1609
|
}
|
|
1602
1610
|
onMove?.(toHookApi(api));
|
|
@@ -1644,7 +1652,7 @@ class Touchpress extends Listenable {
|
|
|
1644
1652
|
}
|
|
1645
1653
|
}
|
|
1646
1654
|
|
|
1647
|
-
const defaultOptions$
|
|
1655
|
+
const defaultOptions$f = {
|
|
1648
1656
|
minDuration: 0,
|
|
1649
1657
|
minDistance: 0,
|
|
1650
1658
|
minVelocity: 0
|
|
@@ -1658,7 +1666,7 @@ function createTouchrelease(options = {}) {
|
|
|
1658
1666
|
onCancel,
|
|
1659
1667
|
onMove,
|
|
1660
1668
|
onEnd
|
|
1661
|
-
} = { ...defaultOptions$
|
|
1669
|
+
} = { ...defaultOptions$f, ...options }, stop = () => {
|
|
1662
1670
|
window.cancelAnimationFrame(request);
|
|
1663
1671
|
};
|
|
1664
1672
|
let request;
|
|
@@ -1672,20 +1680,20 @@ function createTouchrelease(options = {}) {
|
|
|
1672
1680
|
onStart?.(toHookApi(api));
|
|
1673
1681
|
return;
|
|
1674
1682
|
}
|
|
1675
|
-
storePointerStartMetadata(event, api);
|
|
1676
|
-
storePointerMoveMetadata(event, api);
|
|
1677
|
-
storePointerTimeMetadata(
|
|
1683
|
+
storePointerStartMetadata({ event, api });
|
|
1684
|
+
storePointerMoveMetadata({ event, api });
|
|
1685
|
+
storePointerTimeMetadata({
|
|
1678
1686
|
event,
|
|
1679
1687
|
api,
|
|
1680
|
-
() => totalTouches === 1,
|
|
1681
|
-
(newRequest) => request = newRequest
|
|
1682
|
-
);
|
|
1688
|
+
getShouldStore: () => totalTouches === 1,
|
|
1689
|
+
setRequest: (newRequest) => request = newRequest
|
|
1690
|
+
});
|
|
1683
1691
|
onStart?.(toHookApi(api));
|
|
1684
1692
|
};
|
|
1685
1693
|
const touchmove = (event, api) => {
|
|
1686
1694
|
const { getStatus } = api;
|
|
1687
1695
|
if (getStatus() !== "denied")
|
|
1688
|
-
storePointerMoveMetadata(event, api);
|
|
1696
|
+
storePointerMoveMetadata({ event, api });
|
|
1689
1697
|
onMove?.(toHookApi(api));
|
|
1690
1698
|
};
|
|
1691
1699
|
const touchcancel = (event, api) => {
|
|
@@ -1703,7 +1711,7 @@ function createTouchrelease(options = {}) {
|
|
|
1703
1711
|
onEnd?.(toHookApi(api));
|
|
1704
1712
|
return;
|
|
1705
1713
|
}
|
|
1706
|
-
storePointerMoveMetadata(event, api);
|
|
1714
|
+
storePointerMoveMetadata({ event, api });
|
|
1707
1715
|
stop();
|
|
1708
1716
|
totalTouches--;
|
|
1709
1717
|
recognize(event, api);
|
|
@@ -1740,6 +1748,85 @@ class Touchrelease extends Listenable {
|
|
|
1740
1748
|
}
|
|
1741
1749
|
}
|
|
1742
1750
|
|
|
1751
|
+
const defaultOptions$e = {
|
|
1752
|
+
minDuration: 0
|
|
1753
|
+
};
|
|
1754
|
+
function createHover(options = {}) {
|
|
1755
|
+
const {
|
|
1756
|
+
minDuration,
|
|
1757
|
+
onOver,
|
|
1758
|
+
onOut
|
|
1759
|
+
} = { ...defaultOptions$e, ...options }, stop = () => {
|
|
1760
|
+
window.cancelAnimationFrame(request);
|
|
1761
|
+
};
|
|
1762
|
+
let request;
|
|
1763
|
+
let mouseStatus = "exited";
|
|
1764
|
+
const mouseover = (event, api) => {
|
|
1765
|
+
if (mouseStatus === "exited") {
|
|
1766
|
+
mouseStatus = "entered";
|
|
1767
|
+
storePointerStartMetadata({ event, api });
|
|
1768
|
+
storePointerMoveMetadata({ event, api });
|
|
1769
|
+
storePointerTimeMetadata({
|
|
1770
|
+
event,
|
|
1771
|
+
api,
|
|
1772
|
+
getShouldStore: () => mouseStatus === "entered",
|
|
1773
|
+
setRequest: (newRequest) => request = newRequest,
|
|
1774
|
+
// @ts-expect-error
|
|
1775
|
+
recognize
|
|
1776
|
+
});
|
|
1777
|
+
onOver?.(toHookApi(api));
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
storePointerMoveMetadata({ event, api });
|
|
1781
|
+
onOver?.(toHookApi(api));
|
|
1782
|
+
};
|
|
1783
|
+
const recognize = (event, api) => {
|
|
1784
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1785
|
+
if (metadata.duration >= minDuration) {
|
|
1786
|
+
recognized();
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
const mouseout = (event, api) => {
|
|
1790
|
+
const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
|
|
1791
|
+
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1792
|
+
onOut?.(toHookApi(api));
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
if (mouseStatus === "entered") {
|
|
1796
|
+
denied();
|
|
1797
|
+
stop();
|
|
1798
|
+
mouseStatus = "exited";
|
|
1799
|
+
}
|
|
1800
|
+
onOut?.(toHookApi(api));
|
|
1801
|
+
};
|
|
1802
|
+
const touchstart = (event) => {
|
|
1803
|
+
event.preventDefault();
|
|
1804
|
+
};
|
|
1805
|
+
return {
|
|
1806
|
+
mouseover: {
|
|
1807
|
+
effect: mouseover,
|
|
1808
|
+
stop
|
|
1809
|
+
},
|
|
1810
|
+
mouseout,
|
|
1811
|
+
touchstart
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
class Hover extends Listenable {
|
|
1815
|
+
constructor(options) {
|
|
1816
|
+
super(
|
|
1817
|
+
"recognizeable",
|
|
1818
|
+
{
|
|
1819
|
+
recognizeable: {
|
|
1820
|
+
effects: createHover(options)
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
);
|
|
1824
|
+
}
|
|
1825
|
+
get metadata() {
|
|
1826
|
+
return this.recognizeable.metadata;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1743
1830
|
function createRoot(graph) {
|
|
1744
1831
|
const toIndegree = createIndegree(graph);
|
|
1745
1832
|
return (node) => toIndegree(node) === 0;
|
|
@@ -2938,7 +3025,7 @@ const initialMetadata$2 = {
|
|
|
2938
3025
|
end: { x: 0, y: 0 }
|
|
2939
3026
|
}
|
|
2940
3027
|
};
|
|
2941
|
-
function storePointerStartMetadata(event, api) {
|
|
3028
|
+
function storePointerStartMetadata({ event, api }) {
|
|
2942
3029
|
const { getMetadata } = api, metadata = getMetadata();
|
|
2943
3030
|
const point = event instanceof MouseEvent ? toMousePoint(event) : toTouchMovePoint(event);
|
|
2944
3031
|
if (!metadata.points)
|
|
@@ -2971,7 +3058,7 @@ const initialMetadata$1 = {
|
|
|
2971
3058
|
fromStart: "up"
|
|
2972
3059
|
}
|
|
2973
3060
|
};
|
|
2974
|
-
function storePointerMoveMetadata(event, api) {
|
|
3061
|
+
function storePointerMoveMetadata({ event, api }) {
|
|
2975
3062
|
const { getMetadata } = api, metadata = getMetadata();
|
|
2976
3063
|
if (!metadata.distance) {
|
|
2977
3064
|
metadata.distance = createClone()(initialMetadata$1.distance);
|
|
@@ -3026,7 +3113,13 @@ const initialMetadata = {
|
|
|
3026
3113
|
duration: 0,
|
|
3027
3114
|
velocity: 0
|
|
3028
3115
|
};
|
|
3029
|
-
function storePointerTimeMetadata(
|
|
3116
|
+
function storePointerTimeMetadata({
|
|
3117
|
+
event,
|
|
3118
|
+
api,
|
|
3119
|
+
getShouldStore,
|
|
3120
|
+
setRequest,
|
|
3121
|
+
recognize
|
|
3122
|
+
}) {
|
|
3030
3123
|
const { getSequence, getMetadata, getStatus, listenInjection: { effect } } = api, metadata = getMetadata();
|
|
3031
3124
|
if (!metadata.times) {
|
|
3032
3125
|
metadata.times = createClone()(initialMetadata.times);
|
|
@@ -5516,6 +5609,7 @@ exports.Drawable = Drawable;
|
|
|
5516
5609
|
exports.Fetchable = Fetchable;
|
|
5517
5610
|
exports.Fullscreenable = Fullscreenable;
|
|
5518
5611
|
exports.Grantable = Grantable;
|
|
5612
|
+
exports.Hover = Hover;
|
|
5519
5613
|
exports.Keychord = Keychord;
|
|
5520
5614
|
exports.Keypress = Keypress;
|
|
5521
5615
|
exports.Keyrelease = Keyrelease;
|
|
@@ -5587,6 +5681,7 @@ exports.createGraph = createGraph;
|
|
|
5587
5681
|
exports.createGreater = createGreater;
|
|
5588
5682
|
exports.createGreaterOrEqual = createGreaterOrEqual;
|
|
5589
5683
|
exports.createHas = createHas;
|
|
5684
|
+
exports.createHover = createHover;
|
|
5590
5685
|
exports.createIncoming = createIncoming;
|
|
5591
5686
|
exports.createIndegree = createIndegree;
|
|
5592
5687
|
exports.createInsert = createInsert;
|
package/lib/index.d.ts
CHANGED
|
@@ -1546,14 +1546,14 @@ declare class Konami extends Listenable<KonamiType, KonamiMetadata> {
|
|
|
1546
1546
|
get metadata(): KeychordMetadata;
|
|
1547
1547
|
}
|
|
1548
1548
|
|
|
1549
|
-
type MousepressType = 'mousedown' | '
|
|
1549
|
+
type MousepressType = 'mousedown' | 'mouseout' | 'mouseup';
|
|
1550
1550
|
type MousepressMetadata = PointerStartMetadata & PointerMoveMetadata & PointerTimeMetadata;
|
|
1551
1551
|
type MousepressOptions = {
|
|
1552
1552
|
minDuration?: number;
|
|
1553
1553
|
minDistance?: number;
|
|
1554
1554
|
onDown?: MousepressHook;
|
|
1555
1555
|
onMove?: MousepressHook;
|
|
1556
|
-
|
|
1556
|
+
onOut?: MousepressHook;
|
|
1557
1557
|
onUp?: MousepressHook;
|
|
1558
1558
|
};
|
|
1559
1559
|
type MousepressHook = (api: MousepressHookApi) => any;
|
|
@@ -1566,7 +1566,7 @@ declare function createMousepress(options?: MousepressOptions): {
|
|
|
1566
1566
|
effect: RecognizeableEffect<"mousedown", MousepressMetadata>;
|
|
1567
1567
|
stop: (target: RecognizeableStopTarget<MousepressType>) => void;
|
|
1568
1568
|
};
|
|
1569
|
-
|
|
1569
|
+
mouseout: RecognizeableEffect<"mouseout", MousepressMetadata>;
|
|
1570
1570
|
mouseup: RecognizeableEffect<"mouseup", MousepressMetadata>;
|
|
1571
1571
|
};
|
|
1572
1572
|
declare class Mousepress extends Listenable<MousepressType, MousepressMetadata> {
|
|
@@ -1574,7 +1574,7 @@ declare class Mousepress extends Listenable<MousepressType, MousepressMetadata>
|
|
|
1574
1574
|
get metadata(): MousepressMetadata;
|
|
1575
1575
|
}
|
|
1576
1576
|
|
|
1577
|
-
type MousereleaseType = 'mousedown' | '
|
|
1577
|
+
type MousereleaseType = 'mousedown' | 'mouseout' | 'mouseup';
|
|
1578
1578
|
type MousereleaseMetadata = PointerStartMetadata & PointerMoveMetadata & PointerTimeMetadata;
|
|
1579
1579
|
type MousereleaseOptions = {
|
|
1580
1580
|
minDuration?: number;
|
|
@@ -1582,7 +1582,7 @@ type MousereleaseOptions = {
|
|
|
1582
1582
|
minVelocity?: number;
|
|
1583
1583
|
onDown?: MousereleaseHook;
|
|
1584
1584
|
onMove?: MousereleaseHook;
|
|
1585
|
-
|
|
1585
|
+
onOut?: MousereleaseHook;
|
|
1586
1586
|
onUp?: MousereleaseHook;
|
|
1587
1587
|
};
|
|
1588
1588
|
type MousereleaseHook = (api: MousereleaseHookApi) => any;
|
|
@@ -1595,7 +1595,7 @@ declare function createMouserelease(options?: MousereleaseOptions): {
|
|
|
1595
1595
|
effect: RecognizeableEffect<"mousedown", MousereleaseMetadata>;
|
|
1596
1596
|
stop: (target: RecognizeableStopTarget<MousereleaseType>) => void;
|
|
1597
1597
|
};
|
|
1598
|
-
|
|
1598
|
+
mouseout: RecognizeableEffect<"mouseout", MousereleaseMetadata>;
|
|
1599
1599
|
mouseup: RecognizeableEffect<"mouseup", MousereleaseMetadata>;
|
|
1600
1600
|
};
|
|
1601
1601
|
declare class Mouserelease extends Listenable<MousereleaseType, MousereleaseMetadata> {
|
|
@@ -1650,4 +1650,29 @@ declare class Touchrelease extends Listenable<TouchreleaseType, TouchreleaseMeta
|
|
|
1650
1650
|
get metadata(): TouchreleaseMetadata;
|
|
1651
1651
|
}
|
|
1652
1652
|
|
|
1653
|
-
|
|
1653
|
+
type HoverType = 'mouseover' | 'mouseout' | 'touchstart';
|
|
1654
|
+
type HoverMetadata = (PointerStartMetadata & PointerMoveMetadata & PointerTimeMetadata);
|
|
1655
|
+
type HoverOptions = {
|
|
1656
|
+
minDuration?: number;
|
|
1657
|
+
onOver?: HoverHook;
|
|
1658
|
+
onOut?: HoverHook;
|
|
1659
|
+
};
|
|
1660
|
+
type HoverHook = (api: HoverHookApi) => any;
|
|
1661
|
+
type HoverHookApi = HookApi<HoverType, HoverMetadata>;
|
|
1662
|
+
/**
|
|
1663
|
+
* [Docs](https://baleada.dev/docs/logic/factories/hover)
|
|
1664
|
+
*/
|
|
1665
|
+
declare function createHover(options?: HoverOptions): {
|
|
1666
|
+
mouseover: {
|
|
1667
|
+
effect: RecognizeableEffect<"mouseover", HoverMetadata>;
|
|
1668
|
+
stop: () => void;
|
|
1669
|
+
};
|
|
1670
|
+
mouseout: RecognizeableEffect<"mouseout", HoverMetadata>;
|
|
1671
|
+
touchstart: RecognizeableEffect<"touchstart", HoverMetadata>;
|
|
1672
|
+
};
|
|
1673
|
+
declare class Hover extends Listenable<HoverType, HoverMetadata> {
|
|
1674
|
+
constructor(options?: HoverOptions);
|
|
1675
|
+
get metadata(): HoverMetadata;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
export { AnimateFrame, AnimateFrameEffect, AnimateOptions, Animateable, AnimateableKeyframe, AnimateableOptions, AnimateableStatus, Broadcastable, BroadcastableOptions, BroadcastableStatus, ColorInterpolationMethod, Compareable, CompareableOptions, CompareableStatus, CompleteOptions, Completeable, CompleteableOptions, CompleteableStatus, Copyable, CopyableOptions, CopyableStatus, CreateStepsOptions$1 as CreateDirectedAcyclicStepsOptions, CreateFocusableOptions, CreateGraphOptions, CreateKeycomboMatchOptions, CreateMixOptions, CreatePathConfig, CreateResultsOptions, Delayable, DelayableEffect, DelayableOptions, DelayableStatus, Drawable, DrawableOptions, DrawableStatus, DrawableStroke, Fetchable, FetchableOptions, FetchableStatus, Fullscreenable, FullscreenableGetElement, FullscreenableOptions, FullscreenableStatus, Grantable, GrantableOptions, GrantableStatus, Hover, HoverHook, HoverHookApi, HoverMetadata, HoverOptions, HoverType, Keychord, KeychordHook, KeychordHookApi, KeychordMetadata, KeychordOptions, KeychordType, Keypress, KeypressHook, KeypressHookApi, KeypressMetadata, KeypressOptions, KeypressType, Keyrelease, KeyreleaseHook, KeyreleaseHookApi, KeyreleaseMetadata, KeyreleaseOptions, KeyreleaseType, Konami, KonamiHook, KonamiHookApi, KonamiMetadata, KonamiOptions, KonamiType, ListenEffect, ListenEffectParam, ListenOptions, Listenable, ListenableActive, ListenableKeycombo, ListenableMousecombo, ListenableOptions, ListenablePointercombo, ListenableStatus, ListenableSupportedEventType, ListenableSupportedType, MixColor, Mousepress, MousepressHook, MousepressHookApi, MousepressMetadata, MousepressOptions, MousepressType, Mouserelease, MousereleaseHook, MousereleaseHookApi, MousereleaseMetadata, MousereleaseOptions, MousereleaseType, Navigateable, NavigateableOptions, NavigateableStatus, PickOptions, Pickable, PickableOptions, PickableStatus, Potentiality, RecognizeOptions, Recognizeable, RecognizeableEffect, RecognizeableEffectConfig, RecognizeableOptions, RecognizeableStatus, RecognizeableStopTarget, Resolveable, ResolveableOptions, ResolveableStatus, Shareable, ShareableOptions, ShareableStatus, Storeable, StoreableOptions, StoreableStatus, ToGraphYielded, Touchpress, TouchpressHook, TouchpressHookApi, TouchpressMetadata, TouchpressOptions, TouchpressType, Touchrelease, TouchreleaseHook, TouchreleaseHookApi, TouchreleaseMetadata, TouchreleaseOptions, TouchreleaseType, createFormat$2 as createArrayFormat, createClear$1 as createAssociativeArrayClear, createDelete$1 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$1 as createAssociativeArraySet, createValue$1 as createAssociativeArrayValue, createValues as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createHover, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createMousepress, createMouserelease, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createTouchpress, createTouchrelease, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
|
package/lib/index.js
CHANGED
|
@@ -862,7 +862,7 @@ const observerAssertionsByType = {
|
|
|
862
862
|
resize: (observer) => observer instanceof ResizeObserver
|
|
863
863
|
};
|
|
864
864
|
|
|
865
|
-
const defaultOptions$
|
|
865
|
+
const defaultOptions$l = {
|
|
866
866
|
minDuration: 0,
|
|
867
867
|
preventsDefaultUnlessDenied: true,
|
|
868
868
|
toCode: (alias) => fromAliasToCode(alias),
|
|
@@ -878,7 +878,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
|
|
|
878
878
|
onDown,
|
|
879
879
|
onUp,
|
|
880
880
|
onVisibilitychange
|
|
881
|
-
} = { ...defaultOptions$
|
|
881
|
+
} = { ...defaultOptions$l, ...options }, {
|
|
882
882
|
matchPredicatesByKeycombo,
|
|
883
883
|
getDownCombos,
|
|
884
884
|
predicateValid,
|
|
@@ -1015,7 +1015,7 @@ class Keypress extends Listenable {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
-
const defaultOptions$
|
|
1018
|
+
const defaultOptions$k = {
|
|
1019
1019
|
minDuration: 0,
|
|
1020
1020
|
preventsDefaultUnlessDenied: true,
|
|
1021
1021
|
toCode: (alias) => fromAliasToCode(alias),
|
|
@@ -1031,7 +1031,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
|
|
|
1031
1031
|
onDown,
|
|
1032
1032
|
onUp,
|
|
1033
1033
|
onVisibilitychange
|
|
1034
|
-
} = { ...defaultOptions$
|
|
1034
|
+
} = { ...defaultOptions$k, ...options }, {
|
|
1035
1035
|
matchPredicatesByKeycombo,
|
|
1036
1036
|
getDownCombos,
|
|
1037
1037
|
predicateValid,
|
|
@@ -1174,7 +1174,7 @@ class Keyrelease extends Listenable {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
|
|
1177
|
-
const defaultOptions$
|
|
1177
|
+
const defaultOptions$j = {
|
|
1178
1178
|
minDuration: 0,
|
|
1179
1179
|
maxInterval: 5e3,
|
|
1180
1180
|
// VS Code default
|
|
@@ -1193,7 +1193,7 @@ function createKeychord(keycombos, options = {}) {
|
|
|
1193
1193
|
onDown,
|
|
1194
1194
|
onUp,
|
|
1195
1195
|
onVisibilitychange
|
|
1196
|
-
} = { ...defaultOptions$
|
|
1196
|
+
} = { ...defaultOptions$j, ...options }, narrowedKeycombos = keycombos.split(" "), keyStates = createMap((keycombo) => createKeyState({
|
|
1197
1197
|
keycomboOrKeycombos: keycombo,
|
|
1198
1198
|
toLonghand,
|
|
1199
1199
|
toCode,
|
|
@@ -1369,7 +1369,7 @@ class Konami extends Listenable {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
1371
|
|
|
1372
|
-
const defaultOptions$
|
|
1372
|
+
const defaultOptions$i = {
|
|
1373
1373
|
minDuration: 0,
|
|
1374
1374
|
minDistance: 0
|
|
1375
1375
|
};
|
|
@@ -1378,10 +1378,10 @@ function createMousepress(options = {}) {
|
|
|
1378
1378
|
minDuration,
|
|
1379
1379
|
minDistance,
|
|
1380
1380
|
onDown,
|
|
1381
|
-
|
|
1381
|
+
onOut,
|
|
1382
1382
|
onMove,
|
|
1383
1383
|
onUp
|
|
1384
|
-
} = { ...defaultOptions$
|
|
1384
|
+
} = { ...defaultOptions$i, ...options }, stop = (target) => {
|
|
1385
1385
|
window.cancelAnimationFrame(request);
|
|
1386
1386
|
target.removeEventListener("mousemove", mousemoveEffect);
|
|
1387
1387
|
};
|
|
@@ -1391,16 +1391,16 @@ function createMousepress(options = {}) {
|
|
|
1391
1391
|
const mousedown = (event, api) => {
|
|
1392
1392
|
mouseStatus = "down";
|
|
1393
1393
|
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1394
|
-
storePointerStartMetadata(event, api);
|
|
1395
|
-
storePointerMoveMetadata(event, api);
|
|
1396
|
-
storePointerTimeMetadata(
|
|
1394
|
+
storePointerStartMetadata({ event, api });
|
|
1395
|
+
storePointerMoveMetadata({ event, api });
|
|
1396
|
+
storePointerTimeMetadata({
|
|
1397
1397
|
event,
|
|
1398
1398
|
api,
|
|
1399
|
-
() => mouseStatus === "down",
|
|
1400
|
-
(newRequest) => request = newRequest,
|
|
1399
|
+
getShouldStore: () => mouseStatus === "down",
|
|
1400
|
+
setRequest: (newRequest) => request = newRequest,
|
|
1401
1401
|
// @ts-expect-error
|
|
1402
1402
|
recognize
|
|
1403
|
-
);
|
|
1403
|
+
});
|
|
1404
1404
|
const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
|
|
1405
1405
|
target.addEventListener("mousemove", mousemoveEffect);
|
|
1406
1406
|
onDown?.(toHookApi(api));
|
|
@@ -1408,7 +1408,7 @@ function createMousepress(options = {}) {
|
|
|
1408
1408
|
const mousemove = (event, api) => {
|
|
1409
1409
|
const { pushSequence } = api;
|
|
1410
1410
|
pushSequence(event);
|
|
1411
|
-
storePointerMoveMetadata(event, api);
|
|
1411
|
+
storePointerMoveMetadata({ event, api });
|
|
1412
1412
|
recognize(event, api);
|
|
1413
1413
|
onMove?.(toHookApi(api));
|
|
1414
1414
|
};
|
|
@@ -1418,14 +1418,18 @@ function createMousepress(options = {}) {
|
|
|
1418
1418
|
recognized();
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
|
-
const
|
|
1422
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1421
|
+
const mouseout = (event, api) => {
|
|
1422
|
+
const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
|
|
1423
|
+
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1424
|
+
onOut?.(toHookApi(api));
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1423
1427
|
if (mouseStatus === "down") {
|
|
1424
1428
|
denied();
|
|
1425
1429
|
stop(target);
|
|
1426
1430
|
mouseStatus = "leave";
|
|
1427
1431
|
}
|
|
1428
|
-
|
|
1432
|
+
onOut?.(toHookApi(api));
|
|
1429
1433
|
};
|
|
1430
1434
|
const mouseup = (event, api) => {
|
|
1431
1435
|
const { denied, listenInjection: { optionsByType: { mouseup: { target } } } } = api;
|
|
@@ -1441,7 +1445,7 @@ function createMousepress(options = {}) {
|
|
|
1441
1445
|
effect: mousedown,
|
|
1442
1446
|
stop
|
|
1443
1447
|
},
|
|
1444
|
-
|
|
1448
|
+
mouseout,
|
|
1445
1449
|
mouseup
|
|
1446
1450
|
};
|
|
1447
1451
|
}
|
|
@@ -1461,7 +1465,7 @@ class Mousepress extends Listenable {
|
|
|
1461
1465
|
}
|
|
1462
1466
|
}
|
|
1463
1467
|
|
|
1464
|
-
const defaultOptions$
|
|
1468
|
+
const defaultOptions$h = {
|
|
1465
1469
|
minDuration: 0,
|
|
1466
1470
|
minDistance: 0,
|
|
1467
1471
|
minVelocity: 0
|
|
@@ -1472,10 +1476,10 @@ function createMouserelease(options = {}) {
|
|
|
1472
1476
|
minDistance,
|
|
1473
1477
|
minVelocity,
|
|
1474
1478
|
onDown,
|
|
1475
|
-
|
|
1479
|
+
onOut,
|
|
1476
1480
|
onMove,
|
|
1477
1481
|
onUp
|
|
1478
|
-
} = { ...defaultOptions$
|
|
1482
|
+
} = { ...defaultOptions$h, ...options }, stop = (target) => {
|
|
1479
1483
|
window.cancelAnimationFrame(request);
|
|
1480
1484
|
target.removeEventListener("mousemove", mousemoveEffect);
|
|
1481
1485
|
};
|
|
@@ -1485,35 +1489,39 @@ function createMouserelease(options = {}) {
|
|
|
1485
1489
|
const mousedown = (event, api) => {
|
|
1486
1490
|
mouseStatus = "down";
|
|
1487
1491
|
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1488
|
-
storePointerStartMetadata(event, api);
|
|
1489
|
-
storePointerMoveMetadata(event, api);
|
|
1490
|
-
storePointerTimeMetadata(
|
|
1492
|
+
storePointerStartMetadata({ event, api });
|
|
1493
|
+
storePointerMoveMetadata({ event, api });
|
|
1494
|
+
storePointerTimeMetadata({
|
|
1491
1495
|
event,
|
|
1492
1496
|
api,
|
|
1493
|
-
() => mouseStatus === "down",
|
|
1494
|
-
(newRequest) => request = newRequest
|
|
1495
|
-
);
|
|
1497
|
+
getShouldStore: () => mouseStatus === "down",
|
|
1498
|
+
setRequest: (newRequest) => request = newRequest
|
|
1499
|
+
});
|
|
1496
1500
|
const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
|
|
1497
1501
|
target.addEventListener("mousemove", mousemoveEffect);
|
|
1498
1502
|
onDown?.(toHookApi(api));
|
|
1499
1503
|
};
|
|
1500
1504
|
const mousemove = (event, api) => {
|
|
1501
|
-
storePointerMoveMetadata(event, api);
|
|
1505
|
+
storePointerMoveMetadata({ event, api });
|
|
1502
1506
|
onMove?.(toHookApi(api));
|
|
1503
1507
|
};
|
|
1504
|
-
const
|
|
1505
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1508
|
+
const mouseout = (event, api) => {
|
|
1509
|
+
const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
|
|
1510
|
+
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1511
|
+
onOut?.(toHookApi(api));
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1506
1514
|
if (mouseStatus === "down") {
|
|
1507
1515
|
denied();
|
|
1508
1516
|
stop(target);
|
|
1509
1517
|
mouseStatus = "leave";
|
|
1510
1518
|
}
|
|
1511
|
-
|
|
1519
|
+
onOut?.(toHookApi(api));
|
|
1512
1520
|
};
|
|
1513
1521
|
const mouseup = (event, api) => {
|
|
1514
1522
|
if (mouseStatus !== "down")
|
|
1515
1523
|
return;
|
|
1516
|
-
storePointerMoveMetadata(event, api);
|
|
1524
|
+
storePointerMoveMetadata({ event, api });
|
|
1517
1525
|
const { listenInjection: { optionsByType: { mouseup: { target } } } } = api;
|
|
1518
1526
|
stop(target);
|
|
1519
1527
|
mouseStatus = "up";
|
|
@@ -1533,7 +1541,7 @@ function createMouserelease(options = {}) {
|
|
|
1533
1541
|
effect: mousedown,
|
|
1534
1542
|
stop
|
|
1535
1543
|
},
|
|
1536
|
-
|
|
1544
|
+
mouseout,
|
|
1537
1545
|
mouseup
|
|
1538
1546
|
};
|
|
1539
1547
|
}
|
|
@@ -1553,7 +1561,7 @@ class Mouserelease extends Listenable {
|
|
|
1553
1561
|
}
|
|
1554
1562
|
}
|
|
1555
1563
|
|
|
1556
|
-
const defaultOptions$
|
|
1564
|
+
const defaultOptions$g = {
|
|
1557
1565
|
minDuration: 0,
|
|
1558
1566
|
minDistance: 0
|
|
1559
1567
|
};
|
|
@@ -1565,7 +1573,7 @@ function createTouchpress(options = {}) {
|
|
|
1565
1573
|
onCancel,
|
|
1566
1574
|
onMove,
|
|
1567
1575
|
onEnd
|
|
1568
|
-
} = { ...defaultOptions$
|
|
1576
|
+
} = { ...defaultOptions$g, ...options }, stop = () => {
|
|
1569
1577
|
window.cancelAnimationFrame(request);
|
|
1570
1578
|
};
|
|
1571
1579
|
let request;
|
|
@@ -1579,22 +1587,22 @@ function createTouchpress(options = {}) {
|
|
|
1579
1587
|
onStart?.(toHookApi(api));
|
|
1580
1588
|
return;
|
|
1581
1589
|
}
|
|
1582
|
-
storePointerStartMetadata(event, api);
|
|
1583
|
-
storePointerMoveMetadata(event, api);
|
|
1584
|
-
storePointerTimeMetadata(
|
|
1590
|
+
storePointerStartMetadata({ event, api });
|
|
1591
|
+
storePointerMoveMetadata({ event, api });
|
|
1592
|
+
storePointerTimeMetadata({
|
|
1585
1593
|
event,
|
|
1586
1594
|
api,
|
|
1587
|
-
() => totalTouches === 1,
|
|
1588
|
-
(newRequest) => request = newRequest,
|
|
1595
|
+
getShouldStore: () => totalTouches === 1,
|
|
1596
|
+
setRequest: (newRequest) => request = newRequest,
|
|
1589
1597
|
// @ts-expect-error
|
|
1590
1598
|
recognize
|
|
1591
|
-
);
|
|
1599
|
+
});
|
|
1592
1600
|
onStart?.(toHookApi(api));
|
|
1593
1601
|
};
|
|
1594
1602
|
const touchmove = (event, api) => {
|
|
1595
1603
|
const { getStatus } = api;
|
|
1596
1604
|
if (getStatus() !== "denied") {
|
|
1597
|
-
storePointerMoveMetadata(event, api);
|
|
1605
|
+
storePointerMoveMetadata({ event, api });
|
|
1598
1606
|
recognize(event, api);
|
|
1599
1607
|
}
|
|
1600
1608
|
onMove?.(toHookApi(api));
|
|
@@ -1642,7 +1650,7 @@ class Touchpress extends Listenable {
|
|
|
1642
1650
|
}
|
|
1643
1651
|
}
|
|
1644
1652
|
|
|
1645
|
-
const defaultOptions$
|
|
1653
|
+
const defaultOptions$f = {
|
|
1646
1654
|
minDuration: 0,
|
|
1647
1655
|
minDistance: 0,
|
|
1648
1656
|
minVelocity: 0
|
|
@@ -1656,7 +1664,7 @@ function createTouchrelease(options = {}) {
|
|
|
1656
1664
|
onCancel,
|
|
1657
1665
|
onMove,
|
|
1658
1666
|
onEnd
|
|
1659
|
-
} = { ...defaultOptions$
|
|
1667
|
+
} = { ...defaultOptions$f, ...options }, stop = () => {
|
|
1660
1668
|
window.cancelAnimationFrame(request);
|
|
1661
1669
|
};
|
|
1662
1670
|
let request;
|
|
@@ -1670,20 +1678,20 @@ function createTouchrelease(options = {}) {
|
|
|
1670
1678
|
onStart?.(toHookApi(api));
|
|
1671
1679
|
return;
|
|
1672
1680
|
}
|
|
1673
|
-
storePointerStartMetadata(event, api);
|
|
1674
|
-
storePointerMoveMetadata(event, api);
|
|
1675
|
-
storePointerTimeMetadata(
|
|
1681
|
+
storePointerStartMetadata({ event, api });
|
|
1682
|
+
storePointerMoveMetadata({ event, api });
|
|
1683
|
+
storePointerTimeMetadata({
|
|
1676
1684
|
event,
|
|
1677
1685
|
api,
|
|
1678
|
-
() => totalTouches === 1,
|
|
1679
|
-
(newRequest) => request = newRequest
|
|
1680
|
-
);
|
|
1686
|
+
getShouldStore: () => totalTouches === 1,
|
|
1687
|
+
setRequest: (newRequest) => request = newRequest
|
|
1688
|
+
});
|
|
1681
1689
|
onStart?.(toHookApi(api));
|
|
1682
1690
|
};
|
|
1683
1691
|
const touchmove = (event, api) => {
|
|
1684
1692
|
const { getStatus } = api;
|
|
1685
1693
|
if (getStatus() !== "denied")
|
|
1686
|
-
storePointerMoveMetadata(event, api);
|
|
1694
|
+
storePointerMoveMetadata({ event, api });
|
|
1687
1695
|
onMove?.(toHookApi(api));
|
|
1688
1696
|
};
|
|
1689
1697
|
const touchcancel = (event, api) => {
|
|
@@ -1701,7 +1709,7 @@ function createTouchrelease(options = {}) {
|
|
|
1701
1709
|
onEnd?.(toHookApi(api));
|
|
1702
1710
|
return;
|
|
1703
1711
|
}
|
|
1704
|
-
storePointerMoveMetadata(event, api);
|
|
1712
|
+
storePointerMoveMetadata({ event, api });
|
|
1705
1713
|
stop();
|
|
1706
1714
|
totalTouches--;
|
|
1707
1715
|
recognize(event, api);
|
|
@@ -1738,6 +1746,85 @@ class Touchrelease extends Listenable {
|
|
|
1738
1746
|
}
|
|
1739
1747
|
}
|
|
1740
1748
|
|
|
1749
|
+
const defaultOptions$e = {
|
|
1750
|
+
minDuration: 0
|
|
1751
|
+
};
|
|
1752
|
+
function createHover(options = {}) {
|
|
1753
|
+
const {
|
|
1754
|
+
minDuration,
|
|
1755
|
+
onOver,
|
|
1756
|
+
onOut
|
|
1757
|
+
} = { ...defaultOptions$e, ...options }, stop = () => {
|
|
1758
|
+
window.cancelAnimationFrame(request);
|
|
1759
|
+
};
|
|
1760
|
+
let request;
|
|
1761
|
+
let mouseStatus = "exited";
|
|
1762
|
+
const mouseover = (event, api) => {
|
|
1763
|
+
if (mouseStatus === "exited") {
|
|
1764
|
+
mouseStatus = "entered";
|
|
1765
|
+
storePointerStartMetadata({ event, api });
|
|
1766
|
+
storePointerMoveMetadata({ event, api });
|
|
1767
|
+
storePointerTimeMetadata({
|
|
1768
|
+
event,
|
|
1769
|
+
api,
|
|
1770
|
+
getShouldStore: () => mouseStatus === "entered",
|
|
1771
|
+
setRequest: (newRequest) => request = newRequest,
|
|
1772
|
+
// @ts-expect-error
|
|
1773
|
+
recognize
|
|
1774
|
+
});
|
|
1775
|
+
onOver?.(toHookApi(api));
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
storePointerMoveMetadata({ event, api });
|
|
1779
|
+
onOver?.(toHookApi(api));
|
|
1780
|
+
};
|
|
1781
|
+
const recognize = (event, api) => {
|
|
1782
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1783
|
+
if (metadata.duration >= minDuration) {
|
|
1784
|
+
recognized();
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
const mouseout = (event, api) => {
|
|
1788
|
+
const { denied, listenInjection: { optionsByType: { mouseout: { target } } } } = api;
|
|
1789
|
+
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1790
|
+
onOut?.(toHookApi(api));
|
|
1791
|
+
return;
|
|
1792
|
+
}
|
|
1793
|
+
if (mouseStatus === "entered") {
|
|
1794
|
+
denied();
|
|
1795
|
+
stop();
|
|
1796
|
+
mouseStatus = "exited";
|
|
1797
|
+
}
|
|
1798
|
+
onOut?.(toHookApi(api));
|
|
1799
|
+
};
|
|
1800
|
+
const touchstart = (event) => {
|
|
1801
|
+
event.preventDefault();
|
|
1802
|
+
};
|
|
1803
|
+
return {
|
|
1804
|
+
mouseover: {
|
|
1805
|
+
effect: mouseover,
|
|
1806
|
+
stop
|
|
1807
|
+
},
|
|
1808
|
+
mouseout,
|
|
1809
|
+
touchstart
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
class Hover extends Listenable {
|
|
1813
|
+
constructor(options) {
|
|
1814
|
+
super(
|
|
1815
|
+
"recognizeable",
|
|
1816
|
+
{
|
|
1817
|
+
recognizeable: {
|
|
1818
|
+
effects: createHover(options)
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
);
|
|
1822
|
+
}
|
|
1823
|
+
get metadata() {
|
|
1824
|
+
return this.recognizeable.metadata;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1741
1828
|
function createRoot(graph) {
|
|
1742
1829
|
const toIndegree = createIndegree(graph);
|
|
1743
1830
|
return (node) => toIndegree(node) === 0;
|
|
@@ -2936,7 +3023,7 @@ const initialMetadata$2 = {
|
|
|
2936
3023
|
end: { x: 0, y: 0 }
|
|
2937
3024
|
}
|
|
2938
3025
|
};
|
|
2939
|
-
function storePointerStartMetadata(event, api) {
|
|
3026
|
+
function storePointerStartMetadata({ event, api }) {
|
|
2940
3027
|
const { getMetadata } = api, metadata = getMetadata();
|
|
2941
3028
|
const point = event instanceof MouseEvent ? toMousePoint(event) : toTouchMovePoint(event);
|
|
2942
3029
|
if (!metadata.points)
|
|
@@ -2969,7 +3056,7 @@ const initialMetadata$1 = {
|
|
|
2969
3056
|
fromStart: "up"
|
|
2970
3057
|
}
|
|
2971
3058
|
};
|
|
2972
|
-
function storePointerMoveMetadata(event, api) {
|
|
3059
|
+
function storePointerMoveMetadata({ event, api }) {
|
|
2973
3060
|
const { getMetadata } = api, metadata = getMetadata();
|
|
2974
3061
|
if (!metadata.distance) {
|
|
2975
3062
|
metadata.distance = createClone()(initialMetadata$1.distance);
|
|
@@ -3024,7 +3111,13 @@ const initialMetadata = {
|
|
|
3024
3111
|
duration: 0,
|
|
3025
3112
|
velocity: 0
|
|
3026
3113
|
};
|
|
3027
|
-
function storePointerTimeMetadata(
|
|
3114
|
+
function storePointerTimeMetadata({
|
|
3115
|
+
event,
|
|
3116
|
+
api,
|
|
3117
|
+
getShouldStore,
|
|
3118
|
+
setRequest,
|
|
3119
|
+
recognize
|
|
3120
|
+
}) {
|
|
3028
3121
|
const { getSequence, getMetadata, getStatus, listenInjection: { effect } } = api, metadata = getMetadata();
|
|
3029
3122
|
if (!metadata.times) {
|
|
3030
3123
|
metadata.times = createClone()(initialMetadata.times);
|
|
@@ -5504,4 +5597,4 @@ class Storeable {
|
|
|
5504
5597
|
}
|
|
5505
5598
|
}
|
|
5506
5599
|
|
|
5507
|
-
export { Animateable, Broadcastable, Compareable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Keychord, Keypress, Keyrelease, Konami, Listenable, Mousepress, Mouserelease, Navigateable, Pickable, Recognizeable, Resolveable, Shareable, Storeable, Touchpress, Touchrelease, createFormat$2 as createArrayFormat, createClear$2 as createAssociativeArrayClear, createDelete$2 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$2 as createAssociativeArraySet, createValue$2 as createAssociativeArrayValue, createValues$1 as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear$1 as createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDelete$1 as createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch$1 as createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createMousepress, createMouserelease, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet$1 as createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createTouchpress, createTouchrelease, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue$1 as createValue, defineAssociativeArray, defineGraph, defineGraphAsync, defineGraphAsyncEdge, defineGraphAsyncEdges, defineGraphEdge, defineGraphEdges, defineGraphNode, defineGraphNodes, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, fromAliasToCode, fromCodeToAliases, fromKeyboardEventDescriptorToAliases, fromShorthandAliasToLonghandAlias, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
|
|
5600
|
+
export { Animateable, Broadcastable, Compareable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Hover, Keychord, Keypress, Keyrelease, Konami, Listenable, Mousepress, Mouserelease, Navigateable, Pickable, Recognizeable, Resolveable, Shareable, Storeable, Touchpress, Touchrelease, createFormat$2 as createArrayFormat, createClear$2 as createAssociativeArrayClear, createDelete$2 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$2 as createAssociativeArraySet, createValue$2 as createAssociativeArrayValue, createValues$1 as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear$1 as createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDelete$1 as createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createHover, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch$1 as createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createMousepress, createMouserelease, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet$1 as createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createTouchpress, createTouchrelease, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue$1 as createValue, defineAssociativeArray, defineGraph, defineGraphAsync, defineGraphAsyncEdge, defineGraphAsyncEdges, defineGraphEdge, defineGraphEdges, defineGraphNode, defineGraphNodes, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, fromAliasToCode, fromCodeToAliases, fromKeyboardEventDescriptorToAliases, fromShorthandAliasToLonghandAlias, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
|