@n8n/composables 1.12.0 → 1.14.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/useDeviceSupport.cjs +0 -2
- package/dist/useDeviceSupport.cjs.map +1 -1
- package/dist/{useDeviceSupport.d.ts → useDeviceSupport.d.mts} +1 -1
- package/dist/{useDeviceSupport.js → useDeviceSupport.mjs} +1 -1
- package/dist/useDeviceSupport.mjs.map +1 -0
- package/dist/useDocumentTitle.cjs +38 -0
- package/dist/useDocumentTitle.cjs.map +1 -0
- package/dist/useDocumentTitle.d.cts +17 -0
- package/dist/useDocumentTitle.d.mts +17 -0
- package/dist/useDocumentTitle.mjs +38 -0
- package/dist/useDocumentTitle.mjs.map +1 -0
- package/dist/useShortKeyPress.cjs +0 -3
- package/dist/useShortKeyPress.cjs.map +1 -1
- package/dist/{useShortKeyPress.d.ts → useShortKeyPress.d.mts} +1 -1
- package/dist/{useShortKeyPress.js → useShortKeyPress.mjs} +1 -1
- package/dist/useShortKeyPress.mjs.map +1 -0
- package/dist/useThrottleWithReactiveDelay.cjs +0 -3
- package/dist/useThrottleWithReactiveDelay.cjs.map +1 -1
- package/dist/{useThrottleWithReactiveDelay.d.ts → useThrottleWithReactiveDelay.d.mts} +1 -1
- package/dist/{useThrottleWithReactiveDelay.js → useThrottleWithReactiveDelay.mjs} +1 -1
- package/dist/useThrottleWithReactiveDelay.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/useDeviceSupport.js.map +0 -1
- package/dist/useShortKeyPress.js.map +0 -1
- package/dist/useThrottleWithReactiveDelay.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeviceSupport.mjs","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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
let vue = require("vue");
|
|
2
|
+
|
|
3
|
+
//#region src/useDocumentTitle.ts
|
|
4
|
+
const DEFAULT_TITLE = "n8n";
|
|
5
|
+
const DEFAULT_TAGLINE = "Workflow Automation";
|
|
6
|
+
function useDocumentTitle(options = {}) {
|
|
7
|
+
const { releaseChannel, windowRef } = options;
|
|
8
|
+
const suffix = !releaseChannel || releaseChannel === "stable" ? DEFAULT_TITLE : `${DEFAULT_TITLE}[${releaseChannel.toUpperCase()}]`;
|
|
9
|
+
const currentState = (0, vue.ref)(void 0);
|
|
10
|
+
const set = (title) => {
|
|
11
|
+
const sections = [title || DEFAULT_TAGLINE, suffix];
|
|
12
|
+
(windowRef?.value?.document ?? document).title = sections.join(" - ");
|
|
13
|
+
};
|
|
14
|
+
const reset = () => {
|
|
15
|
+
currentState.value = void 0;
|
|
16
|
+
set("");
|
|
17
|
+
};
|
|
18
|
+
const setDocumentTitle = (workflowName, status) => {
|
|
19
|
+
currentState.value = status;
|
|
20
|
+
let prefix = "⚠️";
|
|
21
|
+
if (status === "EXECUTING") prefix = "🔄";
|
|
22
|
+
else if (status === "IDLE") prefix = "▶️";
|
|
23
|
+
else if (status === "AI_BUILDING") prefix = "[Building]";
|
|
24
|
+
else if (status === "AI_DONE") prefix = "[Done]";
|
|
25
|
+
set(`${prefix} ${workflowName}`);
|
|
26
|
+
};
|
|
27
|
+
const getDocumentState = () => currentState.value;
|
|
28
|
+
return {
|
|
29
|
+
set,
|
|
30
|
+
reset,
|
|
31
|
+
setDocumentTitle,
|
|
32
|
+
getDocumentState
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.useDocumentTitle = useDocumentTitle;
|
|
38
|
+
//# sourceMappingURL=useDocumentTitle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDocumentTitle.cjs","names":[],"sources":["../src/useDocumentTitle.ts"],"sourcesContent":["import { ref, type Ref } from 'vue';\n\nconst DEFAULT_TITLE = 'n8n';\nconst DEFAULT_TAGLINE = 'Workflow Automation';\n\nexport type WorkflowTitleStatus =\n\t| 'EXECUTING'\n\t| 'IDLE'\n\t| 'ERROR'\n\t| 'DEBUG'\n\t| 'AI_BUILDING'\n\t| 'AI_DONE';\n\nexport interface UseDocumentTitleOptions {\n\t/**\n\t * The release channel (e.g., 'stable', 'beta', 'dev').\n\t * If not provided or 'stable', the title will be 'n8n'.\n\t * Otherwise, it will be 'n8n[CHANNEL]'.\n\t */\n\treleaseChannel?: string;\n\t/**\n\t * Optional window reference for setting the document title.\n\t * Useful for pop-out windows.\n\t */\n\twindowRef?: Ref<Window | undefined>;\n}\n\nexport function useDocumentTitle(options: UseDocumentTitleOptions = {}) {\n\tconst { releaseChannel, windowRef } = options;\n\tconst suffix =\n\t\t!releaseChannel || releaseChannel === 'stable'\n\t\t\t? DEFAULT_TITLE\n\t\t\t: `${DEFAULT_TITLE}[${releaseChannel.toUpperCase()}]`;\n\n\tconst currentState = ref<WorkflowTitleStatus | undefined>(undefined);\n\n\tconst set = (title: string) => {\n\t\tconst sections = [title || DEFAULT_TAGLINE, suffix];\n\t\t(windowRef?.value?.document ?? document).title = sections.join(' - ');\n\t};\n\n\tconst reset = () => {\n\t\tcurrentState.value = undefined;\n\t\tset('');\n\t};\n\n\tconst setDocumentTitle = (workflowName: string, status: WorkflowTitleStatus) => {\n\t\tcurrentState.value = status;\n\t\tlet prefix = '⚠️';\n\t\tif (status === 'EXECUTING') {\n\t\t\tprefix = '🔄';\n\t\t} else if (status === 'IDLE') {\n\t\t\tprefix = '▶️';\n\t\t} else if (status === 'AI_BUILDING') {\n\t\t\tprefix = '[Building]';\n\t\t} else if (status === 'AI_DONE') {\n\t\t\tprefix = '[Done]';\n\t\t}\n\t\tset(`${prefix} ${workflowName}`);\n\t};\n\n\tconst getDocumentState = () => currentState.value;\n\n\treturn { set, reset, setDocumentTitle, getDocumentState };\n}\n"],"mappings":";;;AAEA,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AAwBxB,SAAgB,iBAAiB,UAAmC,EAAE,EAAE;CACvE,MAAM,EAAE,gBAAgB,cAAc;CACtC,MAAM,SACL,CAAC,kBAAkB,mBAAmB,WACnC,gBACA,GAAG,cAAc,GAAG,eAAe,aAAa,CAAC;CAErD,MAAM,4BAAoD,OAAU;CAEpE,MAAM,OAAO,UAAkB;EAC9B,MAAM,WAAW,CAAC,SAAS,iBAAiB,OAAO;AACnD,GAAC,WAAW,OAAO,YAAY,UAAU,QAAQ,SAAS,KAAK,MAAM;;CAGtE,MAAM,cAAc;AACnB,eAAa,QAAQ;AACrB,MAAI,GAAG;;CAGR,MAAM,oBAAoB,cAAsB,WAAgC;AAC/E,eAAa,QAAQ;EACrB,IAAI,SAAS;AACb,MAAI,WAAW,YACd,UAAS;WACC,WAAW,OACrB,UAAS;WACC,WAAW,cACrB,UAAS;WACC,WAAW,UACrB,UAAS;AAEV,MAAI,GAAG,OAAO,GAAG,eAAe;;CAGjC,MAAM,yBAAyB,aAAa;AAE5C,QAAO;EAAE;EAAK;EAAO;EAAkB;EAAkB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useDocumentTitle.d.ts
|
|
4
|
+
type WorkflowTitleStatus = 'EXECUTING' | 'IDLE' | 'ERROR' | 'DEBUG' | 'AI_BUILDING' | 'AI_DONE';
|
|
5
|
+
interface UseDocumentTitleOptions {
|
|
6
|
+
releaseChannel?: string;
|
|
7
|
+
windowRef?: Ref<Window | undefined>;
|
|
8
|
+
}
|
|
9
|
+
declare function useDocumentTitle(options?: UseDocumentTitleOptions): {
|
|
10
|
+
set: (title: string) => void;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
setDocumentTitle: (workflowName: string, status: WorkflowTitleStatus) => void;
|
|
13
|
+
getDocumentState: () => WorkflowTitleStatus | undefined;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { UseDocumentTitleOptions, WorkflowTitleStatus, useDocumentTitle };
|
|
17
|
+
//# sourceMappingURL=useDocumentTitle.d.cts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useDocumentTitle.d.ts
|
|
4
|
+
type WorkflowTitleStatus = 'EXECUTING' | 'IDLE' | 'ERROR' | 'DEBUG' | 'AI_BUILDING' | 'AI_DONE';
|
|
5
|
+
interface UseDocumentTitleOptions {
|
|
6
|
+
releaseChannel?: string;
|
|
7
|
+
windowRef?: Ref<Window | undefined>;
|
|
8
|
+
}
|
|
9
|
+
declare function useDocumentTitle(options?: UseDocumentTitleOptions): {
|
|
10
|
+
set: (title: string) => void;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
setDocumentTitle: (workflowName: string, status: WorkflowTitleStatus) => void;
|
|
13
|
+
getDocumentState: () => WorkflowTitleStatus | undefined;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { UseDocumentTitleOptions, WorkflowTitleStatus, useDocumentTitle };
|
|
17
|
+
//# sourceMappingURL=useDocumentTitle.d.mts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useDocumentTitle.ts
|
|
4
|
+
const DEFAULT_TITLE = "n8n";
|
|
5
|
+
const DEFAULT_TAGLINE = "Workflow Automation";
|
|
6
|
+
function useDocumentTitle(options = {}) {
|
|
7
|
+
const { releaseChannel, windowRef } = options;
|
|
8
|
+
const suffix = !releaseChannel || releaseChannel === "stable" ? DEFAULT_TITLE : `${DEFAULT_TITLE}[${releaseChannel.toUpperCase()}]`;
|
|
9
|
+
const currentState = ref(void 0);
|
|
10
|
+
const set = (title) => {
|
|
11
|
+
const sections = [title || DEFAULT_TAGLINE, suffix];
|
|
12
|
+
(windowRef?.value?.document ?? document).title = sections.join(" - ");
|
|
13
|
+
};
|
|
14
|
+
const reset = () => {
|
|
15
|
+
currentState.value = void 0;
|
|
16
|
+
set("");
|
|
17
|
+
};
|
|
18
|
+
const setDocumentTitle = (workflowName, status) => {
|
|
19
|
+
currentState.value = status;
|
|
20
|
+
let prefix = "⚠️";
|
|
21
|
+
if (status === "EXECUTING") prefix = "🔄";
|
|
22
|
+
else if (status === "IDLE") prefix = "▶️";
|
|
23
|
+
else if (status === "AI_BUILDING") prefix = "[Building]";
|
|
24
|
+
else if (status === "AI_DONE") prefix = "[Done]";
|
|
25
|
+
set(`${prefix} ${workflowName}`);
|
|
26
|
+
};
|
|
27
|
+
const getDocumentState = () => currentState.value;
|
|
28
|
+
return {
|
|
29
|
+
set,
|
|
30
|
+
reset,
|
|
31
|
+
setDocumentTitle,
|
|
32
|
+
getDocumentState
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { useDocumentTitle };
|
|
38
|
+
//# sourceMappingURL=useDocumentTitle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDocumentTitle.mjs","names":[],"sources":["../src/useDocumentTitle.ts"],"sourcesContent":["import { ref, type Ref } from 'vue';\n\nconst DEFAULT_TITLE = 'n8n';\nconst DEFAULT_TAGLINE = 'Workflow Automation';\n\nexport type WorkflowTitleStatus =\n\t| 'EXECUTING'\n\t| 'IDLE'\n\t| 'ERROR'\n\t| 'DEBUG'\n\t| 'AI_BUILDING'\n\t| 'AI_DONE';\n\nexport interface UseDocumentTitleOptions {\n\t/**\n\t * The release channel (e.g., 'stable', 'beta', 'dev').\n\t * If not provided or 'stable', the title will be 'n8n'.\n\t * Otherwise, it will be 'n8n[CHANNEL]'.\n\t */\n\treleaseChannel?: string;\n\t/**\n\t * Optional window reference for setting the document title.\n\t * Useful for pop-out windows.\n\t */\n\twindowRef?: Ref<Window | undefined>;\n}\n\nexport function useDocumentTitle(options: UseDocumentTitleOptions = {}) {\n\tconst { releaseChannel, windowRef } = options;\n\tconst suffix =\n\t\t!releaseChannel || releaseChannel === 'stable'\n\t\t\t? DEFAULT_TITLE\n\t\t\t: `${DEFAULT_TITLE}[${releaseChannel.toUpperCase()}]`;\n\n\tconst currentState = ref<WorkflowTitleStatus | undefined>(undefined);\n\n\tconst set = (title: string) => {\n\t\tconst sections = [title || DEFAULT_TAGLINE, suffix];\n\t\t(windowRef?.value?.document ?? document).title = sections.join(' - ');\n\t};\n\n\tconst reset = () => {\n\t\tcurrentState.value = undefined;\n\t\tset('');\n\t};\n\n\tconst setDocumentTitle = (workflowName: string, status: WorkflowTitleStatus) => {\n\t\tcurrentState.value = status;\n\t\tlet prefix = '⚠️';\n\t\tif (status === 'EXECUTING') {\n\t\t\tprefix = '🔄';\n\t\t} else if (status === 'IDLE') {\n\t\t\tprefix = '▶️';\n\t\t} else if (status === 'AI_BUILDING') {\n\t\t\tprefix = '[Building]';\n\t\t} else if (status === 'AI_DONE') {\n\t\t\tprefix = '[Done]';\n\t\t}\n\t\tset(`${prefix} ${workflowName}`);\n\t};\n\n\tconst getDocumentState = () => currentState.value;\n\n\treturn { set, reset, setDocumentTitle, getDocumentState };\n}\n"],"mappings":";;;AAEA,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AAwBxB,SAAgB,iBAAiB,UAAmC,EAAE,EAAE;CACvE,MAAM,EAAE,gBAAgB,cAAc;CACtC,MAAM,SACL,CAAC,kBAAkB,mBAAmB,WACnC,gBACA,GAAG,cAAc,GAAG,eAAe,aAAa,CAAC;CAErD,MAAM,eAAe,IAAqC,OAAU;CAEpE,MAAM,OAAO,UAAkB;EAC9B,MAAM,WAAW,CAAC,SAAS,iBAAiB,OAAO;AACnD,GAAC,WAAW,OAAO,YAAY,UAAU,QAAQ,SAAS,KAAK,MAAM;;CAGtE,MAAM,cAAc;AACnB,eAAa,QAAQ;AACrB,MAAI,GAAG;;CAGR,MAAM,oBAAoB,cAAsB,WAAgC;AAC/E,eAAa,QAAQ;EACrB,IAAI,SAAS;AACb,MAAI,WAAW,YACd,UAAS;WACC,WAAW,OACrB,UAAS;WACC,WAAW,cACrB,UAAS;WACC,WAAW,UACrB,UAAS;AAEV,MAAI,GAAG,OAAO,GAAG,eAAe;;CAGjC,MAAM,yBAAyB,aAAa;AAE5C,QAAO;EAAE;EAAK;EAAO;EAAkB;EAAkB"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
1
|
let vue = require("vue");
|
|
3
|
-
vue = require_chunk.__toESM(vue);
|
|
4
2
|
let __vueuse_core = require("@vueuse/core");
|
|
5
|
-
__vueuse_core = require_chunk.__toESM(__vueuse_core);
|
|
6
3
|
|
|
7
4
|
//#region src/useShortKeyPress.ts
|
|
8
5
|
function useShortKeyPress(key, fn, { dedupe = true, threshold = 300, disabled = false }) {
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShortKeyPress.mjs","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,8 +1,5 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
1
|
let vue = require("vue");
|
|
3
|
-
vue = require_chunk.__toESM(vue);
|
|
4
2
|
let __vueuse_core = require("@vueuse/core");
|
|
5
|
-
__vueuse_core = require_chunk.__toESM(__vueuse_core);
|
|
6
3
|
|
|
7
4
|
//#region src/useThrottleWithReactiveDelay.ts
|
|
8
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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"}
|
|
@@ -4,4 +4,4 @@ import { Ref, ShallowRef } from "vue";
|
|
|
4
4
|
declare function useThrottleWithReactiveDelay<T>(state: Ref<T>, delay: Ref<number>): ShallowRef<T>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { useThrottleWithReactiveDelay };
|
|
7
|
-
//# sourceMappingURL=useThrottleWithReactiveDelay.d.
|
|
7
|
+
//# sourceMappingURL=useThrottleWithReactiveDelay.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThrottleWithReactiveDelay.mjs","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.14.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"LICENSE.md",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
],
|
|
10
10
|
"exports": {
|
|
11
11
|
"./*": {
|
|
12
|
-
"types": "./dist/*.d.
|
|
13
|
-
"import": "./dist/*.
|
|
12
|
+
"types": "./dist/*.d.mts",
|
|
13
|
+
"import": "./dist/*.mjs",
|
|
14
14
|
"require": "./dist/*.cjs"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
@@ -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
|
-
"tsdown": "^0.
|
|
25
|
+
"tsdown": "^0.16.5",
|
|
26
26
|
"typescript": "5.9.2",
|
|
27
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",
|
|
30
31
|
"@n8n/typescript-config": "1.3.0",
|
|
31
|
-
"@n8n/vitest-config": "1.
|
|
32
|
-
"@n8n/eslint-config": "0.0.1"
|
|
32
|
+
"@n8n/vitest-config": "1.6.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@vueuse/core": "^10.11.0",
|
package/dist/chunk-CUT6urMc.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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"}
|