@n8n/composables 1.11.0 → 1.12.0
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/chunk-CUT6urMc.cjs +30 -0
- package/dist/useDeviceSupport.cjs +35 -32
- package/dist/useDeviceSupport.cjs.map +1 -1
- package/dist/useDeviceSupport.d.cts +13 -11
- package/dist/useDeviceSupport.d.ts +13 -11
- package/dist/useDeviceSupport.js +34 -33
- package/dist/useDeviceSupport.js.map +1 -1
- package/dist/useShortKeyPress.cjs +18 -27
- package/dist/useShortKeyPress.cjs.map +1 -1
- package/dist/useShortKeyPress.d.cts +13 -7
- package/dist/useShortKeyPress.d.ts +13 -7
- package/dist/useShortKeyPress.js +16 -28
- package/dist/useShortKeyPress.js.map +1 -1
- package/dist/useThrottleWithReactiveDelay.cjs +16 -18
- package/dist/useThrottleWithReactiveDelay.cjs.map +1 -1
- package/dist/useThrottleWithReactiveDelay.d.cts +4 -2
- package/dist/useThrottleWithReactiveDelay.d.ts +4 -2
- package/dist/useThrottleWithReactiveDelay.js +14 -19
- package/dist/useThrottleWithReactiveDelay.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
vue = require_chunk.__toESM(vue);
|
|
4
|
+
|
|
5
|
+
//#region src/useDeviceSupport.ts
|
|
3
6
|
function useDeviceSupport() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Check if the device is a touch device but exclude devices that have a fine pointer (mouse or track-pad)
|
|
9
|
+
* - `fine` will check for an accurate pointing device. Examples include mice, touch-pads, and drawing styluses
|
|
10
|
+
* - `coarse` will check for a pointing device of limited accuracy. Examples include touchscreens and motion-detection sensors
|
|
11
|
+
* - `any-pointer` will check for the presence of any pointing device, if there are multiple of them
|
|
12
|
+
*/
|
|
13
|
+
const isTouchDevice = (0, vue.ref)(window.matchMedia("(any-pointer: coarse)").matches && !window.matchMedia("(any-pointer: fine)").matches);
|
|
14
|
+
const userAgent = (0, vue.ref)(navigator.userAgent.toLowerCase());
|
|
15
|
+
const isIOs = (0, vue.ref)(userAgent.value.includes("iphone") || userAgent.value.includes("ipad") || userAgent.value.includes("ipod"));
|
|
16
|
+
const isAndroidOs = (0, vue.ref)(userAgent.value.includes("android"));
|
|
17
|
+
const isMacOs = (0, vue.ref)(userAgent.value.includes("macintosh") || isIOs.value);
|
|
18
|
+
const isMobileDevice = (0, vue.ref)(isIOs.value || isAndroidOs.value);
|
|
19
|
+
const controlKeyCode = (0, vue.ref)(isMacOs.value ? "Meta" : "Control");
|
|
20
|
+
const controlKeyText = (0, vue.computed)(() => isMacOs.value ? "⌘" : "Ctrl");
|
|
21
|
+
function isCtrlKeyPressed(e) {
|
|
22
|
+
if (isMacOs.value) return e.metaKey;
|
|
23
|
+
return e.ctrlKey;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
userAgent: userAgent.value,
|
|
27
|
+
isTouchDevice: isTouchDevice.value,
|
|
28
|
+
isAndroidOs: isAndroidOs.value,
|
|
29
|
+
isIOs: isIOs.value,
|
|
30
|
+
isMacOs: isMacOs.value,
|
|
31
|
+
isMobileDevice: isMobileDevice.value,
|
|
32
|
+
controlKeyCode: controlKeyCode.value,
|
|
33
|
+
controlKeyText,
|
|
34
|
+
isCtrlKeyPressed
|
|
35
|
+
};
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
//#endregion
|
|
36
39
|
exports.useDeviceSupport = useDeviceSupport;
|
|
37
40
|
//# sourceMappingURL=useDeviceSupport.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useDeviceSupport.cjs","names":[],"sources":["../src/useDeviceSupport.ts"],"sourcesContent":["import { computed, ref } from 'vue';\n\nexport function useDeviceSupport() {\n\t/**\n\t * Check if the device is a touch device but exclude devices that have a fine pointer (mouse or track-pad)\n\t * - `fine` will check for an accurate pointing device. Examples include mice, touch-pads, and drawing styluses\n\t * - `coarse` will check for a pointing device of limited accuracy. Examples include touchscreens and motion-detection sensors\n\t * - `any-pointer` will check for the presence of any pointing device, if there are multiple of them\n\t */\n\tconst isTouchDevice = ref(\n\t\twindow.matchMedia('(any-pointer: coarse)').matches &&\n\t\t\t!window.matchMedia('(any-pointer: fine)').matches,\n\t);\n\tconst userAgent = ref(navigator.userAgent.toLowerCase());\n\n\tconst isIOs = ref(\n\t\tuserAgent.value.includes('iphone') ||\n\t\t\tuserAgent.value.includes('ipad') ||\n\t\t\tuserAgent.value.includes('ipod'),\n\t);\n\tconst isAndroidOs = ref(userAgent.value.includes('android'));\n\tconst isMacOs = ref(userAgent.value.includes('macintosh') || isIOs.value);\n\tconst isMobileDevice = ref(isIOs.value || isAndroidOs.value);\n\n\tconst controlKeyCode = ref(isMacOs.value ? 'Meta' : 'Control');\n\tconst controlKeyText = computed(() => (isMacOs.value ? '⌘' : 'Ctrl'));\n\n\tfunction isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {\n\t\tif (isMacOs.value) {\n\t\t\treturn (e as KeyboardEvent).metaKey;\n\t\t}\n\t\treturn (e as KeyboardEvent).ctrlKey;\n\t}\n\n\treturn {\n\t\tuserAgent: userAgent.value,\n\t\tisTouchDevice: isTouchDevice.value,\n\t\tisAndroidOs: isAndroidOs.value,\n\t\tisIOs: isIOs.value,\n\t\tisMacOs: isMacOs.value,\n\t\tisMobileDevice: isMobileDevice.value,\n\t\tcontrolKeyCode: controlKeyCode.value,\n\t\tcontrolKeyText,\n\t\tisCtrlKeyPressed,\n\t};\n}\n"],"mappings":";;;;;AAEA,SAAgB,mBAAmB;;;;;;;CAOlC,MAAM,6BACL,OAAO,WAAW,wBAAwB,CAAC,WAC1C,CAAC,OAAO,WAAW,sBAAsB,CAAC,QAC3C;CACD,MAAM,yBAAgB,UAAU,UAAU,aAAa,CAAC;CAExD,MAAM,qBACL,UAAU,MAAM,SAAS,SAAS,IACjC,UAAU,MAAM,SAAS,OAAO,IAChC,UAAU,MAAM,SAAS,OAAO,CACjC;CACD,MAAM,2BAAkB,UAAU,MAAM,SAAS,UAAU,CAAC;CAC5D,MAAM,uBAAc,UAAU,MAAM,SAAS,YAAY,IAAI,MAAM,MAAM;CACzE,MAAM,8BAAqB,MAAM,SAAS,YAAY,MAAM;CAE5D,MAAM,8BAAqB,QAAQ,QAAQ,SAAS,UAAU;CAC9D,MAAM,yCAAiC,QAAQ,QAAQ,MAAM,OAAQ;CAErE,SAAS,iBAAiB,GAAwC;AACjE,MAAI,QAAQ,MACX,QAAQ,EAAoB;AAE7B,SAAQ,EAAoB;;AAG7B,QAAO;EACN,WAAW,UAAU;EACrB,eAAe,cAAc;EAC7B,aAAa,YAAY;EACzB,OAAO,MAAM;EACb,SAAS,QAAQ;EACjB,gBAAgB,eAAe;EAC/B,gBAAgB,eAAe;EAC/B;EACA;EACA"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
|
|
3
|
+
//#region src/useDeviceSupport.d.ts
|
|
3
4
|
declare function useDeviceSupport(): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
userAgent: string;
|
|
6
|
+
isTouchDevice: boolean;
|
|
7
|
+
isAndroidOs: boolean;
|
|
8
|
+
isIOs: boolean;
|
|
9
|
+
isMacOs: boolean;
|
|
10
|
+
isMobileDevice: boolean;
|
|
11
|
+
controlKeyCode: string;
|
|
12
|
+
controlKeyText: vue0.ComputedRef<"⌘" | "Ctrl">;
|
|
13
|
+
isCtrlKeyPressed: (e: MouseEvent | KeyboardEvent) => boolean;
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
//#endregion
|
|
15
16
|
export { useDeviceSupport };
|
|
17
|
+
//# sourceMappingURL=useDeviceSupport.d.cts.map
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
2
|
|
|
3
|
+
//#region src/useDeviceSupport.d.ts
|
|
3
4
|
declare function useDeviceSupport(): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
userAgent: string;
|
|
6
|
+
isTouchDevice: boolean;
|
|
7
|
+
isAndroidOs: boolean;
|
|
8
|
+
isIOs: boolean;
|
|
9
|
+
isMacOs: boolean;
|
|
10
|
+
isMobileDevice: boolean;
|
|
11
|
+
controlKeyCode: string;
|
|
12
|
+
controlKeyText: vue0.ComputedRef<"⌘" | "Ctrl">;
|
|
13
|
+
isCtrlKeyPressed: (e: MouseEvent | KeyboardEvent) => boolean;
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
//#endregion
|
|
15
16
|
export { useDeviceSupport };
|
|
17
|
+
//# sourceMappingURL=useDeviceSupport.d.ts.map
|
package/dist/useDeviceSupport.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
// src/useDeviceSupport.ts
|
|
2
1
|
import { computed, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useDeviceSupport.ts
|
|
3
4
|
function useDeviceSupport() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Check if the device is a touch device but exclude devices that have a fine pointer (mouse or track-pad)
|
|
7
|
+
* - `fine` will check for an accurate pointing device. Examples include mice, touch-pads, and drawing styluses
|
|
8
|
+
* - `coarse` will check for a pointing device of limited accuracy. Examples include touchscreens and motion-detection sensors
|
|
9
|
+
* - `any-pointer` will check for the presence of any pointing device, if there are multiple of them
|
|
10
|
+
*/
|
|
11
|
+
const isTouchDevice = ref(window.matchMedia("(any-pointer: coarse)").matches && !window.matchMedia("(any-pointer: fine)").matches);
|
|
12
|
+
const userAgent = ref(navigator.userAgent.toLowerCase());
|
|
13
|
+
const isIOs = ref(userAgent.value.includes("iphone") || userAgent.value.includes("ipad") || userAgent.value.includes("ipod"));
|
|
14
|
+
const isAndroidOs = ref(userAgent.value.includes("android"));
|
|
15
|
+
const isMacOs = ref(userAgent.value.includes("macintosh") || isIOs.value);
|
|
16
|
+
const isMobileDevice = ref(isIOs.value || isAndroidOs.value);
|
|
17
|
+
const controlKeyCode = ref(isMacOs.value ? "Meta" : "Control");
|
|
18
|
+
const controlKeyText = computed(() => isMacOs.value ? "⌘" : "Ctrl");
|
|
19
|
+
function isCtrlKeyPressed(e) {
|
|
20
|
+
if (isMacOs.value) return e.metaKey;
|
|
21
|
+
return e.ctrlKey;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
userAgent: userAgent.value,
|
|
25
|
+
isTouchDevice: isTouchDevice.value,
|
|
26
|
+
isAndroidOs: isAndroidOs.value,
|
|
27
|
+
isIOs: isIOs.value,
|
|
28
|
+
isMacOs: isMacOs.value,
|
|
29
|
+
isMobileDevice: isMobileDevice.value,
|
|
30
|
+
controlKeyCode: controlKeyCode.value,
|
|
31
|
+
controlKeyText,
|
|
32
|
+
isCtrlKeyPressed
|
|
33
|
+
};
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { useDeviceSupport };
|
|
37
38
|
//# sourceMappingURL=useDeviceSupport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useDeviceSupport.ts"],"sourcesContent":["import { computed, ref } from 'vue';\n\nexport function useDeviceSupport() {\n\t/**\n\t * Check if the device is a touch device but exclude devices that have a fine pointer (mouse or track-pad)\n\t * - `fine` will check for an accurate pointing device. Examples include mice, touch-pads, and drawing styluses\n\t * - `coarse` will check for a pointing device of limited accuracy. Examples include touchscreens and motion-detection sensors\n\t * - `any-pointer` will check for the presence of any pointing device, if there are multiple of them\n\t */\n\tconst isTouchDevice = ref(\n\t\twindow.matchMedia('(any-pointer: coarse)').matches &&\n\t\t\t!window.matchMedia('(any-pointer: fine)').matches,\n\t);\n\tconst userAgent = ref(navigator.userAgent.toLowerCase());\n\n\tconst isIOs = ref(\n\t\tuserAgent.value.includes('iphone') ||\n\t\t\tuserAgent.value.includes('ipad') ||\n\t\t\tuserAgent.value.includes('ipod'),\n\t);\n\tconst isAndroidOs = ref(userAgent.value.includes('android'));\n\tconst isMacOs = ref(userAgent.value.includes('macintosh') || isIOs.value);\n\tconst isMobileDevice = ref(isIOs.value || isAndroidOs.value);\n\n\tconst controlKeyCode = ref(isMacOs.value ? 'Meta' : 'Control');\n\tconst controlKeyText = computed(() => (isMacOs.value ? '⌘' : 'Ctrl'));\n\n\tfunction isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {\n\t\tif (isMacOs.value) {\n\t\t\treturn (e as KeyboardEvent).metaKey;\n\t\t}\n\t\treturn (e as KeyboardEvent).ctrlKey;\n\t}\n\n\treturn {\n\t\tuserAgent: userAgent.value,\n\t\tisTouchDevice: isTouchDevice.value,\n\t\tisAndroidOs: isAndroidOs.value,\n\t\tisIOs: isIOs.value,\n\t\tisMacOs: isMacOs.value,\n\t\tisMobileDevice: isMobileDevice.value,\n\t\tcontrolKeyCode: controlKeyCode.value,\n\t\tcontrolKeyText,\n\t\tisCtrlKeyPressed,\n\t};\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDeviceSupport.js","names":[],"sources":["../src/useDeviceSupport.ts"],"sourcesContent":["import { computed, ref } from 'vue';\n\nexport function useDeviceSupport() {\n\t/**\n\t * Check if the device is a touch device but exclude devices that have a fine pointer (mouse or track-pad)\n\t * - `fine` will check for an accurate pointing device. Examples include mice, touch-pads, and drawing styluses\n\t * - `coarse` will check for a pointing device of limited accuracy. Examples include touchscreens and motion-detection sensors\n\t * - `any-pointer` will check for the presence of any pointing device, if there are multiple of them\n\t */\n\tconst isTouchDevice = ref(\n\t\twindow.matchMedia('(any-pointer: coarse)').matches &&\n\t\t\t!window.matchMedia('(any-pointer: fine)').matches,\n\t);\n\tconst userAgent = ref(navigator.userAgent.toLowerCase());\n\n\tconst isIOs = ref(\n\t\tuserAgent.value.includes('iphone') ||\n\t\t\tuserAgent.value.includes('ipad') ||\n\t\t\tuserAgent.value.includes('ipod'),\n\t);\n\tconst isAndroidOs = ref(userAgent.value.includes('android'));\n\tconst isMacOs = ref(userAgent.value.includes('macintosh') || isIOs.value);\n\tconst isMobileDevice = ref(isIOs.value || isAndroidOs.value);\n\n\tconst controlKeyCode = ref(isMacOs.value ? 'Meta' : 'Control');\n\tconst controlKeyText = computed(() => (isMacOs.value ? '⌘' : 'Ctrl'));\n\n\tfunction isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {\n\t\tif (isMacOs.value) {\n\t\t\treturn (e as KeyboardEvent).metaKey;\n\t\t}\n\t\treturn (e as KeyboardEvent).ctrlKey;\n\t}\n\n\treturn {\n\t\tuserAgent: userAgent.value,\n\t\tisTouchDevice: isTouchDevice.value,\n\t\tisAndroidOs: isAndroidOs.value,\n\t\tisIOs: isIOs.value,\n\t\tisMacOs: isMacOs.value,\n\t\tisMobileDevice: isMobileDevice.value,\n\t\tcontrolKeyCode: controlKeyCode.value,\n\t\tcontrolKeyText,\n\t\tisCtrlKeyPressed,\n\t};\n}\n"],"mappings":";;;AAEA,SAAgB,mBAAmB;;;;;;;CAOlC,MAAM,gBAAgB,IACrB,OAAO,WAAW,wBAAwB,CAAC,WAC1C,CAAC,OAAO,WAAW,sBAAsB,CAAC,QAC3C;CACD,MAAM,YAAY,IAAI,UAAU,UAAU,aAAa,CAAC;CAExD,MAAM,QAAQ,IACb,UAAU,MAAM,SAAS,SAAS,IACjC,UAAU,MAAM,SAAS,OAAO,IAChC,UAAU,MAAM,SAAS,OAAO,CACjC;CACD,MAAM,cAAc,IAAI,UAAU,MAAM,SAAS,UAAU,CAAC;CAC5D,MAAM,UAAU,IAAI,UAAU,MAAM,SAAS,YAAY,IAAI,MAAM,MAAM;CACzE,MAAM,iBAAiB,IAAI,MAAM,SAAS,YAAY,MAAM;CAE5D,MAAM,iBAAiB,IAAI,QAAQ,QAAQ,SAAS,UAAU;CAC9D,MAAM,iBAAiB,eAAgB,QAAQ,QAAQ,MAAM,OAAQ;CAErE,SAAS,iBAAiB,GAAwC;AACjE,MAAI,QAAQ,MACX,QAAQ,EAAoB;AAE7B,SAAQ,EAAoB;;AAG7B,QAAO;EACN,WAAW,UAAU;EACrB,eAAe,cAAc;EAC7B,aAAa,YAAY;EACzB,OAAO,MAAM;EACb,SAAS,QAAQ;EACjB,gBAAgB,eAAe;EAC/B,gBAAgB,eAAe;EAC/B;EACA;EACA"}
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
threshold = 300,
|
|
7
|
-
disabled = false
|
|
8
|
-
}) {
|
|
9
|
-
const keyDownTime = _vue.ref.call(void 0, null);
|
|
10
|
-
_core.onKeyDown.call(void 0,
|
|
11
|
-
key,
|
|
12
|
-
() => {
|
|
13
|
-
if (_vue.unref.call(void 0, disabled)) return;
|
|
14
|
-
keyDownTime.value = Date.now();
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
dedupe
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
_core.onKeyUp.call(void 0, key, () => {
|
|
21
|
-
if (_vue.unref.call(void 0, disabled) || !keyDownTime.value) return;
|
|
22
|
-
const isShortPress = Date.now() - keyDownTime.value < threshold;
|
|
23
|
-
if (isShortPress) {
|
|
24
|
-
fn();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
vue = require_chunk.__toESM(vue);
|
|
4
|
+
let __vueuse_core = require("@vueuse/core");
|
|
5
|
+
__vueuse_core = require_chunk.__toESM(__vueuse_core);
|
|
28
6
|
|
|
7
|
+
//#region src/useShortKeyPress.ts
|
|
8
|
+
function useShortKeyPress(key, fn, { dedupe = true, threshold = 300, disabled = false }) {
|
|
9
|
+
const keyDownTime = (0, vue.ref)(null);
|
|
10
|
+
(0, __vueuse_core.onKeyDown)(key, () => {
|
|
11
|
+
if ((0, vue.unref)(disabled)) return;
|
|
12
|
+
keyDownTime.value = Date.now();
|
|
13
|
+
}, { dedupe });
|
|
14
|
+
(0, __vueuse_core.onKeyUp)(key, () => {
|
|
15
|
+
if ((0, vue.unref)(disabled) || !keyDownTime.value) return;
|
|
16
|
+
if (Date.now() - keyDownTime.value < threshold) fn();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
29
19
|
|
|
20
|
+
//#endregion
|
|
30
21
|
exports.useShortKeyPress = useShortKeyPress;
|
|
31
22
|
//# sourceMappingURL=useShortKeyPress.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useShortKeyPress.cjs","names":[],"sources":["../src/useShortKeyPress.ts"],"sourcesContent":["import { onKeyDown, onKeyUp } from '@vueuse/core';\nimport type { KeyFilter } from '@vueuse/core';\nimport { ref, unref } from 'vue';\nimport type { MaybeRefOrGetter } from 'vue';\n\nexport function useShortKeyPress(\n\tkey: KeyFilter,\n\tfn: () => void,\n\t{\n\t\tdedupe = true,\n\t\tthreshold = 300,\n\t\tdisabled = false,\n\t}: {\n\t\tdedupe?: boolean;\n\t\tthreshold?: number;\n\t\tdisabled?: MaybeRefOrGetter<boolean>;\n\t},\n) {\n\tconst keyDownTime = ref<number | null>(null);\n\n\tonKeyDown(\n\t\tkey,\n\t\t() => {\n\t\t\tif (unref(disabled)) return;\n\n\t\t\tkeyDownTime.value = Date.now();\n\t\t},\n\t\t{\n\t\t\tdedupe,\n\t\t},\n\t);\n\n\tonKeyUp(key, () => {\n\t\tif (unref(disabled) || !keyDownTime.value) return;\n\n\t\tconst isShortPress = Date.now() - keyDownTime.value < threshold;\n\t\tif (isShortPress) {\n\t\t\tfn();\n\t\t}\n\t});\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,iBACf,KACA,IACA,EACC,SAAS,MACT,YAAY,KACZ,WAAW,SAMX;CACD,MAAM,2BAAiC,KAAK;AAE5C,8BACC,WACM;AACL,qBAAU,SAAS,CAAE;AAErB,cAAY,QAAQ,KAAK,KAAK;IAE/B,EACC,QACA,CACD;AAED,4BAAQ,WAAW;AAClB,qBAAU,SAAS,IAAI,CAAC,YAAY,MAAO;AAG3C,MADqB,KAAK,KAAK,GAAG,YAAY,QAAQ,UAErD,KAAI;GAEJ"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MaybeRefOrGetter } from "vue";
|
|
2
|
+
import { KeyFilter } from "@vueuse/core";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
//#region src/useShortKeyPress.d.ts
|
|
5
|
+
declare function useShortKeyPress(key: KeyFilter, fn: () => void, {
|
|
6
|
+
dedupe,
|
|
7
|
+
threshold,
|
|
8
|
+
disabled
|
|
9
|
+
}: {
|
|
10
|
+
dedupe?: boolean;
|
|
11
|
+
threshold?: number;
|
|
12
|
+
disabled?: MaybeRefOrGetter<boolean>;
|
|
8
13
|
}): void;
|
|
9
|
-
|
|
14
|
+
//#endregion
|
|
10
15
|
export { useShortKeyPress };
|
|
16
|
+
//# sourceMappingURL=useShortKeyPress.d.cts.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MaybeRefOrGetter } from "vue";
|
|
2
|
+
import { KeyFilter } from "@vueuse/core";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
//#region src/useShortKeyPress.d.ts
|
|
5
|
+
declare function useShortKeyPress(key: KeyFilter, fn: () => void, {
|
|
6
|
+
dedupe,
|
|
7
|
+
threshold,
|
|
8
|
+
disabled
|
|
9
|
+
}: {
|
|
10
|
+
dedupe?: boolean;
|
|
11
|
+
threshold?: number;
|
|
12
|
+
disabled?: MaybeRefOrGetter<boolean>;
|
|
8
13
|
}): void;
|
|
9
|
-
|
|
14
|
+
//#endregion
|
|
10
15
|
export { useShortKeyPress };
|
|
16
|
+
//# sourceMappingURL=useShortKeyPress.d.ts.map
|
package/dist/useShortKeyPress.js
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
// src/useShortKeyPress.ts
|
|
2
|
-
import { onKeyDown, onKeyUp } from "@vueuse/core";
|
|
3
1
|
import { ref, unref } from "vue";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
dedupe
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
onKeyUp(key, () => {
|
|
21
|
-
if (unref(disabled) || !keyDownTime.value) return;
|
|
22
|
-
const isShortPress = Date.now() - keyDownTime.value < threshold;
|
|
23
|
-
if (isShortPress) {
|
|
24
|
-
fn();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
2
|
+
import { onKeyDown, onKeyUp } from "@vueuse/core";
|
|
3
|
+
|
|
4
|
+
//#region src/useShortKeyPress.ts
|
|
5
|
+
function useShortKeyPress(key, fn, { dedupe = true, threshold = 300, disabled = false }) {
|
|
6
|
+
const keyDownTime = ref(null);
|
|
7
|
+
onKeyDown(key, () => {
|
|
8
|
+
if (unref(disabled)) return;
|
|
9
|
+
keyDownTime.value = Date.now();
|
|
10
|
+
}, { dedupe });
|
|
11
|
+
onKeyUp(key, () => {
|
|
12
|
+
if (unref(disabled) || !keyDownTime.value) return;
|
|
13
|
+
if (Date.now() - keyDownTime.value < threshold) fn();
|
|
14
|
+
});
|
|
27
15
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { useShortKeyPress };
|
|
31
19
|
//# sourceMappingURL=useShortKeyPress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useShortKeyPress.ts"],"sourcesContent":["import { onKeyDown, onKeyUp } from '@vueuse/core';\nimport type { KeyFilter } from '@vueuse/core';\nimport { ref, unref } from 'vue';\nimport type { MaybeRefOrGetter } from 'vue';\n\nexport function useShortKeyPress(\n\tkey: KeyFilter,\n\tfn: () => void,\n\t{\n\t\tdedupe = true,\n\t\tthreshold = 300,\n\t\tdisabled = false,\n\t}: {\n\t\tdedupe?: boolean;\n\t\tthreshold?: number;\n\t\tdisabled?: MaybeRefOrGetter<boolean>;\n\t},\n) {\n\tconst keyDownTime = ref<number | null>(null);\n\n\tonKeyDown(\n\t\tkey,\n\t\t() => {\n\t\t\tif (unref(disabled)) return;\n\n\t\t\tkeyDownTime.value = Date.now();\n\t\t},\n\t\t{\n\t\t\tdedupe,\n\t\t},\n\t);\n\n\tonKeyUp(key, () => {\n\t\tif (unref(disabled) || !keyDownTime.value) return;\n\n\t\tconst isShortPress = Date.now() - keyDownTime.value < threshold;\n\t\tif (isShortPress) {\n\t\t\tfn();\n\t\t}\n\t});\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useShortKeyPress.js","names":[],"sources":["../src/useShortKeyPress.ts"],"sourcesContent":["import { onKeyDown, onKeyUp } from '@vueuse/core';\nimport type { KeyFilter } from '@vueuse/core';\nimport { ref, unref } from 'vue';\nimport type { MaybeRefOrGetter } from 'vue';\n\nexport function useShortKeyPress(\n\tkey: KeyFilter,\n\tfn: () => void,\n\t{\n\t\tdedupe = true,\n\t\tthreshold = 300,\n\t\tdisabled = false,\n\t}: {\n\t\tdedupe?: boolean;\n\t\tthreshold?: number;\n\t\tdisabled?: MaybeRefOrGetter<boolean>;\n\t},\n) {\n\tconst keyDownTime = ref<number | null>(null);\n\n\tonKeyDown(\n\t\tkey,\n\t\t() => {\n\t\t\tif (unref(disabled)) return;\n\n\t\t\tkeyDownTime.value = Date.now();\n\t\t},\n\t\t{\n\t\t\tdedupe,\n\t\t},\n\t);\n\n\tonKeyUp(key, () => {\n\t\tif (unref(disabled) || !keyDownTime.value) return;\n\n\t\tconst isShortPress = Date.now() - keyDownTime.value < threshold;\n\t\tif (isShortPress) {\n\t\t\tfn();\n\t\t}\n\t});\n}\n"],"mappings":";;;;AAKA,SAAgB,iBACf,KACA,IACA,EACC,SAAS,MACT,YAAY,KACZ,WAAW,SAMX;CACD,MAAM,cAAc,IAAmB,KAAK;AAE5C,WACC,WACM;AACL,MAAI,MAAM,SAAS,CAAE;AAErB,cAAY,QAAQ,KAAK,KAAK;IAE/B,EACC,QACA,CACD;AAED,SAAQ,WAAW;AAClB,MAAI,MAAM,SAAS,IAAI,CAAC,YAAY,MAAO;AAG3C,MADqB,KAAK,KAAK,GAAG,YAAY,QAAQ,UAErD,KAAI;GAEJ"}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
vue = require_chunk.__toESM(vue);
|
|
4
|
+
let __vueuse_core = require("@vueuse/core");
|
|
5
|
+
__vueuse_core = require_chunk.__toESM(__vueuse_core);
|
|
6
|
+
|
|
7
|
+
//#region src/useThrottleWithReactiveDelay.ts
|
|
8
|
+
/**
|
|
9
|
+
* Similar to `useThrottle` from @vueuse/core, but with changeable delay
|
|
10
|
+
*/
|
|
4
11
|
function useThrottleWithReactiveDelay(state, delay) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throttled.value = latest;
|
|
11
|
-
},
|
|
12
|
-
delay,
|
|
13
|
-
true,
|
|
14
|
-
true
|
|
15
|
-
),
|
|
16
|
-
{ immediate: true }
|
|
17
|
-
);
|
|
18
|
-
return throttled;
|
|
12
|
+
const throttled = (0, vue.shallowRef)(state.value);
|
|
13
|
+
(0, vue.watch)(state, (0, __vueuse_core.useThrottleFn)((latest) => {
|
|
14
|
+
throttled.value = latest;
|
|
15
|
+
}, delay, true, true), { immediate: true });
|
|
16
|
+
return throttled;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
//#endregion
|
|
22
20
|
exports.useThrottleWithReactiveDelay = useThrottleWithReactiveDelay;
|
|
23
21
|
//# sourceMappingURL=useThrottleWithReactiveDelay.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useThrottleWithReactiveDelay.cjs","names":[],"sources":["../src/useThrottleWithReactiveDelay.ts"],"sourcesContent":["import { useThrottleFn } from '@vueuse/core';\nimport { shallowRef, watch, type Ref, type ShallowRef } from 'vue';\n\n/**\n * Similar to `useThrottle` from @vueuse/core, but with changeable delay\n */\nexport function useThrottleWithReactiveDelay<T>(state: Ref<T>, delay: Ref<number>): ShallowRef<T> {\n\tconst throttled = shallowRef(state.value);\n\n\twatch(\n\t\tstate,\n\t\tuseThrottleFn(\n\t\t\t(latest: T) => {\n\t\t\t\tthrottled.value = latest;\n\t\t\t},\n\t\t\tdelay,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t),\n\t\t{ immediate: true },\n\t);\n\n\treturn throttled;\n}\n"],"mappings":";;;;;;;;;;AAMA,SAAgB,6BAAgC,OAAe,OAAmC;CACjG,MAAM,gCAAuB,MAAM,MAAM;AAEzC,gBACC,yCAEE,WAAc;AACd,YAAU,QAAQ;IAEnB,OACA,MACA,KACA,EACD,EAAE,WAAW,MAAM,CACnB;AAED,QAAO"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Ref, ShallowRef } from
|
|
1
|
+
import { Ref, ShallowRef } from "vue";
|
|
2
2
|
|
|
3
|
+
//#region src/useThrottleWithReactiveDelay.d.ts
|
|
3
4
|
declare function useThrottleWithReactiveDelay<T>(state: Ref<T>, delay: Ref<number>): ShallowRef<T>;
|
|
4
|
-
|
|
5
|
+
//#endregion
|
|
5
6
|
export { useThrottleWithReactiveDelay };
|
|
7
|
+
//# sourceMappingURL=useThrottleWithReactiveDelay.d.cts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Ref, ShallowRef } from
|
|
1
|
+
import { Ref, ShallowRef } from "vue";
|
|
2
2
|
|
|
3
|
+
//#region src/useThrottleWithReactiveDelay.d.ts
|
|
3
4
|
declare function useThrottleWithReactiveDelay<T>(state: Ref<T>, delay: Ref<number>): ShallowRef<T>;
|
|
4
|
-
|
|
5
|
+
//#endregion
|
|
5
6
|
export { useThrottleWithReactiveDelay };
|
|
7
|
+
//# sourceMappingURL=useThrottleWithReactiveDelay.d.ts.map
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
// src/useThrottleWithReactiveDelay.ts
|
|
2
|
-
import { useThrottleFn } from "@vueuse/core";
|
|
3
1
|
import { shallowRef, watch } from "vue";
|
|
2
|
+
import { useThrottleFn } from "@vueuse/core";
|
|
3
|
+
|
|
4
|
+
//#region src/useThrottleWithReactiveDelay.ts
|
|
5
|
+
/**
|
|
6
|
+
* Similar to `useThrottle` from @vueuse/core, but with changeable delay
|
|
7
|
+
*/
|
|
4
8
|
function useThrottleWithReactiveDelay(state, delay) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throttled.value = latest;
|
|
11
|
-
},
|
|
12
|
-
delay,
|
|
13
|
-
true,
|
|
14
|
-
true
|
|
15
|
-
),
|
|
16
|
-
{ immediate: true }
|
|
17
|
-
);
|
|
18
|
-
return throttled;
|
|
9
|
+
const throttled = shallowRef(state.value);
|
|
10
|
+
watch(state, useThrottleFn((latest) => {
|
|
11
|
+
throttled.value = latest;
|
|
12
|
+
}, delay, true, true), { immediate: true });
|
|
13
|
+
return throttled;
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useThrottleWithReactiveDelay };
|
|
23
18
|
//# sourceMappingURL=useThrottleWithReactiveDelay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useThrottleWithReactiveDelay.ts"],"sourcesContent":["import { useThrottleFn } from '@vueuse/core';\nimport { shallowRef, watch, type Ref, type ShallowRef } from 'vue';\n\n/**\n * Similar to `useThrottle` from @vueuse/core, but with changeable delay\n */\nexport function useThrottleWithReactiveDelay<T>(state: Ref<T>, delay: Ref<number>): ShallowRef<T> {\n\tconst throttled = shallowRef(state.value);\n\n\twatch(\n\t\tstate,\n\t\tuseThrottleFn(\n\t\t\t(latest: T) => {\n\t\t\t\tthrottled.value = latest;\n\t\t\t},\n\t\t\tdelay,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t),\n\t\t{ immediate: true },\n\t);\n\n\treturn throttled;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useThrottleWithReactiveDelay.js","names":[],"sources":["../src/useThrottleWithReactiveDelay.ts"],"sourcesContent":["import { useThrottleFn } from '@vueuse/core';\nimport { shallowRef, watch, type Ref, type ShallowRef } from 'vue';\n\n/**\n * Similar to `useThrottle` from @vueuse/core, but with changeable delay\n */\nexport function useThrottleWithReactiveDelay<T>(state: Ref<T>, delay: Ref<number>): ShallowRef<T> {\n\tconst throttled = shallowRef(state.value);\n\n\twatch(\n\t\tstate,\n\t\tuseThrottleFn(\n\t\t\t(latest: T) => {\n\t\t\t\tthrottled.value = latest;\n\t\t\t},\n\t\t\tdelay,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t),\n\t\t{ immediate: true },\n\t);\n\n\treturn throttled;\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,6BAAgC,OAAe,OAAmC;CACjG,MAAM,YAAY,WAAW,MAAM,MAAM;AAEzC,OACC,OACA,eACE,WAAc;AACd,YAAU,QAAQ;IAEnB,OACA,MACA,KACA,EACD,EAAE,WAAW,MAAM,CACnB;AAED,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/composables",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"LICENSE.md",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"@vue/tsconfig": "^0.7.0",
|
|
23
23
|
"@vueuse/core": "^10.11.0",
|
|
24
24
|
"vue": "^3.5.13",
|
|
25
|
-
"
|
|
25
|
+
"tsdown": "^0.15.6",
|
|
26
26
|
"typescript": "5.9.2",
|
|
27
|
-
"vite": "
|
|
27
|
+
"vite": "npm:rolldown-vite@latest",
|
|
28
28
|
"vitest": "^3.1.3",
|
|
29
29
|
"vue-tsc": "^2.2.8",
|
|
30
|
-
"@n8n/eslint-config": "0.0.1",
|
|
31
30
|
"@n8n/typescript-config": "1.3.0",
|
|
32
|
-
"@n8n/vitest-config": "1.5.0"
|
|
31
|
+
"@n8n/vitest-config": "1.5.0",
|
|
32
|
+
"@n8n/eslint-config": "0.0.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@vueuse/core": "^10.11.0",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"url": "git+https://github.com/n8n-io/n8n.git"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"dev": "
|
|
50
|
-
"build": "
|
|
49
|
+
"dev": "tsdown --watch",
|
|
50
|
+
"build": "tsdown",
|
|
51
51
|
"preview": "vite preview",
|
|
52
52
|
"typecheck": "vue-tsc --noEmit",
|
|
53
53
|
"test": "vitest run",
|