@baleada/logic 0.24.17 → 0.24.19
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 +56 -347
- package/lib/index.d.ts +37 -114
- package/lib/index.js +53 -338
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -121,7 +121,7 @@ const keyStatusKeysByAlias = {
|
|
|
121
121
|
"`": "Backquote",
|
|
122
122
|
"-": "Minus",
|
|
123
123
|
"=": "Equal",
|
|
124
|
-
"": "BracketLeft",
|
|
124
|
+
"[": "BracketLeft",
|
|
125
125
|
"]": "BracketRight",
|
|
126
126
|
"\\": "Backslash",
|
|
127
127
|
";": "Semicolon",
|
|
@@ -864,7 +864,7 @@ const observerAssertionsByType = {
|
|
|
864
864
|
resize: (observer) => observer instanceof ResizeObserver
|
|
865
865
|
};
|
|
866
866
|
|
|
867
|
-
const defaultOptions$
|
|
867
|
+
const defaultOptions$i = {
|
|
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$i, ...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$h = {
|
|
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$h, ...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$g = {
|
|
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$g, ...options }, narrowedKeycombos = keycombos.split(" "), keyStates = createMap((keycombo) => createKeyState({
|
|
1199
1199
|
keycomboOrKeycombos: keycombo,
|
|
1200
1200
|
toLonghand,
|
|
1201
1201
|
toCode,
|
|
@@ -1371,11 +1371,11 @@ class Konami extends Listenable {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
|
|
1374
|
-
const defaultOptions$
|
|
1374
|
+
const defaultOptions$f = {
|
|
1375
1375
|
minDuration: 0,
|
|
1376
1376
|
minDistance: 0
|
|
1377
1377
|
};
|
|
1378
|
-
function
|
|
1378
|
+
function createPointerpress(options = {}) {
|
|
1379
1379
|
const {
|
|
1380
1380
|
minDuration,
|
|
1381
1381
|
minDistance,
|
|
@@ -1383,31 +1383,31 @@ function createMousepress(options = {}) {
|
|
|
1383
1383
|
onOut,
|
|
1384
1384
|
onMove,
|
|
1385
1385
|
onUp
|
|
1386
|
-
} = { ...defaultOptions$
|
|
1386
|
+
} = { ...defaultOptions$f, ...options }, stop = (target) => {
|
|
1387
1387
|
window.cancelAnimationFrame(request);
|
|
1388
|
-
target.removeEventListener("
|
|
1388
|
+
target.removeEventListener("pointermove", pointermoveEffect);
|
|
1389
1389
|
};
|
|
1390
1390
|
let request;
|
|
1391
|
-
let
|
|
1392
|
-
let
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1395
|
-
|
|
1391
|
+
let pointermoveEffect;
|
|
1392
|
+
let pointerStatus;
|
|
1393
|
+
const pointerdown = (event, api) => {
|
|
1394
|
+
pointerStatus = "down";
|
|
1395
|
+
pointermoveEffect = (event2) => pointermove(event2, api);
|
|
1396
1396
|
storePointerStartMetadata({ event, api });
|
|
1397
1397
|
storePointerMoveMetadata({ event, api });
|
|
1398
1398
|
storePointerTimeMetadata({
|
|
1399
1399
|
event,
|
|
1400
1400
|
api,
|
|
1401
|
-
getShouldStore: () =>
|
|
1401
|
+
getShouldStore: () => pointerStatus === "down",
|
|
1402
1402
|
setRequest: (newRequest) => request = newRequest,
|
|
1403
1403
|
// @ts-expect-error
|
|
1404
1404
|
recognize
|
|
1405
1405
|
});
|
|
1406
|
-
const { listenInjection: { optionsByType: {
|
|
1407
|
-
target.addEventListener("
|
|
1406
|
+
const { listenInjection: { optionsByType: { pointerdown: { target } } } } = api;
|
|
1407
|
+
target.addEventListener("pointermove", pointermoveEffect);
|
|
1408
1408
|
onDown?.(toHookApi(api));
|
|
1409
1409
|
};
|
|
1410
|
-
const
|
|
1410
|
+
const pointermove = (event, api) => {
|
|
1411
1411
|
const { pushSequence } = api;
|
|
1412
1412
|
pushSequence(event);
|
|
1413
1413
|
storePointerMoveMetadata({ event, api });
|
|
@@ -1420,325 +1420,44 @@ function createMousepress(options = {}) {
|
|
|
1420
1420
|
recognized();
|
|
1421
1421
|
}
|
|
1422
1422
|
};
|
|
1423
|
-
const
|
|
1424
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1423
|
+
const pointerout = (event, api) => {
|
|
1424
|
+
const { denied, listenInjection: { optionsByType: { pointerout: { target } } } } = api;
|
|
1425
1425
|
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1426
1426
|
onOut?.(toHookApi(api));
|
|
1427
1427
|
return;
|
|
1428
1428
|
}
|
|
1429
|
-
if (
|
|
1429
|
+
if (pointerStatus === "down") {
|
|
1430
1430
|
denied();
|
|
1431
1431
|
stop(target);
|
|
1432
|
-
|
|
1432
|
+
pointerStatus = "leave";
|
|
1433
1433
|
}
|
|
1434
1434
|
onOut?.(toHookApi(api));
|
|
1435
1435
|
};
|
|
1436
|
-
const
|
|
1437
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1438
|
-
if (
|
|
1436
|
+
const pointerup = (event, api) => {
|
|
1437
|
+
const { denied, listenInjection: { optionsByType: { pointerup: { target } } } } = api;
|
|
1438
|
+
if (pointerStatus !== "down")
|
|
1439
1439
|
return;
|
|
1440
1440
|
denied();
|
|
1441
1441
|
stop(target);
|
|
1442
|
-
|
|
1443
|
-
onUp?.(toHookApi(api));
|
|
1444
|
-
};
|
|
1445
|
-
return {
|
|
1446
|
-
mousedown: {
|
|
1447
|
-
effect: mousedown,
|
|
1448
|
-
stop
|
|
1449
|
-
},
|
|
1450
|
-
mouseout,
|
|
1451
|
-
mouseup
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
class Mousepress extends Listenable {
|
|
1455
|
-
constructor(options) {
|
|
1456
|
-
super(
|
|
1457
|
-
"recognizeable",
|
|
1458
|
-
{
|
|
1459
|
-
recognizeable: {
|
|
1460
|
-
effects: createMousepress(options)
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
);
|
|
1464
|
-
}
|
|
1465
|
-
get metadata() {
|
|
1466
|
-
return this.recognizeable.metadata;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
const defaultOptions$h = {
|
|
1471
|
-
minDuration: 0,
|
|
1472
|
-
minDistance: 0,
|
|
1473
|
-
minVelocity: 0
|
|
1474
|
-
};
|
|
1475
|
-
function createMouserelease(options = {}) {
|
|
1476
|
-
const {
|
|
1477
|
-
minDuration,
|
|
1478
|
-
minDistance,
|
|
1479
|
-
minVelocity,
|
|
1480
|
-
onDown,
|
|
1481
|
-
onOut,
|
|
1482
|
-
onMove,
|
|
1483
|
-
onUp
|
|
1484
|
-
} = { ...defaultOptions$h, ...options }, stop = (target) => {
|
|
1485
|
-
window.cancelAnimationFrame(request);
|
|
1486
|
-
target.removeEventListener("mousemove", mousemoveEffect);
|
|
1487
|
-
};
|
|
1488
|
-
let request;
|
|
1489
|
-
let mousemoveEffect;
|
|
1490
|
-
let mouseStatus;
|
|
1491
|
-
const mousedown = (event, api) => {
|
|
1492
|
-
mouseStatus = "down";
|
|
1493
|
-
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1494
|
-
storePointerStartMetadata({ event, api });
|
|
1495
|
-
storePointerMoveMetadata({ event, api });
|
|
1496
|
-
storePointerTimeMetadata({
|
|
1497
|
-
event,
|
|
1498
|
-
api,
|
|
1499
|
-
getShouldStore: () => mouseStatus === "down",
|
|
1500
|
-
setRequest: (newRequest) => request = newRequest
|
|
1501
|
-
});
|
|
1502
|
-
const { listenInjection: { optionsByType: { mousedown: { target } } } } = api;
|
|
1503
|
-
target.addEventListener("mousemove", mousemoveEffect);
|
|
1504
|
-
onDown?.(toHookApi(api));
|
|
1505
|
-
};
|
|
1506
|
-
const mousemove = (event, api) => {
|
|
1507
|
-
storePointerMoveMetadata({ event, api });
|
|
1508
|
-
onMove?.(toHookApi(api));
|
|
1509
|
-
};
|
|
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
|
-
}
|
|
1516
|
-
if (mouseStatus === "down") {
|
|
1517
|
-
denied();
|
|
1518
|
-
stop(target);
|
|
1519
|
-
mouseStatus = "leave";
|
|
1520
|
-
}
|
|
1521
|
-
onOut?.(toHookApi(api));
|
|
1522
|
-
};
|
|
1523
|
-
const mouseup = (event, api) => {
|
|
1524
|
-
if (mouseStatus !== "down")
|
|
1525
|
-
return;
|
|
1526
|
-
storePointerMoveMetadata({ event, api });
|
|
1527
|
-
const { listenInjection: { optionsByType: { mouseup: { target } } } } = api;
|
|
1528
|
-
stop(target);
|
|
1529
|
-
mouseStatus = "up";
|
|
1530
|
-
recognize(event, api);
|
|
1442
|
+
pointerStatus = "up";
|
|
1531
1443
|
onUp?.(toHookApi(api));
|
|
1532
1444
|
};
|
|
1533
|
-
const recognize = (event, api) => {
|
|
1534
|
-
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1535
|
-
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
|
|
1536
|
-
recognized();
|
|
1537
|
-
return;
|
|
1538
|
-
}
|
|
1539
|
-
denied();
|
|
1540
|
-
};
|
|
1541
1445
|
return {
|
|
1542
|
-
|
|
1543
|
-
effect:
|
|
1446
|
+
pointerdown: {
|
|
1447
|
+
effect: pointerdown,
|
|
1544
1448
|
stop
|
|
1545
1449
|
},
|
|
1546
|
-
|
|
1547
|
-
|
|
1450
|
+
pointerout,
|
|
1451
|
+
pointerup
|
|
1548
1452
|
};
|
|
1549
1453
|
}
|
|
1550
|
-
class
|
|
1454
|
+
class Pointerpress extends Listenable {
|
|
1551
1455
|
constructor(options) {
|
|
1552
1456
|
super(
|
|
1553
1457
|
"recognizeable",
|
|
1554
1458
|
{
|
|
1555
1459
|
recognizeable: {
|
|
1556
|
-
effects:
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
);
|
|
1560
|
-
}
|
|
1561
|
-
get metadata() {
|
|
1562
|
-
return this.recognizeable.metadata;
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
const defaultOptions$g = {
|
|
1567
|
-
minDuration: 0,
|
|
1568
|
-
minDistance: 0
|
|
1569
|
-
};
|
|
1570
|
-
function createTouchpress(options = {}) {
|
|
1571
|
-
const {
|
|
1572
|
-
minDuration,
|
|
1573
|
-
minDistance,
|
|
1574
|
-
onStart,
|
|
1575
|
-
onCancel,
|
|
1576
|
-
onMove,
|
|
1577
|
-
onEnd
|
|
1578
|
-
} = { ...defaultOptions$g, ...options }, stop = () => {
|
|
1579
|
-
window.cancelAnimationFrame(request);
|
|
1580
|
-
};
|
|
1581
|
-
let request;
|
|
1582
|
-
let totalTouches = 0;
|
|
1583
|
-
const touchstart = (event, api) => {
|
|
1584
|
-
const { denied } = api;
|
|
1585
|
-
totalTouches++;
|
|
1586
|
-
if (totalTouches > 1) {
|
|
1587
|
-
stop();
|
|
1588
|
-
denied();
|
|
1589
|
-
onStart?.(toHookApi(api));
|
|
1590
|
-
return;
|
|
1591
|
-
}
|
|
1592
|
-
storePointerStartMetadata({ event, api });
|
|
1593
|
-
storePointerMoveMetadata({ event, api });
|
|
1594
|
-
storePointerTimeMetadata({
|
|
1595
|
-
event,
|
|
1596
|
-
api,
|
|
1597
|
-
getShouldStore: () => totalTouches === 1,
|
|
1598
|
-
setRequest: (newRequest) => request = newRequest,
|
|
1599
|
-
// @ts-expect-error
|
|
1600
|
-
recognize
|
|
1601
|
-
});
|
|
1602
|
-
onStart?.(toHookApi(api));
|
|
1603
|
-
};
|
|
1604
|
-
const touchmove = (event, api) => {
|
|
1605
|
-
const { getStatus } = api;
|
|
1606
|
-
if (getStatus() !== "denied") {
|
|
1607
|
-
storePointerMoveMetadata({ event, api });
|
|
1608
|
-
recognize(event, api);
|
|
1609
|
-
}
|
|
1610
|
-
onMove?.(toHookApi(api));
|
|
1611
|
-
};
|
|
1612
|
-
const recognize = (event, api) => {
|
|
1613
|
-
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1614
|
-
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance) {
|
|
1615
|
-
recognized();
|
|
1616
|
-
}
|
|
1617
|
-
};
|
|
1618
|
-
const touchcancel = (event, api) => {
|
|
1619
|
-
const { denied } = api;
|
|
1620
|
-
stop();
|
|
1621
|
-
denied();
|
|
1622
|
-
totalTouches--;
|
|
1623
|
-
onCancel?.(toHookApi(api));
|
|
1624
|
-
};
|
|
1625
|
-
const touchend = (event, api) => {
|
|
1626
|
-
const { denied } = api;
|
|
1627
|
-
stop();
|
|
1628
|
-
denied();
|
|
1629
|
-
totalTouches--;
|
|
1630
|
-
onEnd?.(toHookApi(api));
|
|
1631
|
-
};
|
|
1632
|
-
return {
|
|
1633
|
-
touchstart,
|
|
1634
|
-
touchmove,
|
|
1635
|
-
touchcancel,
|
|
1636
|
-
touchend
|
|
1637
|
-
};
|
|
1638
|
-
}
|
|
1639
|
-
class Touchpress extends Listenable {
|
|
1640
|
-
constructor(options) {
|
|
1641
|
-
super(
|
|
1642
|
-
"recognizeable",
|
|
1643
|
-
{
|
|
1644
|
-
recognizeable: {
|
|
1645
|
-
effects: createTouchpress(options)
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
);
|
|
1649
|
-
}
|
|
1650
|
-
get metadata() {
|
|
1651
|
-
return this.recognizeable.metadata;
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
const defaultOptions$f = {
|
|
1656
|
-
minDuration: 0,
|
|
1657
|
-
minDistance: 0,
|
|
1658
|
-
minVelocity: 0
|
|
1659
|
-
};
|
|
1660
|
-
function createTouchrelease(options = {}) {
|
|
1661
|
-
const {
|
|
1662
|
-
minDuration,
|
|
1663
|
-
minDistance,
|
|
1664
|
-
minVelocity,
|
|
1665
|
-
onStart,
|
|
1666
|
-
onCancel,
|
|
1667
|
-
onMove,
|
|
1668
|
-
onEnd
|
|
1669
|
-
} = { ...defaultOptions$f, ...options }, stop = () => {
|
|
1670
|
-
window.cancelAnimationFrame(request);
|
|
1671
|
-
};
|
|
1672
|
-
let request;
|
|
1673
|
-
let totalTouches = 0;
|
|
1674
|
-
const touchstart = (event, api) => {
|
|
1675
|
-
const { denied } = api;
|
|
1676
|
-
totalTouches++;
|
|
1677
|
-
if (totalTouches > 1) {
|
|
1678
|
-
stop();
|
|
1679
|
-
denied();
|
|
1680
|
-
onStart?.(toHookApi(api));
|
|
1681
|
-
return;
|
|
1682
|
-
}
|
|
1683
|
-
storePointerStartMetadata({ event, api });
|
|
1684
|
-
storePointerMoveMetadata({ event, api });
|
|
1685
|
-
storePointerTimeMetadata({
|
|
1686
|
-
event,
|
|
1687
|
-
api,
|
|
1688
|
-
getShouldStore: () => totalTouches === 1,
|
|
1689
|
-
setRequest: (newRequest) => request = newRequest
|
|
1690
|
-
});
|
|
1691
|
-
onStart?.(toHookApi(api));
|
|
1692
|
-
};
|
|
1693
|
-
const touchmove = (event, api) => {
|
|
1694
|
-
const { getStatus } = api;
|
|
1695
|
-
if (getStatus() !== "denied")
|
|
1696
|
-
storePointerMoveMetadata({ event, api });
|
|
1697
|
-
onMove?.(toHookApi(api));
|
|
1698
|
-
};
|
|
1699
|
-
const touchcancel = (event, api) => {
|
|
1700
|
-
const { denied } = api;
|
|
1701
|
-
stop();
|
|
1702
|
-
denied();
|
|
1703
|
-
totalTouches--;
|
|
1704
|
-
onCancel?.(toHookApi(api));
|
|
1705
|
-
};
|
|
1706
|
-
const touchend = (event, api) => {
|
|
1707
|
-
const { denied } = api;
|
|
1708
|
-
if (totalTouches !== 1) {
|
|
1709
|
-
stop();
|
|
1710
|
-
denied();
|
|
1711
|
-
onEnd?.(toHookApi(api));
|
|
1712
|
-
return;
|
|
1713
|
-
}
|
|
1714
|
-
storePointerMoveMetadata({ event, api });
|
|
1715
|
-
stop();
|
|
1716
|
-
totalTouches--;
|
|
1717
|
-
recognize(event, api);
|
|
1718
|
-
onEnd?.(toHookApi(api));
|
|
1719
|
-
};
|
|
1720
|
-
const recognize = (event, api) => {
|
|
1721
|
-
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1722
|
-
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
|
|
1723
|
-
recognized();
|
|
1724
|
-
} else {
|
|
1725
|
-
denied();
|
|
1726
|
-
}
|
|
1727
|
-
};
|
|
1728
|
-
return {
|
|
1729
|
-
touchstart,
|
|
1730
|
-
touchmove,
|
|
1731
|
-
touchcancel,
|
|
1732
|
-
touchend
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
class Touchrelease extends Listenable {
|
|
1736
|
-
constructor(options) {
|
|
1737
|
-
super(
|
|
1738
|
-
"recognizeable",
|
|
1739
|
-
{
|
|
1740
|
-
recognizeable: {
|
|
1741
|
-
effects: createTouchrelease(options)
|
|
1460
|
+
effects: createPointerpress(options)
|
|
1742
1461
|
}
|
|
1743
1462
|
}
|
|
1744
1463
|
);
|
|
@@ -1751,7 +1470,7 @@ class Touchrelease extends Listenable {
|
|
|
1751
1470
|
const defaultOptions$e = {
|
|
1752
1471
|
minDuration: 0
|
|
1753
1472
|
};
|
|
1754
|
-
function
|
|
1473
|
+
function createPointerhover(options = {}) {
|
|
1755
1474
|
const {
|
|
1756
1475
|
minDuration,
|
|
1757
1476
|
onOver,
|
|
@@ -1760,16 +1479,16 @@ function createHover(options = {}) {
|
|
|
1760
1479
|
window.cancelAnimationFrame(request);
|
|
1761
1480
|
};
|
|
1762
1481
|
let request;
|
|
1763
|
-
let
|
|
1764
|
-
const
|
|
1765
|
-
if (
|
|
1766
|
-
|
|
1482
|
+
let pointerStatus = "exited";
|
|
1483
|
+
const pointerover = (event, api) => {
|
|
1484
|
+
if (pointerStatus === "exited") {
|
|
1485
|
+
pointerStatus = "entered";
|
|
1767
1486
|
storePointerStartMetadata({ event, api });
|
|
1768
1487
|
storePointerMoveMetadata({ event, api });
|
|
1769
1488
|
storePointerTimeMetadata({
|
|
1770
1489
|
event,
|
|
1771
1490
|
api,
|
|
1772
|
-
getShouldStore: () =>
|
|
1491
|
+
getShouldStore: () => pointerStatus === "entered",
|
|
1773
1492
|
setRequest: (newRequest) => request = newRequest,
|
|
1774
1493
|
// @ts-expect-error
|
|
1775
1494
|
recognize
|
|
@@ -1786,38 +1505,34 @@ function createHover(options = {}) {
|
|
|
1786
1505
|
recognized();
|
|
1787
1506
|
}
|
|
1788
1507
|
};
|
|
1789
|
-
const
|
|
1790
|
-
const { denied, listenInjection: { optionsByType: {
|
|
1508
|
+
const pointerout = (event, api) => {
|
|
1509
|
+
const { denied, listenInjection: { optionsByType: { pointerout: { target } } } } = api;
|
|
1791
1510
|
if (event.target !== target && target.contains?.(event.relatedTarget)) {
|
|
1792
1511
|
onOut?.(toHookApi(api));
|
|
1793
1512
|
return;
|
|
1794
1513
|
}
|
|
1795
|
-
if (
|
|
1514
|
+
if (pointerStatus === "entered") {
|
|
1796
1515
|
denied();
|
|
1797
1516
|
stop();
|
|
1798
|
-
|
|
1517
|
+
pointerStatus = "exited";
|
|
1799
1518
|
}
|
|
1800
1519
|
onOut?.(toHookApi(api));
|
|
1801
1520
|
};
|
|
1802
|
-
const touchstart = (event) => {
|
|
1803
|
-
event.preventDefault();
|
|
1804
|
-
};
|
|
1805
1521
|
return {
|
|
1806
|
-
|
|
1807
|
-
effect:
|
|
1522
|
+
pointerover: {
|
|
1523
|
+
effect: pointerover,
|
|
1808
1524
|
stop
|
|
1809
1525
|
},
|
|
1810
|
-
|
|
1811
|
-
touchstart
|
|
1526
|
+
pointerout
|
|
1812
1527
|
};
|
|
1813
1528
|
}
|
|
1814
|
-
class
|
|
1529
|
+
class Pointerhover extends Listenable {
|
|
1815
1530
|
constructor(options) {
|
|
1816
1531
|
super(
|
|
1817
1532
|
"recognizeable",
|
|
1818
1533
|
{
|
|
1819
1534
|
recognizeable: {
|
|
1820
|
-
effects:
|
|
1535
|
+
effects: createPointerhover(options)
|
|
1821
1536
|
}
|
|
1822
1537
|
}
|
|
1823
1538
|
);
|
|
@@ -2944,7 +2659,7 @@ function toHookApi({
|
|
|
2944
2659
|
};
|
|
2945
2660
|
}
|
|
2946
2661
|
|
|
2947
|
-
function
|
|
2662
|
+
function toPointerPoint(event) {
|
|
2948
2663
|
return {
|
|
2949
2664
|
x: event.clientX,
|
|
2950
2665
|
y: event.clientY
|
|
@@ -3027,7 +2742,7 @@ const initialMetadata$2 = {
|
|
|
3027
2742
|
};
|
|
3028
2743
|
function storePointerStartMetadata({ event, api }) {
|
|
3029
2744
|
const { getMetadata } = api, metadata = getMetadata();
|
|
3030
|
-
const point = event instanceof MouseEvent ?
|
|
2745
|
+
const point = event instanceof MouseEvent || event instanceof PointerEvent ? toPointerPoint(event) : toTouchMovePoint(event);
|
|
3031
2746
|
if (!metadata.points)
|
|
3032
2747
|
metadata.points = createClone()(initialMetadata$2.points);
|
|
3033
2748
|
metadata.points.start = point;
|
|
@@ -3067,7 +2782,7 @@ function storePointerMoveMetadata({ event, api }) {
|
|
|
3067
2782
|
}
|
|
3068
2783
|
const { x: previousX, y: previousY } = metadata.points.end, { x: startX, y: startY } = metadata.points.start, { x: newX, y: newY } = (() => {
|
|
3069
2784
|
if (event instanceof MouseEvent) {
|
|
3070
|
-
return
|
|
2785
|
+
return toPointerPoint(event);
|
|
3071
2786
|
}
|
|
3072
2787
|
if (event instanceof TouchEvent) {
|
|
3073
2788
|
if (event.type === "touchmove") {
|
|
@@ -5609,22 +5324,19 @@ exports.Drawable = Drawable;
|
|
|
5609
5324
|
exports.Fetchable = Fetchable;
|
|
5610
5325
|
exports.Fullscreenable = Fullscreenable;
|
|
5611
5326
|
exports.Grantable = Grantable;
|
|
5612
|
-
exports.Hover = Hover;
|
|
5613
5327
|
exports.Keychord = Keychord;
|
|
5614
5328
|
exports.Keypress = Keypress;
|
|
5615
5329
|
exports.Keyrelease = Keyrelease;
|
|
5616
5330
|
exports.Konami = Konami;
|
|
5617
5331
|
exports.Listenable = Listenable;
|
|
5618
|
-
exports.Mousepress = Mousepress;
|
|
5619
|
-
exports.Mouserelease = Mouserelease;
|
|
5620
5332
|
exports.Navigateable = Navigateable;
|
|
5621
5333
|
exports.Pickable = Pickable;
|
|
5334
|
+
exports.Pointerhover = Pointerhover;
|
|
5335
|
+
exports.Pointerpress = Pointerpress;
|
|
5622
5336
|
exports.Recognizeable = Recognizeable;
|
|
5623
5337
|
exports.Resolveable = Resolveable;
|
|
5624
5338
|
exports.Shareable = Shareable;
|
|
5625
5339
|
exports.Storeable = Storeable;
|
|
5626
|
-
exports.Touchpress = Touchpress;
|
|
5627
|
-
exports.Touchrelease = Touchrelease;
|
|
5628
5340
|
exports.createArrayFormat = createFormat$2;
|
|
5629
5341
|
exports.createAssociativeArrayClear = createClear$2;
|
|
5630
5342
|
exports.createAssociativeArrayDelete = createDelete$2;
|
|
@@ -5681,7 +5393,6 @@ exports.createGraph = createGraph;
|
|
|
5681
5393
|
exports.createGreater = createGreater;
|
|
5682
5394
|
exports.createGreaterOrEqual = createGreaterOrEqual;
|
|
5683
5395
|
exports.createHas = createHas;
|
|
5684
|
-
exports.createHover = createHover;
|
|
5685
5396
|
exports.createIncoming = createIncoming;
|
|
5686
5397
|
exports.createIndegree = createIndegree;
|
|
5687
5398
|
exports.createInsert = createInsert;
|
|
@@ -5697,8 +5408,6 @@ exports.createList = createList;
|
|
|
5697
5408
|
exports.createMap = createMap;
|
|
5698
5409
|
exports.createMapAsync = createMapAsync;
|
|
5699
5410
|
exports.createMix = createMix;
|
|
5700
|
-
exports.createMousepress = createMousepress;
|
|
5701
|
-
exports.createMouserelease = createMouserelease;
|
|
5702
5411
|
exports.createNumber = createNumber;
|
|
5703
5412
|
exports.createNumberFormat = createFormat;
|
|
5704
5413
|
exports.createOmit = createOmit;
|
|
@@ -5706,6 +5415,8 @@ exports.createOnlyChild = createOnlyChild;
|
|
|
5706
5415
|
exports.createOutdegree = createOutdegree;
|
|
5707
5416
|
exports.createOutgoing = createOutgoing;
|
|
5708
5417
|
exports.createPick = createPick;
|
|
5418
|
+
exports.createPointerhover = createPointerhover;
|
|
5419
|
+
exports.createPointerpress = createPointerpress;
|
|
5709
5420
|
exports.createReduce = createReduce;
|
|
5710
5421
|
exports.createReduceAsync = createReduceAsync;
|
|
5711
5422
|
exports.createRemove = createRemove;
|
|
@@ -5725,8 +5436,6 @@ exports.createSort = createSort;
|
|
|
5725
5436
|
exports.createSwap = createSwap;
|
|
5726
5437
|
exports.createTerminal = createTerminal;
|
|
5727
5438
|
exports.createTotalSiblings = createTotalSiblings;
|
|
5728
|
-
exports.createTouchpress = createTouchpress;
|
|
5729
|
-
exports.createTouchrelease = createTouchrelease;
|
|
5730
5439
|
exports.createTreeFind = createFind;
|
|
5731
5440
|
exports.createTry = createTry;
|
|
5732
5441
|
exports.createTryAsync = createTryAsync;
|