@directus/composables 11.4.0 → 11.4.1
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/dist/index.js +15 -9
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1534,15 +1534,20 @@ const systemKeys = [
|
|
|
1534
1534
|
];
|
|
1535
1535
|
const keysDown = /* @__PURE__ */ new Set([]);
|
|
1536
1536
|
const handlers = {};
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
});
|
|
1537
|
+
let listenersAttached = false;
|
|
1538
|
+
function attachGlobalListeners() {
|
|
1539
|
+
if (listenersAttached) return;
|
|
1540
|
+
listenersAttached = true;
|
|
1541
|
+
document.body.addEventListener("keydown", (event) => {
|
|
1542
|
+
if (event.repeat || !event.key) return;
|
|
1543
|
+
keysDown.add(mapKeys(event));
|
|
1544
|
+
callHandlers(event);
|
|
1545
|
+
});
|
|
1546
|
+
document.body.addEventListener("keyup", (event) => {
|
|
1547
|
+
if (event.repeat || !event.key) return;
|
|
1548
|
+
keysDown.clear();
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1546
1551
|
function useShortcut(shortcuts, handler, reference = ref(document.body)) {
|
|
1547
1552
|
const callback = (event, cancelNext) => {
|
|
1548
1553
|
if (!reference.value) return;
|
|
@@ -1554,6 +1559,7 @@ function useShortcut(shortcuts, handler, reference = ref(document.body)) {
|
|
|
1554
1559
|
return false;
|
|
1555
1560
|
};
|
|
1556
1561
|
onMounted(() => {
|
|
1562
|
+
attachGlobalListeners();
|
|
1557
1563
|
[shortcuts].flat().forEach((shortcut) => {
|
|
1558
1564
|
if (shortcut in handlers) handlers[shortcut]?.unshift(callback);
|
|
1559
1565
|
else handlers[shortcut] = [callback];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/composables",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.1",
|
|
4
4
|
"description": "Shared Vue composables for Directus use",
|
|
5
5
|
"homepage": "https://directus.io",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"axios": "1.15.0",
|
|
27
27
|
"lodash-es": "4.18.1",
|
|
28
28
|
"nanoid": "5.1.6",
|
|
29
|
-
"@directus/
|
|
30
|
-
"@directus/
|
|
29
|
+
"@directus/constants": "14.3.0",
|
|
30
|
+
"@directus/utils": "13.4.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@directus/tsconfig": "4.0.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"typescript": "5.9.3",
|
|
39
39
|
"vitest": "3.2.4",
|
|
40
40
|
"vue": "3.5.24",
|
|
41
|
-
"@directus/extensions": "3.0.
|
|
42
|
-
"@directus/types": "15.0.
|
|
43
|
-
"@directus/sdk": "21.
|
|
41
|
+
"@directus/extensions": "3.0.25",
|
|
42
|
+
"@directus/types": "15.0.3",
|
|
43
|
+
"@directus/sdk": "21.3.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"vue": "3.5.24"
|