@n8n/composables 1.21.0 → 1.23.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/injectionKeys.cjs +3 -0
- package/dist/injectionKeys.d.cts +7 -0
- package/dist/injectionKeys.d.mts +7 -0
- package/dist/injectionKeys.mjs +3 -0
- package/dist/injectionKeys2.cjs +17 -0
- package/dist/injectionKeys2.cjs.map +1 -0
- package/dist/injectionKeys2.mjs +11 -0
- package/dist/injectionKeys2.mjs.map +1 -0
- package/dist/structuralComputed.cjs +1 -0
- package/dist/structuralComputed.cjs.map +1 -1
- package/dist/useClipboard.cjs +62 -0
- package/dist/useClipboard.cjs.map +1 -0
- package/dist/useClipboard.d.cts +18 -0
- package/dist/useClipboard.d.mts +18 -0
- package/dist/useClipboard.mjs +61 -0
- package/dist/useClipboard.mjs.map +1 -0
- package/dist/useDebounce.cjs +65 -0
- package/dist/useDebounce.cjs.map +1 -0
- package/dist/useDebounce.d.cts +17 -0
- package/dist/useDebounce.d.mts +17 -0
- package/dist/useDebounce.mjs +39 -0
- package/dist/useDebounce.mjs.map +1 -0
- package/dist/useDeviceSupport.cjs +1 -0
- package/dist/useDeviceSupport.cjs.map +1 -1
- package/dist/useDeviceSupport.d.cts +2 -2
- package/dist/useDocumentTitle.cjs +1 -0
- package/dist/useDocumentTitle.cjs.map +1 -1
- package/dist/useExternalHooks.cjs +5 -0
- package/dist/useExternalHooks.d.cts +12 -0
- package/dist/useExternalHooks.d.mts +12 -0
- package/dist/useExternalHooks.mjs +3 -0
- package/dist/useExternalHooks2.cjs +56 -0
- package/dist/useExternalHooks2.cjs.map +1 -0
- package/dist/useExternalHooks2.mjs +38 -0
- package/dist/useExternalHooks2.mjs.map +1 -0
- package/dist/useShortKeyPress.cjs +1 -0
- package/dist/useShortKeyPress.cjs.map +1 -1
- package/dist/useStyles.cjs +19 -0
- package/dist/useStyles.cjs.map +1 -0
- package/dist/useStyles.d.cts +31 -0
- package/dist/useStyles.d.mts +31 -0
- package/dist/useStyles.mjs +18 -0
- package/dist/useStyles.mjs.map +1 -0
- package/dist/useTelemetry.cjs +5 -0
- package/dist/useTelemetry.d.cts +42 -0
- package/dist/useTelemetry.d.mts +42 -0
- package/dist/useTelemetry.mjs +3 -0
- package/dist/useTelemetry2.cjs +76 -0
- package/dist/useTelemetry2.cjs.map +1 -0
- package/dist/useTelemetry2.mjs +58 -0
- package/dist/useTelemetry2.mjs.map +1 -0
- package/dist/useThrottleWithReactiveDelay.cjs +1 -0
- package/dist/useThrottleWithReactiveDelay.cjs.map +1 -1
- package/dist/useToast.cjs +175 -0
- package/dist/useToast.cjs.map +1 -0
- package/dist/useToast.d.cts +32 -0
- package/dist/useToast.d.mts +32 -0
- package/dist/useToast.mjs +173 -0
- package/dist/useToast.mjs.map +1 -0
- package/package.json +20 -7
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/injectionKeys.ts
|
|
3
|
+
/**
|
|
4
|
+
* Injection key for an optional pop-out window. Consumers `provide` it from the
|
|
5
|
+
* host that owns the detached window; `useClipboard` reads it so a copy issued
|
|
6
|
+
* inside the pop-out targets that window's `navigator.clipboard`.
|
|
7
|
+
*/
|
|
8
|
+
const PopOutWindowKey = Symbol("PopOutWindow");
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, 'PopOutWindowKey', {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return PopOutWindowKey;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=injectionKeys2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectionKeys2.cjs","names":["PopOutWindowKey: InjectionKey<Ref<Window | undefined>>"],"sources":["../src/injectionKeys.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue';\n\n/**\n * Injection key for an optional pop-out window. Consumers `provide` it from the\n * host that owns the detached window; `useClipboard` reads it so a copy issued\n * inside the pop-out targets that window's `navigator.clipboard`.\n */\nexport const PopOutWindowKey: InjectionKey<Ref<Window | undefined>> = Symbol('PopOutWindow');\n"],"mappings":";;;;;;;AAOA,MAAaA,kBAAyD,OAAO,eAAe"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/injectionKeys.ts
|
|
2
|
+
/**
|
|
3
|
+
* Injection key for an optional pop-out window. Consumers `provide` it from the
|
|
4
|
+
* host that owns the detached window; `useClipboard` reads it so a copy issued
|
|
5
|
+
* inside the pop-out targets that window's `navigator.clipboard`.
|
|
6
|
+
*/
|
|
7
|
+
const PopOutWindowKey = Symbol("PopOutWindow");
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PopOutWindowKey as t };
|
|
11
|
+
//# sourceMappingURL=injectionKeys2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectionKeys2.mjs","names":["PopOutWindowKey: InjectionKey<Ref<Window | undefined>>"],"sources":["../src/injectionKeys.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue';\n\n/**\n * Injection key for an optional pop-out window. Consumers `provide` it from the\n * host that owns the detached window; `useClipboard` reads it so a copy issued\n * inside the pop-out targets that window's `navigator.clipboard`.\n */\nexport const PopOutWindowKey: InjectionKey<Ref<Window | undefined>> = Symbol('PopOutWindow');\n"],"mappings":";;;;;;AAOA,MAAaA,kBAAyD,OAAO,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structuralComputed.cjs","names":["cached: T"],"sources":["../src/structuralComputed.ts"],"sourcesContent":["import { computed, type ComputedRef } from 'vue';\n\n/**\n * Wraps a derivation in a `computed` that returns the same reference when the\n * new value is considered equal to the previous one by the provided `isEqual`\n * function (defaults to `Object.is`).\n *\n * Vue's `computed` uses `Object.is` on return values to decide whether to\n * notify subscribers. By returning a stable reference on equal content,\n * consumers only re-render when the value actually changes — without each\n * consumer writing its own equality gate.\n *\n * Typical use: pass a deep-equality function (e.g. `lodash/isEqual`) for\n * derivations that produce fresh objects/arrays on every evaluation but are\n * structurally identical most of the time.\n *\n * @example\n * import isEqual from 'lodash/isEqual';\n * const ports = structuralComputed(() => computePorts(...), isEqual);\n */\nexport function structuralComputed<T>(\n\tderive: () => T,\n\tisEqual: (a: T, b: T) => boolean = Object.is,\n): ComputedRef<T> {\n\tlet cached: T;\n\tlet primed = false;\n\treturn computed<T>(() => {\n\t\tconst next = derive();\n\t\tif (primed && isEqual(cached, next)) return cached;\n\t\tcached = next;\n\t\tprimed = true;\n\t\treturn cached;\n\t});\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"structuralComputed.cjs","names":["cached: T"],"sources":["../src/structuralComputed.ts"],"sourcesContent":["import { computed, type ComputedRef } from 'vue';\n\n/**\n * Wraps a derivation in a `computed` that returns the same reference when the\n * new value is considered equal to the previous one by the provided `isEqual`\n * function (defaults to `Object.is`).\n *\n * Vue's `computed` uses `Object.is` on return values to decide whether to\n * notify subscribers. By returning a stable reference on equal content,\n * consumers only re-render when the value actually changes — without each\n * consumer writing its own equality gate.\n *\n * Typical use: pass a deep-equality function (e.g. `lodash/isEqual`) for\n * derivations that produce fresh objects/arrays on every evaluation but are\n * structurally identical most of the time.\n *\n * @example\n * import isEqual from 'lodash/isEqual';\n * const ports = structuralComputed(() => computePorts(...), isEqual);\n */\nexport function structuralComputed<T>(\n\tderive: () => T,\n\tisEqual: (a: T, b: T) => boolean = Object.is,\n): ComputedRef<T> {\n\tlet cached: T;\n\tlet primed = false;\n\treturn computed<T>(() => {\n\t\tconst next = derive();\n\t\tif (primed && isEqual(cached, next)) return cached;\n\t\tcached = next;\n\t\tprimed = true;\n\t\treturn cached;\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,mBACf,QACA,UAAmC,OAAO,IACzB;CACjB,IAAIA;CACJ,IAAI,SAAS;AACb,gCAAyB;EACxB,MAAM,OAAO,QAAQ;AACrB,MAAI,UAAU,QAAQ,QAAQ,KAAK,CAAE,QAAO;AAC5C,WAAS;AACT,WAAS;AACT,SAAO;GACN"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const require_injectionKeys = require('./injectionKeys2.cjs');
|
|
2
|
+
const require_useDebounce = require('./useDebounce.cjs');
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let __vueuse_core = require("@vueuse/core");
|
|
5
|
+
|
|
6
|
+
//#region src/useClipboard.ts
|
|
7
|
+
function useClipboard({ onPaste: onPasteFn = () => {} } = {}) {
|
|
8
|
+
const popOutWindow = (0, vue.inject)(require_injectionKeys.PopOutWindowKey, (0, vue.ref)());
|
|
9
|
+
const { copy: coreCopy, copied, isSupported, text } = (0, __vueuse_core.useClipboard)({ legacy: true });
|
|
10
|
+
async function copy(value) {
|
|
11
|
+
const nav = popOutWindow?.value?.navigator;
|
|
12
|
+
if (nav?.clipboard) try {
|
|
13
|
+
const resolvedValue = typeof value === "function" ? await value() : value;
|
|
14
|
+
await nav.clipboard.writeText(resolvedValue);
|
|
15
|
+
return;
|
|
16
|
+
} catch {}
|
|
17
|
+
await coreCopy(value);
|
|
18
|
+
}
|
|
19
|
+
const ignoreClasses = ["el-messsage-box", "ignore-key-press-canvas"];
|
|
20
|
+
const initialized = (0, vue.ref)(false);
|
|
21
|
+
const onPasteCallback = (0, vue.ref)(onPasteFn || null);
|
|
22
|
+
/**
|
|
23
|
+
* Handles copy/paste events
|
|
24
|
+
* @param event
|
|
25
|
+
*/
|
|
26
|
+
function onPaste(event) {
|
|
27
|
+
if (!onPasteCallback.value) return;
|
|
28
|
+
const path = event.composedPath?.();
|
|
29
|
+
for (const pathElement of path) if (pathElement.className && ignoreClasses.some((className) => pathElement.className.includes?.(className))) return;
|
|
30
|
+
const clipboardData = event.clipboardData;
|
|
31
|
+
if (clipboardData !== null) {
|
|
32
|
+
const clipboardValue = clipboardData.getData("text/plain");
|
|
33
|
+
onPasteCallback.value(clipboardValue, event);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const throttledOnPaste = (0, __vueuse_core.useThrottleFn)(onPaste, 1e3);
|
|
37
|
+
/**
|
|
38
|
+
* Initialize copy/paste elements and events
|
|
39
|
+
*/
|
|
40
|
+
(0, vue.onMounted)(() => {
|
|
41
|
+
if (initialized.value) return;
|
|
42
|
+
document.addEventListener("paste", throttledOnPaste);
|
|
43
|
+
initialized.value = true;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Remove copy/paste elements and events
|
|
47
|
+
*/
|
|
48
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
49
|
+
if (initialized.value) document.removeEventListener("paste", throttledOnPaste);
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
copy,
|
|
53
|
+
copied,
|
|
54
|
+
isSupported,
|
|
55
|
+
text,
|
|
56
|
+
onPaste: onPasteCallback
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.useClipboard = useClipboard;
|
|
62
|
+
//# sourceMappingURL=useClipboard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClipboard.cjs","names":["PopOutWindowKey"],"sources":["../src/useClipboard.ts"],"sourcesContent":["import { useClipboard as useClipboardCore, useThrottleFn } from '@vueuse/core';\nimport { inject, onBeforeUnmount, onMounted, ref } from 'vue';\n\nimport { PopOutWindowKey } from './injectionKeys';\n\ntype ClipboardEventFn = (data: string, event?: ClipboardEvent) => void;\n\nexport function useClipboard({\n\tonPaste: onPasteFn = () => {},\n}: {\n\tonPaste?: ClipboardEventFn;\n} = {}) {\n\tconst popOutWindow = inject(PopOutWindowKey, ref<Window | undefined>());\n\tconst {\n\t\tcopy: coreCopy,\n\t\tcopied,\n\t\tisSupported,\n\t\ttext,\n\t} = useClipboardCore({\n\t\tlegacy: true,\n\t});\n\n\t// Find the correct navigator at copy-time so it works even when the\n\t// pop-out window opens after the composable was created.\n\tasync function copy(value: string | (() => Promise<string>)) {\n\t\tconst nav = popOutWindow?.value?.navigator;\n\t\tif (nav?.clipboard) {\n\t\t\ttry {\n\t\t\t\tconst resolvedValue = typeof value === 'function' ? await value() : value;\n\t\t\t\tawait nav.clipboard.writeText(resolvedValue);\n\t\t\t\treturn;\n\t\t\t} catch {\n\t\t\t\t// Fall back to the core clipboard copy below.\n\t\t\t}\n\t\t}\n\t\tawait coreCopy(value);\n\t}\n\n\tconst ignoreClasses = ['el-messsage-box', 'ignore-key-press-canvas'];\n\tconst initialized = ref(false);\n\n\tconst onPasteCallback = ref<ClipboardEventFn | null>(onPasteFn || null);\n\n\t/**\n\t * Handles copy/paste events\n\t * @param event\n\t */\n\tfunction onPaste(event: ClipboardEvent) {\n\t\tif (!onPasteCallback.value) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if the event got emitted from a message box or from something\n\t\t// else which should ignore the copy/paste\n\t\tconst path = event.composedPath?.() as HTMLElement[];\n\t\tfor (const pathElement of path) {\n\t\t\tif (\n\t\t\t\tpathElement.className &&\n\t\t\t\tignoreClasses.some((className) => pathElement.className.includes?.(className))\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst clipboardData = event.clipboardData;\n\t\tif (clipboardData !== null) {\n\t\t\tconst clipboardValue = clipboardData.getData('text/plain');\n\t\t\tonPasteCallback.value(clipboardValue, event);\n\t\t}\n\t}\n\n\tconst throttledOnPaste = useThrottleFn(onPaste, 1000);\n\n\t/**\n\t * Initialize copy/paste elements and events\n\t */\n\tonMounted(() => {\n\t\tif (initialized.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tdocument.addEventListener('paste', throttledOnPaste);\n\n\t\tinitialized.value = true;\n\t});\n\n\t/**\n\t * Remove copy/paste elements and events\n\t */\n\tonBeforeUnmount(() => {\n\t\tif (initialized.value) {\n\t\t\tdocument.removeEventListener('paste', throttledOnPaste);\n\t\t}\n\t});\n\n\treturn {\n\t\tcopy,\n\t\tcopied,\n\t\tisSupported,\n\t\ttext,\n\t\tonPaste: onPasteCallback,\n\t};\n}\n"],"mappings":";;;;;;AAOA,SAAgB,aAAa,EAC5B,SAAS,kBAAkB,OAGxB,EAAE,EAAE;CACP,MAAM,+BAAsBA,qDAA0C,CAAC;CACvE,MAAM,EACL,MAAM,UACN,QACA,aACA,yCACoB,EACpB,QAAQ,MACR,CAAC;CAIF,eAAe,KAAK,OAAyC;EAC5D,MAAM,MAAM,cAAc,OAAO;AACjC,MAAI,KAAK,UACR,KAAI;GACH,MAAM,gBAAgB,OAAO,UAAU,aAAa,MAAM,OAAO,GAAG;AACpE,SAAM,IAAI,UAAU,UAAU,cAAc;AAC5C;UACO;AAIT,QAAM,SAAS,MAAM;;CAGtB,MAAM,gBAAgB,CAAC,mBAAmB,0BAA0B;CACpE,MAAM,2BAAkB,MAAM;CAE9B,MAAM,+BAA+C,aAAa,KAAK;;;;;CAMvE,SAAS,QAAQ,OAAuB;AACvC,MAAI,CAAC,gBAAgB,MACpB;EAKD,MAAM,OAAO,MAAM,gBAAgB;AACnC,OAAK,MAAM,eAAe,KACzB,KACC,YAAY,aACZ,cAAc,MAAM,cAAc,YAAY,UAAU,WAAW,UAAU,CAAC,CAE9E;EAIF,MAAM,gBAAgB,MAAM;AAC5B,MAAI,kBAAkB,MAAM;GAC3B,MAAM,iBAAiB,cAAc,QAAQ,aAAa;AAC1D,mBAAgB,MAAM,gBAAgB,MAAM;;;CAI9C,MAAM,oDAAiC,SAAS,IAAK;;;;AAKrD,0BAAgB;AACf,MAAI,YAAY,MACf;AAGD,WAAS,iBAAiB,SAAS,iBAAiB;AAEpD,cAAY,QAAQ;GACnB;;;;AAKF,gCAAsB;AACrB,MAAI,YAAY,MACf,UAAS,oBAAoB,SAAS,iBAAiB;GAEvD;AAEF,QAAO;EACN;EACA;EACA;EACA;EACA,SAAS;EACT"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useClipboard.d.ts
|
|
4
|
+
type ClipboardEventFn = (data: string, event?: ClipboardEvent) => void;
|
|
5
|
+
declare function useClipboard({
|
|
6
|
+
onPaste: onPasteFn
|
|
7
|
+
}?: {
|
|
8
|
+
onPaste?: ClipboardEventFn;
|
|
9
|
+
}): {
|
|
10
|
+
copy: (value: string | (() => Promise<string>)) => Promise<void>;
|
|
11
|
+
copied: Readonly<vue0.ShallowRef<boolean>>;
|
|
12
|
+
isSupported: vue0.ComputedRef<boolean>;
|
|
13
|
+
text: Readonly<vue0.ShallowRef<string>>;
|
|
14
|
+
onPaste: vue0.Ref<ClipboardEventFn | null, ClipboardEventFn | null>;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useClipboard };
|
|
18
|
+
//# sourceMappingURL=useClipboard.d.cts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useClipboard.d.ts
|
|
4
|
+
type ClipboardEventFn = (data: string, event?: ClipboardEvent) => void;
|
|
5
|
+
declare function useClipboard({
|
|
6
|
+
onPaste: onPasteFn
|
|
7
|
+
}?: {
|
|
8
|
+
onPaste?: ClipboardEventFn;
|
|
9
|
+
}): {
|
|
10
|
+
copy: (value: string | (() => Promise<string>)) => Promise<void>;
|
|
11
|
+
copied: Readonly<vue0.ShallowRef<boolean>>;
|
|
12
|
+
isSupported: vue0.ComputedRef<boolean>;
|
|
13
|
+
text: Readonly<vue0.ShallowRef<string>>;
|
|
14
|
+
onPaste: vue0.Ref<ClipboardEventFn | null, ClipboardEventFn | null>;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useClipboard };
|
|
18
|
+
//# sourceMappingURL=useClipboard.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { t as PopOutWindowKey } from "./injectionKeys2.mjs";
|
|
2
|
+
import { inject, onBeforeUnmount, onMounted, ref } from "vue";
|
|
3
|
+
import { useClipboard as useClipboard$1, useThrottleFn } from "@vueuse/core";
|
|
4
|
+
|
|
5
|
+
//#region src/useClipboard.ts
|
|
6
|
+
function useClipboard({ onPaste: onPasteFn = () => {} } = {}) {
|
|
7
|
+
const popOutWindow = inject(PopOutWindowKey, ref());
|
|
8
|
+
const { copy: coreCopy, copied, isSupported, text } = useClipboard$1({ legacy: true });
|
|
9
|
+
async function copy(value) {
|
|
10
|
+
const nav = popOutWindow?.value?.navigator;
|
|
11
|
+
if (nav?.clipboard) try {
|
|
12
|
+
const resolvedValue = typeof value === "function" ? await value() : value;
|
|
13
|
+
await nav.clipboard.writeText(resolvedValue);
|
|
14
|
+
return;
|
|
15
|
+
} catch {}
|
|
16
|
+
await coreCopy(value);
|
|
17
|
+
}
|
|
18
|
+
const ignoreClasses = ["el-messsage-box", "ignore-key-press-canvas"];
|
|
19
|
+
const initialized = ref(false);
|
|
20
|
+
const onPasteCallback = ref(onPasteFn || null);
|
|
21
|
+
/**
|
|
22
|
+
* Handles copy/paste events
|
|
23
|
+
* @param event
|
|
24
|
+
*/
|
|
25
|
+
function onPaste(event) {
|
|
26
|
+
if (!onPasteCallback.value) return;
|
|
27
|
+
const path = event.composedPath?.();
|
|
28
|
+
for (const pathElement of path) if (pathElement.className && ignoreClasses.some((className) => pathElement.className.includes?.(className))) return;
|
|
29
|
+
const clipboardData = event.clipboardData;
|
|
30
|
+
if (clipboardData !== null) {
|
|
31
|
+
const clipboardValue = clipboardData.getData("text/plain");
|
|
32
|
+
onPasteCallback.value(clipboardValue, event);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const throttledOnPaste = useThrottleFn(onPaste, 1e3);
|
|
36
|
+
/**
|
|
37
|
+
* Initialize copy/paste elements and events
|
|
38
|
+
*/
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
if (initialized.value) return;
|
|
41
|
+
document.addEventListener("paste", throttledOnPaste);
|
|
42
|
+
initialized.value = true;
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Remove copy/paste elements and events
|
|
46
|
+
*/
|
|
47
|
+
onBeforeUnmount(() => {
|
|
48
|
+
if (initialized.value) document.removeEventListener("paste", throttledOnPaste);
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
copy,
|
|
52
|
+
copied,
|
|
53
|
+
isSupported,
|
|
54
|
+
text,
|
|
55
|
+
onPaste: onPasteCallback
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { useClipboard };
|
|
61
|
+
//# sourceMappingURL=useClipboard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClipboard.mjs","names":["useClipboardCore"],"sources":["../src/useClipboard.ts"],"sourcesContent":["import { useClipboard as useClipboardCore, useThrottleFn } from '@vueuse/core';\nimport { inject, onBeforeUnmount, onMounted, ref } from 'vue';\n\nimport { PopOutWindowKey } from './injectionKeys';\n\ntype ClipboardEventFn = (data: string, event?: ClipboardEvent) => void;\n\nexport function useClipboard({\n\tonPaste: onPasteFn = () => {},\n}: {\n\tonPaste?: ClipboardEventFn;\n} = {}) {\n\tconst popOutWindow = inject(PopOutWindowKey, ref<Window | undefined>());\n\tconst {\n\t\tcopy: coreCopy,\n\t\tcopied,\n\t\tisSupported,\n\t\ttext,\n\t} = useClipboardCore({\n\t\tlegacy: true,\n\t});\n\n\t// Find the correct navigator at copy-time so it works even when the\n\t// pop-out window opens after the composable was created.\n\tasync function copy(value: string | (() => Promise<string>)) {\n\t\tconst nav = popOutWindow?.value?.navigator;\n\t\tif (nav?.clipboard) {\n\t\t\ttry {\n\t\t\t\tconst resolvedValue = typeof value === 'function' ? await value() : value;\n\t\t\t\tawait nav.clipboard.writeText(resolvedValue);\n\t\t\t\treturn;\n\t\t\t} catch {\n\t\t\t\t// Fall back to the core clipboard copy below.\n\t\t\t}\n\t\t}\n\t\tawait coreCopy(value);\n\t}\n\n\tconst ignoreClasses = ['el-messsage-box', 'ignore-key-press-canvas'];\n\tconst initialized = ref(false);\n\n\tconst onPasteCallback = ref<ClipboardEventFn | null>(onPasteFn || null);\n\n\t/**\n\t * Handles copy/paste events\n\t * @param event\n\t */\n\tfunction onPaste(event: ClipboardEvent) {\n\t\tif (!onPasteCallback.value) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if the event got emitted from a message box or from something\n\t\t// else which should ignore the copy/paste\n\t\tconst path = event.composedPath?.() as HTMLElement[];\n\t\tfor (const pathElement of path) {\n\t\t\tif (\n\t\t\t\tpathElement.className &&\n\t\t\t\tignoreClasses.some((className) => pathElement.className.includes?.(className))\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst clipboardData = event.clipboardData;\n\t\tif (clipboardData !== null) {\n\t\t\tconst clipboardValue = clipboardData.getData('text/plain');\n\t\t\tonPasteCallback.value(clipboardValue, event);\n\t\t}\n\t}\n\n\tconst throttledOnPaste = useThrottleFn(onPaste, 1000);\n\n\t/**\n\t * Initialize copy/paste elements and events\n\t */\n\tonMounted(() => {\n\t\tif (initialized.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tdocument.addEventListener('paste', throttledOnPaste);\n\n\t\tinitialized.value = true;\n\t});\n\n\t/**\n\t * Remove copy/paste elements and events\n\t */\n\tonBeforeUnmount(() => {\n\t\tif (initialized.value) {\n\t\t\tdocument.removeEventListener('paste', throttledOnPaste);\n\t\t}\n\t});\n\n\treturn {\n\t\tcopy,\n\t\tcopied,\n\t\tisSupported,\n\t\ttext,\n\t\tonPaste: onPasteCallback,\n\t};\n}\n"],"mappings":";;;;;AAOA,SAAgB,aAAa,EAC5B,SAAS,kBAAkB,OAGxB,EAAE,EAAE;CACP,MAAM,eAAe,OAAO,iBAAiB,KAAyB,CAAC;CACvE,MAAM,EACL,MAAM,UACN,QACA,aACA,SACGA,eAAiB,EACpB,QAAQ,MACR,CAAC;CAIF,eAAe,KAAK,OAAyC;EAC5D,MAAM,MAAM,cAAc,OAAO;AACjC,MAAI,KAAK,UACR,KAAI;GACH,MAAM,gBAAgB,OAAO,UAAU,aAAa,MAAM,OAAO,GAAG;AACpE,SAAM,IAAI,UAAU,UAAU,cAAc;AAC5C;UACO;AAIT,QAAM,SAAS,MAAM;;CAGtB,MAAM,gBAAgB,CAAC,mBAAmB,0BAA0B;CACpE,MAAM,cAAc,IAAI,MAAM;CAE9B,MAAM,kBAAkB,IAA6B,aAAa,KAAK;;;;;CAMvE,SAAS,QAAQ,OAAuB;AACvC,MAAI,CAAC,gBAAgB,MACpB;EAKD,MAAM,OAAO,MAAM,gBAAgB;AACnC,OAAK,MAAM,eAAe,KACzB,KACC,YAAY,aACZ,cAAc,MAAM,cAAc,YAAY,UAAU,WAAW,UAAU,CAAC,CAE9E;EAIF,MAAM,gBAAgB,MAAM;AAC5B,MAAI,kBAAkB,MAAM;GAC3B,MAAM,iBAAiB,cAAc,QAAQ,aAAa;AAC1D,mBAAgB,MAAM,gBAAgB,MAAM;;;CAI9C,MAAM,mBAAmB,cAAc,SAAS,IAAK;;;;AAKrD,iBAAgB;AACf,MAAI,YAAY,MACf;AAGD,WAAS,iBAAiB,SAAS,iBAAiB;AAEpD,cAAY,QAAQ;GACnB;;;;AAKF,uBAAsB;AACrB,MAAI,YAAY,MACf,UAAS,oBAAoB,SAAS,iBAAiB;GAEvD;AAEF,QAAO;EACN;EACA;EACA;EACA;EACA,SAAS;EACT"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
let vue = require("vue");
|
|
25
|
+
let lodash_debounce = require("lodash/debounce");
|
|
26
|
+
lodash_debounce = __toESM(lodash_debounce);
|
|
27
|
+
|
|
28
|
+
//#region src/useDebounce.ts
|
|
29
|
+
/**
|
|
30
|
+
* Get debounce time with optional multiplier from sessionStorage.
|
|
31
|
+
* Reads 'N8N_DEBOUNCE_MULTIPLIER' - defaults to 1 if not set.
|
|
32
|
+
*/
|
|
33
|
+
function getDebounceTime(time) {
|
|
34
|
+
const stored = sessionStorage.getItem("N8N_DEBOUNCE_MULTIPLIER");
|
|
35
|
+
const multiplier = stored !== null ? parseFloat(stored) : 1;
|
|
36
|
+
return Math.round(time * (Number.isNaN(multiplier) ? 1 : multiplier));
|
|
37
|
+
}
|
|
38
|
+
function useDebounce() {
|
|
39
|
+
const debounceCache = (0, vue.ref)(/* @__PURE__ */ new WeakMap());
|
|
40
|
+
const debounce = (fn, options) => {
|
|
41
|
+
const { trailing, debounceTime } = options;
|
|
42
|
+
const effectiveDebounceTime = getDebounceTime(debounceTime);
|
|
43
|
+
let debouncedFn = debounceCache.value.get(fn);
|
|
44
|
+
if (debouncedFn === void 0) {
|
|
45
|
+
debouncedFn = (0, lodash_debounce.default)(async (...args) => {
|
|
46
|
+
return fn(...args);
|
|
47
|
+
}, effectiveDebounceTime, trailing ? { trailing } : { leading: true });
|
|
48
|
+
debounceCache.value.set(fn, debouncedFn);
|
|
49
|
+
}
|
|
50
|
+
return debouncedFn;
|
|
51
|
+
};
|
|
52
|
+
const callDebounced = (fn, options, ...inputParameters) => {
|
|
53
|
+
return debounce(fn, options)(...inputParameters);
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
debounce,
|
|
57
|
+
callDebounced
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.__toESM = __toESM;
|
|
63
|
+
exports.getDebounceTime = getDebounceTime;
|
|
64
|
+
exports.useDebounce = useDebounce;
|
|
65
|
+
//# sourceMappingURL=useDebounce.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebounce.cjs","names":[],"sources":["../src/useDebounce.ts"],"sourcesContent":["import lodashDebounce from 'lodash/debounce';\nimport { ref } from 'vue';\n\n/**\n * Get debounce time with optional multiplier from sessionStorage.\n * Reads 'N8N_DEBOUNCE_MULTIPLIER' - defaults to 1 if not set.\n */\nexport function getDebounceTime(time: number): number {\n\tconst stored = sessionStorage.getItem('N8N_DEBOUNCE_MULTIPLIER');\n\tconst multiplier = stored !== null ? parseFloat(stored) : 1;\n\treturn Math.round(time * (Number.isNaN(multiplier) ? 1 : multiplier));\n}\n\nexport interface DebounceOptions {\n\tdebounceTime: number;\n\ttrailing?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any) => any;\ntype DebouncedFunc<T extends AnyFunction> = ReturnType<typeof lodashDebounce<T>>;\n\nexport function useDebounce() {\n\t// Create a ref for the WeakMap to store debounced functions.\n\tconst debounceCache = ref(new WeakMap<AnyFunction, DebouncedFunc<AnyFunction>>());\n\n\tconst debounce = <T extends AnyFunction>(fn: T, options: DebounceOptions): DebouncedFunc<T> => {\n\t\tconst { trailing, debounceTime } = options;\n\n\t\tconst effectiveDebounceTime = getDebounceTime(debounceTime);\n\n\t\t// Check if a debounced version of the function is already stored in the WeakMap.\n\t\tlet debouncedFn = debounceCache.value.get(fn);\n\n\t\t// If a debounced version is not found, create one and store it in the WeakMap.\n\t\tif (debouncedFn === undefined) {\n\t\t\tdebouncedFn = lodashDebounce(\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/require-await -- kept async so the debounced wrapper always returns a promise\n\t\t\t\tasync (...args: Parameters<T>) => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return -- AnyFunction return is intentionally `any`\n\t\t\t\t\treturn fn(...args);\n\t\t\t\t},\n\t\t\t\teffectiveDebounceTime,\n\t\t\t\ttrailing ? { trailing } : { leading: true },\n\t\t\t);\n\n\t\t\tdebounceCache.value.set(fn, debouncedFn);\n\t\t}\n\n\t\treturn debouncedFn;\n\t};\n\n\tconst callDebounced = <T extends AnyFunction>(\n\t\tfn: T,\n\t\toptions: DebounceOptions,\n\t\t...inputParameters: Parameters<T>\n\t): ReturnType<T> | undefined => {\n\t\tconst debouncedFn = debounce(fn, options);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return -- AnyFunction return is intentionally `any`\n\t\treturn debouncedFn(...inputParameters);\n\t};\n\n\treturn {\n\t\tdebounce,\n\t\tcallDebounced,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAAgB,gBAAgB,MAAsB;CACrD,MAAM,SAAS,eAAe,QAAQ,0BAA0B;CAChE,MAAM,aAAa,WAAW,OAAO,WAAW,OAAO,GAAG;AAC1D,QAAO,KAAK,MAAM,QAAQ,OAAO,MAAM,WAAW,GAAG,IAAI,YAAY;;AAYtE,SAAgB,cAAc;CAE7B,MAAM,6CAAoB,IAAI,SAAkD,CAAC;CAEjF,MAAM,YAAmC,IAAO,YAA+C;EAC9F,MAAM,EAAE,UAAU,iBAAiB;EAEnC,MAAM,wBAAwB,gBAAgB,aAAa;EAG3D,IAAI,cAAc,cAAc,MAAM,IAAI,GAAG;AAG7C,MAAI,gBAAgB,QAAW;AAC9B,8CAEC,OAAO,GAAG,SAAwB;AAEjC,WAAO,GAAG,GAAG,KAAK;MAEnB,uBACA,WAAW,EAAE,UAAU,GAAG,EAAE,SAAS,MAAM,CAC3C;AAED,iBAAc,MAAM,IAAI,IAAI,YAAY;;AAGzC,SAAO;;CAGR,MAAM,iBACL,IACA,SACA,GAAG,oBAC4B;AAI/B,SAHoB,SAAS,IAAI,QAAQ,CAGtB,GAAG,gBAAgB;;AAGvC,QAAO;EACN;EACA;EACA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import lodashDebounce from "lodash/debounce";
|
|
2
|
+
|
|
3
|
+
//#region src/useDebounce.d.ts
|
|
4
|
+
declare function getDebounceTime(time: number): number;
|
|
5
|
+
interface DebounceOptions {
|
|
6
|
+
debounceTime: number;
|
|
7
|
+
trailing?: boolean;
|
|
8
|
+
}
|
|
9
|
+
type AnyFunction = (...args: any) => any;
|
|
10
|
+
type DebouncedFunc<T extends AnyFunction> = ReturnType<typeof lodashDebounce<T>>;
|
|
11
|
+
declare function useDebounce(): {
|
|
12
|
+
debounce: <T extends AnyFunction>(fn: T, options: DebounceOptions) => DebouncedFunc<T>;
|
|
13
|
+
callDebounced: <T extends AnyFunction>(fn: T, options: DebounceOptions, ...inputParameters: Parameters<T>) => ReturnType<T> | undefined;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { DebounceOptions, getDebounceTime, useDebounce };
|
|
17
|
+
//# sourceMappingURL=useDebounce.d.cts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import lodashDebounce from "lodash/debounce";
|
|
2
|
+
|
|
3
|
+
//#region src/useDebounce.d.ts
|
|
4
|
+
declare function getDebounceTime(time: number): number;
|
|
5
|
+
interface DebounceOptions {
|
|
6
|
+
debounceTime: number;
|
|
7
|
+
trailing?: boolean;
|
|
8
|
+
}
|
|
9
|
+
type AnyFunction = (...args: any) => any;
|
|
10
|
+
type DebouncedFunc<T extends AnyFunction> = ReturnType<typeof lodashDebounce<T>>;
|
|
11
|
+
declare function useDebounce(): {
|
|
12
|
+
debounce: <T extends AnyFunction>(fn: T, options: DebounceOptions) => DebouncedFunc<T>;
|
|
13
|
+
callDebounced: <T extends AnyFunction>(fn: T, options: DebounceOptions, ...inputParameters: Parameters<T>) => ReturnType<T> | undefined;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { DebounceOptions, getDebounceTime, useDebounce };
|
|
17
|
+
//# sourceMappingURL=useDebounce.d.mts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import lodashDebounce from "lodash/debounce";
|
|
3
|
+
|
|
4
|
+
//#region src/useDebounce.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get debounce time with optional multiplier from sessionStorage.
|
|
7
|
+
* Reads 'N8N_DEBOUNCE_MULTIPLIER' - defaults to 1 if not set.
|
|
8
|
+
*/
|
|
9
|
+
function getDebounceTime(time) {
|
|
10
|
+
const stored = sessionStorage.getItem("N8N_DEBOUNCE_MULTIPLIER");
|
|
11
|
+
const multiplier = stored !== null ? parseFloat(stored) : 1;
|
|
12
|
+
return Math.round(time * (Number.isNaN(multiplier) ? 1 : multiplier));
|
|
13
|
+
}
|
|
14
|
+
function useDebounce() {
|
|
15
|
+
const debounceCache = ref(/* @__PURE__ */ new WeakMap());
|
|
16
|
+
const debounce = (fn, options) => {
|
|
17
|
+
const { trailing, debounceTime } = options;
|
|
18
|
+
const effectiveDebounceTime = getDebounceTime(debounceTime);
|
|
19
|
+
let debouncedFn = debounceCache.value.get(fn);
|
|
20
|
+
if (debouncedFn === void 0) {
|
|
21
|
+
debouncedFn = lodashDebounce(async (...args) => {
|
|
22
|
+
return fn(...args);
|
|
23
|
+
}, effectiveDebounceTime, trailing ? { trailing } : { leading: true });
|
|
24
|
+
debounceCache.value.set(fn, debouncedFn);
|
|
25
|
+
}
|
|
26
|
+
return debouncedFn;
|
|
27
|
+
};
|
|
28
|
+
const callDebounced = (fn, options, ...inputParameters) => {
|
|
29
|
+
return debounce(fn, options)(...inputParameters);
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
debounce,
|
|
33
|
+
callDebounced
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { getDebounceTime, useDebounce };
|
|
39
|
+
//# sourceMappingURL=useDebounce.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebounce.mjs","names":[],"sources":["../src/useDebounce.ts"],"sourcesContent":["import lodashDebounce from 'lodash/debounce';\nimport { ref } from 'vue';\n\n/**\n * Get debounce time with optional multiplier from sessionStorage.\n * Reads 'N8N_DEBOUNCE_MULTIPLIER' - defaults to 1 if not set.\n */\nexport function getDebounceTime(time: number): number {\n\tconst stored = sessionStorage.getItem('N8N_DEBOUNCE_MULTIPLIER');\n\tconst multiplier = stored !== null ? parseFloat(stored) : 1;\n\treturn Math.round(time * (Number.isNaN(multiplier) ? 1 : multiplier));\n}\n\nexport interface DebounceOptions {\n\tdebounceTime: number;\n\ttrailing?: boolean;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any) => any;\ntype DebouncedFunc<T extends AnyFunction> = ReturnType<typeof lodashDebounce<T>>;\n\nexport function useDebounce() {\n\t// Create a ref for the WeakMap to store debounced functions.\n\tconst debounceCache = ref(new WeakMap<AnyFunction, DebouncedFunc<AnyFunction>>());\n\n\tconst debounce = <T extends AnyFunction>(fn: T, options: DebounceOptions): DebouncedFunc<T> => {\n\t\tconst { trailing, debounceTime } = options;\n\n\t\tconst effectiveDebounceTime = getDebounceTime(debounceTime);\n\n\t\t// Check if a debounced version of the function is already stored in the WeakMap.\n\t\tlet debouncedFn = debounceCache.value.get(fn);\n\n\t\t// If a debounced version is not found, create one and store it in the WeakMap.\n\t\tif (debouncedFn === undefined) {\n\t\t\tdebouncedFn = lodashDebounce(\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/require-await -- kept async so the debounced wrapper always returns a promise\n\t\t\t\tasync (...args: Parameters<T>) => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return -- AnyFunction return is intentionally `any`\n\t\t\t\t\treturn fn(...args);\n\t\t\t\t},\n\t\t\t\teffectiveDebounceTime,\n\t\t\t\ttrailing ? { trailing } : { leading: true },\n\t\t\t);\n\n\t\t\tdebounceCache.value.set(fn, debouncedFn);\n\t\t}\n\n\t\treturn debouncedFn;\n\t};\n\n\tconst callDebounced = <T extends AnyFunction>(\n\t\tfn: T,\n\t\toptions: DebounceOptions,\n\t\t...inputParameters: Parameters<T>\n\t): ReturnType<T> | undefined => {\n\t\tconst debouncedFn = debounce(fn, options);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return -- AnyFunction return is intentionally `any`\n\t\treturn debouncedFn(...inputParameters);\n\t};\n\n\treturn {\n\t\tdebounce,\n\t\tcallDebounced,\n\t};\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,gBAAgB,MAAsB;CACrD,MAAM,SAAS,eAAe,QAAQ,0BAA0B;CAChE,MAAM,aAAa,WAAW,OAAO,WAAW,OAAO,GAAG;AAC1D,QAAO,KAAK,MAAM,QAAQ,OAAO,MAAM,WAAW,GAAG,IAAI,YAAY;;AAYtE,SAAgB,cAAc;CAE7B,MAAM,gBAAgB,oBAAI,IAAI,SAAkD,CAAC;CAEjF,MAAM,YAAmC,IAAO,YAA+C;EAC9F,MAAM,EAAE,UAAU,iBAAiB;EAEnC,MAAM,wBAAwB,gBAAgB,aAAa;EAG3D,IAAI,cAAc,cAAc,MAAM,IAAI,GAAG;AAG7C,MAAI,gBAAgB,QAAW;AAC9B,iBAAc,eAEb,OAAO,GAAG,SAAwB;AAEjC,WAAO,GAAG,GAAG,KAAK;MAEnB,uBACA,WAAW,EAAE,UAAU,GAAG,EAAE,SAAS,MAAM,CAC3C;AAED,iBAAc,MAAM,IAAI,IAAI,YAAY;;AAGzC,SAAO;;CAGR,MAAM,iBACL,IACA,SACA,GAAG,oBAC4B;AAI/B,SAHoB,SAAS,IAAI,QAAQ,CAGtB,GAAG,gBAAgB;;AAGvC,QAAO;EACN;EACA;EACA"}
|
|
@@ -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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue3 from "vue";
|
|
2
2
|
|
|
3
3
|
//#region src/useDeviceSupport.d.ts
|
|
4
4
|
declare function useDeviceSupport(): {
|
|
@@ -9,7 +9,7 @@ declare function useDeviceSupport(): {
|
|
|
9
9
|
isMacOs: boolean;
|
|
10
10
|
isMobileDevice: boolean;
|
|
11
11
|
controlKeyCode: string;
|
|
12
|
-
controlKeyText:
|
|
12
|
+
controlKeyText: vue3.ComputedRef<"⌘" | "Ctrl">;
|
|
13
13
|
isCtrlKeyPressed: (e: MouseEvent | KeyboardEvent) => boolean;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -1 +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":"
|
|
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,5 @@
|
|
|
1
|
+
const require_useExternalHooks = require('./useExternalHooks2.cjs');
|
|
2
|
+
|
|
3
|
+
exports.ExternalHooksKey = require_useExternalHooks.ExternalHooksKey;
|
|
4
|
+
exports.setExternalHooks = require_useExternalHooks.setExternalHooks;
|
|
5
|
+
exports.useExternalHooks = require_useExternalHooks.useExternalHooks;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InjectionKey } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useExternalHooks.d.ts
|
|
4
|
+
interface ExternalHooks {
|
|
5
|
+
run(eventName: string, metadata?: unknown): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
declare const ExternalHooksKey: InjectionKey<ExternalHooks>;
|
|
8
|
+
declare function setExternalHooks(instance: ExternalHooks | undefined): void;
|
|
9
|
+
declare function useExternalHooks(): ExternalHooks;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ExternalHooks, ExternalHooksKey, setExternalHooks, useExternalHooks };
|
|
12
|
+
//# sourceMappingURL=useExternalHooks.d.cts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InjectionKey } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useExternalHooks.d.ts
|
|
4
|
+
interface ExternalHooks {
|
|
5
|
+
run(eventName: string, metadata?: unknown): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
declare const ExternalHooksKey: InjectionKey<ExternalHooks>;
|
|
8
|
+
declare function setExternalHooks(instance: ExternalHooks | undefined): void;
|
|
9
|
+
declare function useExternalHooks(): ExternalHooks;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ExternalHooks, ExternalHooksKey, setExternalHooks, useExternalHooks };
|
|
12
|
+
//# sourceMappingURL=useExternalHooks.d.mts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const require_useDebounce = require('./useDebounce.cjs');
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
|
|
4
|
+
//#region src/useExternalHooks.ts
|
|
5
|
+
/**
|
|
6
|
+
* Injection key for the external-hooks runner. The application may provide it
|
|
7
|
+
* (e.g. a pop-out window with its own runner); `useExternalHooks` reads it when
|
|
8
|
+
* called inside an injection context and otherwise falls back to the registered
|
|
9
|
+
* singleton.
|
|
10
|
+
*/
|
|
11
|
+
const ExternalHooksKey = Symbol("ExternalHooks");
|
|
12
|
+
/**
|
|
13
|
+
* Null-object runner used when no concrete runner has been registered (e.g. in
|
|
14
|
+
* tests, or before bootstrap). External hooks are best-effort and must never
|
|
15
|
+
* throw or block the UI, so `run` resolves to a no-op.
|
|
16
|
+
*/
|
|
17
|
+
const noopExternalHooks = { async run() {} };
|
|
18
|
+
let registeredExternalHooks;
|
|
19
|
+
/**
|
|
20
|
+
* Register the application's external-hooks runner. Called once at bootstrap by
|
|
21
|
+
* `editor-ui` so package-side `useExternalHooks` can resolve it from any
|
|
22
|
+
* context, including outside of component setup (routers, stores, plain
|
|
23
|
+
* modules).
|
|
24
|
+
*/
|
|
25
|
+
function setExternalHooks(instance) {
|
|
26
|
+
registeredExternalHooks = instance;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns the active external-hooks runner. Resolution order: a
|
|
30
|
+
* component-provided runner (via {@link ExternalHooksKey}), then the
|
|
31
|
+
* app-registered singleton (via {@link setExternalHooks}), then a no-op fallback.
|
|
32
|
+
*/
|
|
33
|
+
function useExternalHooks() {
|
|
34
|
+
return ((0, vue.hasInjectionContext)() ? (0, vue.inject)(ExternalHooksKey, null) : null) ?? registeredExternalHooks ?? noopExternalHooks;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
Object.defineProperty(exports, 'ExternalHooksKey', {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return ExternalHooksKey;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, 'setExternalHooks', {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return setExternalHooks;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, 'useExternalHooks', {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return useExternalHooks;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=useExternalHooks2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExternalHooks2.cjs","names":["ExternalHooksKey: InjectionKey<ExternalHooks>","noopExternalHooks: ExternalHooks","registeredExternalHooks: ExternalHooks | undefined"],"sources":["../src/useExternalHooks.ts"],"sourcesContent":["import { hasInjectionContext, inject, type InjectionKey } from 'vue';\n\n/**\n * The external-hooks contract consumed across the frontend. External hooks are\n * an extension point: enterprise/embed builds register handlers on\n * `window.n8nExternalHooks`, and `run` dispatches a named event to them.\n *\n * This package owns the *type* only; the concrete runner lives in the\n * application (`editor-ui`) and is registered at bootstrap via\n * {@link setExternalHooks} / provided through {@link ExternalHooksKey}. Keeping\n * the contract here lets `useExternalHooks` return a working runner without the\n * package importing application code (notably the webhooks store).\n *\n * The contract is intentionally loose (`eventName: string`, `metadata:\n * unknown`): the strongly-typed event map stays in `editor-ui`, and the\n * application's public wrapper preserves per-event type-checking for call\n * sites that import it directly.\n */\nexport interface ExternalHooks {\n\trun(eventName: string, metadata?: unknown): Promise<void>;\n}\n\n/**\n * Injection key for the external-hooks runner. The application may provide it\n * (e.g. a pop-out window with its own runner); `useExternalHooks` reads it when\n * called inside an injection context and otherwise falls back to the registered\n * singleton.\n */\nexport const ExternalHooksKey: InjectionKey<ExternalHooks> = Symbol('ExternalHooks');\n\n/**\n * Null-object runner used when no concrete runner has been registered (e.g. in\n * tests, or before bootstrap). External hooks are best-effort and must never\n * throw or block the UI, so `run` resolves to a no-op.\n */\nconst noopExternalHooks: ExternalHooks = {\n\tasync run() {},\n};\n\nlet registeredExternalHooks: ExternalHooks | undefined;\n\n/**\n * Register the application's external-hooks runner. Called once at bootstrap by\n * `editor-ui` so package-side `useExternalHooks` can resolve it from any\n * context, including outside of component setup (routers, stores, plain\n * modules).\n */\nexport function setExternalHooks(instance: ExternalHooks | undefined): void {\n\tregisteredExternalHooks = instance;\n}\n\n/**\n * Returns the active external-hooks runner. Resolution order: a\n * component-provided runner (via {@link ExternalHooksKey}), then the\n * app-registered singleton (via {@link setExternalHooks}), then a no-op fallback.\n */\nexport function useExternalHooks(): ExternalHooks {\n\tconst injected = hasInjectionContext() ? inject(ExternalHooksKey, null) : null;\n\treturn injected ?? registeredExternalHooks ?? noopExternalHooks;\n}\n"],"mappings":";;;;;;;;;;AA4BA,MAAaA,mBAAgD,OAAO,gBAAgB;;;;;;AAOpF,MAAMC,oBAAmC,EACxC,MAAM,MAAM,IACZ;AAED,IAAIC;;;;;;;AAQJ,SAAgB,iBAAiB,UAA2C;AAC3E,2BAA0B;;;;;;;AAQ3B,SAAgB,mBAAkC;AAEjD,uCADsC,mBAAU,kBAAkB,KAAK,GAAG,SACvD,2BAA2B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { hasInjectionContext, inject } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/useExternalHooks.ts
|
|
4
|
+
/**
|
|
5
|
+
* Injection key for the external-hooks runner. The application may provide it
|
|
6
|
+
* (e.g. a pop-out window with its own runner); `useExternalHooks` reads it when
|
|
7
|
+
* called inside an injection context and otherwise falls back to the registered
|
|
8
|
+
* singleton.
|
|
9
|
+
*/
|
|
10
|
+
const ExternalHooksKey = Symbol("ExternalHooks");
|
|
11
|
+
/**
|
|
12
|
+
* Null-object runner used when no concrete runner has been registered (e.g. in
|
|
13
|
+
* tests, or before bootstrap). External hooks are best-effort and must never
|
|
14
|
+
* throw or block the UI, so `run` resolves to a no-op.
|
|
15
|
+
*/
|
|
16
|
+
const noopExternalHooks = { async run() {} };
|
|
17
|
+
let registeredExternalHooks;
|
|
18
|
+
/**
|
|
19
|
+
* Register the application's external-hooks runner. Called once at bootstrap by
|
|
20
|
+
* `editor-ui` so package-side `useExternalHooks` can resolve it from any
|
|
21
|
+
* context, including outside of component setup (routers, stores, plain
|
|
22
|
+
* modules).
|
|
23
|
+
*/
|
|
24
|
+
function setExternalHooks(instance) {
|
|
25
|
+
registeredExternalHooks = instance;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the active external-hooks runner. Resolution order: a
|
|
29
|
+
* component-provided runner (via {@link ExternalHooksKey}), then the
|
|
30
|
+
* app-registered singleton (via {@link setExternalHooks}), then a no-op fallback.
|
|
31
|
+
*/
|
|
32
|
+
function useExternalHooks() {
|
|
33
|
+
return (hasInjectionContext() ? inject(ExternalHooksKey, null) : null) ?? registeredExternalHooks ?? noopExternalHooks;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { setExternalHooks as n, useExternalHooks as r, ExternalHooksKey as t };
|
|
38
|
+
//# sourceMappingURL=useExternalHooks2.mjs.map
|