@n8n/composables 1.22.0 → 1.24.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/notification.d.cts +24 -0
- package/dist/notification.d.mts +24 -0
- package/dist/registries/telemetryRegistry.cjs +5 -0
- package/dist/registries/telemetryRegistry.d.cts +2 -0
- package/dist/registries/telemetryRegistry.d.mts +2 -0
- package/dist/registries/telemetryRegistry.mjs +3 -0
- package/dist/telemetryRegistry.cjs +42 -0
- package/dist/telemetryRegistry.cjs.map +1 -0
- package/dist/telemetryRegistry.d.cts +42 -0
- package/dist/telemetryRegistry.d.mts +42 -0
- package/dist/telemetryRegistry.mjs +24 -0
- package/dist/telemetryRegistry.mjs.map +1 -0
- package/dist/types/notification.cjs +0 -0
- package/dist/types/notification.d.cts +2 -0
- package/dist/types/notification.d.mts +2 -0
- package/dist/types/notification.mjs +1 -0
- package/dist/useClipboard.cjs +2 -1
- package/dist/useClipboard.cjs.map +1 -1
- package/dist/useClipboard.d.cts +1 -1
- package/dist/useClipboard.d.mts +1 -1
- package/dist/useClipboard.mjs +2 -1
- package/dist/useClipboard.mjs.map +1 -1
- package/dist/useDeviceSupport.d.cts +2 -2
- 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/useStorage.cjs +13 -0
- package/dist/useStorage.cjs.map +1 -0
- package/dist/useStorage.d.cts +7 -0
- package/dist/useStorage.d.mts +7 -0
- package/dist/useStorage.mjs +12 -0
- package/dist/useStorage.mjs.map +1 -0
- 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 +4 -0
- package/dist/useTelemetry.d.cts +7 -0
- package/dist/useTelemetry.d.mts +7 -0
- package/dist/useTelemetry.mjs +4 -0
- package/dist/useTelemetry2.cjs +50 -0
- package/dist/useTelemetry2.cjs.map +1 -0
- package/dist/useTelemetry2.mjs +44 -0
- package/dist/useTelemetry2.mjs.map +1 -0
- package/dist/useToast.cjs +170 -0
- package/dist/useToast.cjs.map +1 -0
- package/dist/useToast.d.cts +29 -0
- package/dist/useToast.d.mts +29 -0
- package/dist/useToast.mjs +168 -0
- package/dist/useToast.mjs.map +1 -0
- package/package.json +17 -7
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component, VNode } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/types/notification.d.ts
|
|
4
|
+
type NotificationType = '' | 'success' | 'warning' | 'error' | 'info';
|
|
5
|
+
type NotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
6
|
+
interface NotificationOptions {
|
|
7
|
+
message: string | VNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
type?: NotificationType;
|
|
10
|
+
icon?: string | Component;
|
|
11
|
+
customClass?: string;
|
|
12
|
+
duration?: number;
|
|
13
|
+
position?: NotificationPosition;
|
|
14
|
+
showClose?: boolean;
|
|
15
|
+
dangerouslyUseHTMLString?: boolean;
|
|
16
|
+
offset?: number;
|
|
17
|
+
appendTo?: HTMLElement | string;
|
|
18
|
+
zIndex?: number;
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { NotificationPosition as n, NotificationType as r, NotificationOptions as t };
|
|
24
|
+
//# sourceMappingURL=notification.d.cts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component, VNode } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/types/notification.d.ts
|
|
4
|
+
type NotificationType = '' | 'success' | 'warning' | 'error' | 'info';
|
|
5
|
+
type NotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
6
|
+
interface NotificationOptions {
|
|
7
|
+
message: string | VNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
type?: NotificationType;
|
|
10
|
+
icon?: string | Component;
|
|
11
|
+
customClass?: string;
|
|
12
|
+
duration?: number;
|
|
13
|
+
position?: NotificationPosition;
|
|
14
|
+
showClose?: boolean;
|
|
15
|
+
dangerouslyUseHTMLString?: boolean;
|
|
16
|
+
offset?: number;
|
|
17
|
+
appendTo?: HTMLElement | string;
|
|
18
|
+
zIndex?: number;
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { NotificationPosition as n, NotificationType as r, NotificationOptions as t };
|
|
24
|
+
//# sourceMappingURL=notification.d.mts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const require_telemetryRegistry = require('../telemetryRegistry.cjs');
|
|
2
|
+
|
|
3
|
+
exports.TelemetryKey = require_telemetryRegistry.TelemetryKey;
|
|
4
|
+
exports.getRegisteredTelemetry = require_telemetryRegistry.getRegisteredTelemetry;
|
|
5
|
+
exports.setTelemetry = require_telemetryRegistry.setTelemetry;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as getRegisteredTelemetry, i as TelemetryNodeParameterChange, n as TelemetryIdentifyOptions, o as setTelemetry, r as TelemetryKey, t as Telemetry } from "../telemetryRegistry.cjs";
|
|
2
|
+
export { Telemetry, TelemetryIdentifyOptions, TelemetryKey, TelemetryNodeParameterChange, getRegisteredTelemetry, setTelemetry };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as getRegisteredTelemetry, i as TelemetryNodeParameterChange, n as TelemetryIdentifyOptions, o as setTelemetry, r as TelemetryKey, t as Telemetry } from "../telemetryRegistry.mjs";
|
|
2
|
+
export { Telemetry, TelemetryIdentifyOptions, TelemetryKey, TelemetryNodeParameterChange, getRegisteredTelemetry, setTelemetry };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/registries/telemetryRegistry.ts
|
|
3
|
+
/**
|
|
4
|
+
* Injection key for the telemetry instance. The application provides it at
|
|
5
|
+
* bootstrap; components may override it (e.g. a pop-out window with its own
|
|
6
|
+
* instance). `useTelemetry` reads it when called inside an injection context.
|
|
7
|
+
*/
|
|
8
|
+
const TelemetryKey = Symbol("Telemetry");
|
|
9
|
+
let registeredTelemetry;
|
|
10
|
+
/**
|
|
11
|
+
* Register the application's telemetry instance. Called once at bootstrap by
|
|
12
|
+
* the editor-ui telemetry plugin so package-side `useTelemetry` can return it
|
|
13
|
+
* from any context, including outside of component setup.
|
|
14
|
+
*/
|
|
15
|
+
function setTelemetry(instance) {
|
|
16
|
+
registeredTelemetry = instance;
|
|
17
|
+
}
|
|
18
|
+
/** The instance registered via {@link setTelemetry}, if bootstrap has run. */
|
|
19
|
+
function getRegisteredTelemetry() {
|
|
20
|
+
return registeredTelemetry;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
Object.defineProperty(exports, 'TelemetryKey', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return TelemetryKey;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, 'getRegisteredTelemetry', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return getRegisteredTelemetry;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, 'setTelemetry', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return setTelemetry;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=telemetryRegistry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryRegistry.cjs","names":["TelemetryKey: InjectionKey<Telemetry>","registeredTelemetry: Telemetry | undefined"],"sources":["../src/registries/telemetryRegistry.ts"],"sourcesContent":["import type { ITelemetrySettings } from '@n8n/api-types';\nimport type { InferTelemetryProps, TelemetryEventDef } from '@n8n/telemetry';\nimport type { IDataObject, ITelemetryTrackProperties, NodeParameterValueType } from 'n8n-workflow';\nimport type { InjectionKey } from 'vue';\nimport type { RouteLocation } from 'vue-router';\n\nexport type TelemetryIdentifyOptions = {\n\tinstanceId: string;\n\tuserId?: string;\n\tprojectId?: string;\n\tversionCli?: string;\n\tuserRole?: string;\n};\n\n/**\n * Shape of a node-parameter change tracked by telemetry. Structurally mirrors\n * editor-ui's `IUpdateInformation`; declared here so the telemetry contract\n * carries no dependency back into the application package.\n */\nexport interface TelemetryNodeParameterChange {\n\tname: string;\n\tkey?: string;\n\tvalue: NodeParameterValueType;\n\tnode?: string;\n\toldValue?: string | number;\n\ttype?: 'optionsOrderChanged';\n}\n\n/**\n * The telemetry contract consumed across the frontend.\n *\n * This package owns the *type* only; the concrete implementation lives in the\n * application (`editor-ui`'s telemetry plugin) and is registered at bootstrap\n * via {@link setTelemetry} / provided through {@link TelemetryKey}. Keeping the\n * contract here lets `useTelemetry` return a fully-typed instance without the\n * package importing application code.\n */\nexport interface Telemetry {\n\tinit(\n\t\ttelemetrySettings: ITelemetrySettings,\n\t\toptions: TelemetryIdentifyOptions & { versionCli: string },\n\t): void;\n\tidentify(options: TelemetryIdentifyOptions): void;\n\ttrack<T extends TelemetryEventDef>(event: T, properties: InferTelemetryProps<T>): void;\n\ttrack(event: string, properties?: ITelemetryTrackProperties): void;\n\tpage(route: RouteLocation): void;\n\treset(): void;\n\tflushPageEvents(): void;\n\ttrackAskAI(event: string, ndvPushRef: string, properties?: IDataObject): void;\n\ttrackAiTransform(event: string, ndvPushRef: string, properties?: IDataObject): void;\n\ttrackNodeParametersValuesChange(nodeType: string, change: TelemetryNodeParameterChange): void;\n}\n\n/**\n * Injection key for the telemetry instance. The application provides it at\n * bootstrap; components may override it (e.g. a pop-out window with its own\n * instance). `useTelemetry` reads it when called inside an injection context.\n */\nexport const TelemetryKey: InjectionKey<Telemetry> = Symbol('Telemetry');\n\nlet registeredTelemetry: Telemetry | undefined;\n\n/**\n * Register the application's telemetry instance. Called once at bootstrap by\n * the editor-ui telemetry plugin so package-side `useTelemetry` can return it\n * from any context, including outside of component setup.\n */\nexport function setTelemetry(instance: Telemetry | undefined): void {\n\tregisteredTelemetry = instance;\n}\n\n/** The instance registered via {@link setTelemetry}, if bootstrap has run. */\nexport function getRegisteredTelemetry(): Telemetry | undefined {\n\treturn registeredTelemetry;\n}\n"],"mappings":";;;;;;;AA0DA,MAAaA,eAAwC,OAAO,YAAY;AAExE,IAAIC;;;;;;AAOJ,SAAgB,aAAa,UAAuC;AACnE,uBAAsB;;;AAIvB,SAAgB,yBAAgD;AAC/D,QAAO"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InjectionKey } from "vue";
|
|
2
|
+
import { ITelemetrySettings } from "@n8n/api-types";
|
|
3
|
+
import { InferTelemetryProps, TelemetryEventDef } from "@n8n/telemetry";
|
|
4
|
+
import { IDataObject, ITelemetryTrackProperties, NodeParameterValueType } from "n8n-workflow";
|
|
5
|
+
import { RouteLocation } from "vue-router";
|
|
6
|
+
|
|
7
|
+
//#region src/registries/telemetryRegistry.d.ts
|
|
8
|
+
type TelemetryIdentifyOptions = {
|
|
9
|
+
instanceId: string;
|
|
10
|
+
userId?: string;
|
|
11
|
+
projectId?: string;
|
|
12
|
+
versionCli?: string;
|
|
13
|
+
userRole?: string;
|
|
14
|
+
};
|
|
15
|
+
interface TelemetryNodeParameterChange {
|
|
16
|
+
name: string;
|
|
17
|
+
key?: string;
|
|
18
|
+
value: NodeParameterValueType;
|
|
19
|
+
node?: string;
|
|
20
|
+
oldValue?: string | number;
|
|
21
|
+
type?: 'optionsOrderChanged';
|
|
22
|
+
}
|
|
23
|
+
interface Telemetry {
|
|
24
|
+
init(telemetrySettings: ITelemetrySettings, options: TelemetryIdentifyOptions & {
|
|
25
|
+
versionCli: string;
|
|
26
|
+
}): void;
|
|
27
|
+
identify(options: TelemetryIdentifyOptions): void;
|
|
28
|
+
track<T extends TelemetryEventDef>(event: T, properties: InferTelemetryProps<T>): void;
|
|
29
|
+
track(event: string, properties?: ITelemetryTrackProperties): void;
|
|
30
|
+
page(route: RouteLocation): void;
|
|
31
|
+
reset(): void;
|
|
32
|
+
flushPageEvents(): void;
|
|
33
|
+
trackAskAI(event: string, ndvPushRef: string, properties?: IDataObject): void;
|
|
34
|
+
trackAiTransform(event: string, ndvPushRef: string, properties?: IDataObject): void;
|
|
35
|
+
trackNodeParametersValuesChange(nodeType: string, change: TelemetryNodeParameterChange): void;
|
|
36
|
+
}
|
|
37
|
+
declare const TelemetryKey: InjectionKey<Telemetry>;
|
|
38
|
+
declare function setTelemetry(instance: Telemetry | undefined): void;
|
|
39
|
+
declare function getRegisteredTelemetry(): Telemetry | undefined;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { getRegisteredTelemetry as a, TelemetryNodeParameterChange as i, TelemetryIdentifyOptions as n, setTelemetry as o, TelemetryKey as r, Telemetry as t };
|
|
42
|
+
//# sourceMappingURL=telemetryRegistry.d.cts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InjectionKey } from "vue";
|
|
2
|
+
import { RouteLocation } from "vue-router";
|
|
3
|
+
import { ITelemetrySettings } from "@n8n/api-types";
|
|
4
|
+
import { InferTelemetryProps, TelemetryEventDef } from "@n8n/telemetry";
|
|
5
|
+
import { IDataObject, ITelemetryTrackProperties, NodeParameterValueType } from "n8n-workflow";
|
|
6
|
+
|
|
7
|
+
//#region src/registries/telemetryRegistry.d.ts
|
|
8
|
+
type TelemetryIdentifyOptions = {
|
|
9
|
+
instanceId: string;
|
|
10
|
+
userId?: string;
|
|
11
|
+
projectId?: string;
|
|
12
|
+
versionCli?: string;
|
|
13
|
+
userRole?: string;
|
|
14
|
+
};
|
|
15
|
+
interface TelemetryNodeParameterChange {
|
|
16
|
+
name: string;
|
|
17
|
+
key?: string;
|
|
18
|
+
value: NodeParameterValueType;
|
|
19
|
+
node?: string;
|
|
20
|
+
oldValue?: string | number;
|
|
21
|
+
type?: 'optionsOrderChanged';
|
|
22
|
+
}
|
|
23
|
+
interface Telemetry {
|
|
24
|
+
init(telemetrySettings: ITelemetrySettings, options: TelemetryIdentifyOptions & {
|
|
25
|
+
versionCli: string;
|
|
26
|
+
}): void;
|
|
27
|
+
identify(options: TelemetryIdentifyOptions): void;
|
|
28
|
+
track<T extends TelemetryEventDef>(event: T, properties: InferTelemetryProps<T>): void;
|
|
29
|
+
track(event: string, properties?: ITelemetryTrackProperties): void;
|
|
30
|
+
page(route: RouteLocation): void;
|
|
31
|
+
reset(): void;
|
|
32
|
+
flushPageEvents(): void;
|
|
33
|
+
trackAskAI(event: string, ndvPushRef: string, properties?: IDataObject): void;
|
|
34
|
+
trackAiTransform(event: string, ndvPushRef: string, properties?: IDataObject): void;
|
|
35
|
+
trackNodeParametersValuesChange(nodeType: string, change: TelemetryNodeParameterChange): void;
|
|
36
|
+
}
|
|
37
|
+
declare const TelemetryKey: InjectionKey<Telemetry>;
|
|
38
|
+
declare function setTelemetry(instance: Telemetry | undefined): void;
|
|
39
|
+
declare function getRegisteredTelemetry(): Telemetry | undefined;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { getRegisteredTelemetry as a, TelemetryNodeParameterChange as i, TelemetryIdentifyOptions as n, setTelemetry as o, TelemetryKey as r, Telemetry as t };
|
|
42
|
+
//# sourceMappingURL=telemetryRegistry.d.mts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/registries/telemetryRegistry.ts
|
|
2
|
+
/**
|
|
3
|
+
* Injection key for the telemetry instance. The application provides it at
|
|
4
|
+
* bootstrap; components may override it (e.g. a pop-out window with its own
|
|
5
|
+
* instance). `useTelemetry` reads it when called inside an injection context.
|
|
6
|
+
*/
|
|
7
|
+
const TelemetryKey = Symbol("Telemetry");
|
|
8
|
+
let registeredTelemetry;
|
|
9
|
+
/**
|
|
10
|
+
* Register the application's telemetry instance. Called once at bootstrap by
|
|
11
|
+
* the editor-ui telemetry plugin so package-side `useTelemetry` can return it
|
|
12
|
+
* from any context, including outside of component setup.
|
|
13
|
+
*/
|
|
14
|
+
function setTelemetry(instance) {
|
|
15
|
+
registeredTelemetry = instance;
|
|
16
|
+
}
|
|
17
|
+
/** The instance registered via {@link setTelemetry}, if bootstrap has run. */
|
|
18
|
+
function getRegisteredTelemetry() {
|
|
19
|
+
return registeredTelemetry;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getRegisteredTelemetry as n, setTelemetry as r, TelemetryKey as t };
|
|
24
|
+
//# sourceMappingURL=telemetryRegistry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryRegistry.mjs","names":["TelemetryKey: InjectionKey<Telemetry>","registeredTelemetry: Telemetry | undefined"],"sources":["../src/registries/telemetryRegistry.ts"],"sourcesContent":["import type { ITelemetrySettings } from '@n8n/api-types';\nimport type { InferTelemetryProps, TelemetryEventDef } from '@n8n/telemetry';\nimport type { IDataObject, ITelemetryTrackProperties, NodeParameterValueType } from 'n8n-workflow';\nimport type { InjectionKey } from 'vue';\nimport type { RouteLocation } from 'vue-router';\n\nexport type TelemetryIdentifyOptions = {\n\tinstanceId: string;\n\tuserId?: string;\n\tprojectId?: string;\n\tversionCli?: string;\n\tuserRole?: string;\n};\n\n/**\n * Shape of a node-parameter change tracked by telemetry. Structurally mirrors\n * editor-ui's `IUpdateInformation`; declared here so the telemetry contract\n * carries no dependency back into the application package.\n */\nexport interface TelemetryNodeParameterChange {\n\tname: string;\n\tkey?: string;\n\tvalue: NodeParameterValueType;\n\tnode?: string;\n\toldValue?: string | number;\n\ttype?: 'optionsOrderChanged';\n}\n\n/**\n * The telemetry contract consumed across the frontend.\n *\n * This package owns the *type* only; the concrete implementation lives in the\n * application (`editor-ui`'s telemetry plugin) and is registered at bootstrap\n * via {@link setTelemetry} / provided through {@link TelemetryKey}. Keeping the\n * contract here lets `useTelemetry` return a fully-typed instance without the\n * package importing application code.\n */\nexport interface Telemetry {\n\tinit(\n\t\ttelemetrySettings: ITelemetrySettings,\n\t\toptions: TelemetryIdentifyOptions & { versionCli: string },\n\t): void;\n\tidentify(options: TelemetryIdentifyOptions): void;\n\ttrack<T extends TelemetryEventDef>(event: T, properties: InferTelemetryProps<T>): void;\n\ttrack(event: string, properties?: ITelemetryTrackProperties): void;\n\tpage(route: RouteLocation): void;\n\treset(): void;\n\tflushPageEvents(): void;\n\ttrackAskAI(event: string, ndvPushRef: string, properties?: IDataObject): void;\n\ttrackAiTransform(event: string, ndvPushRef: string, properties?: IDataObject): void;\n\ttrackNodeParametersValuesChange(nodeType: string, change: TelemetryNodeParameterChange): void;\n}\n\n/**\n * Injection key for the telemetry instance. The application provides it at\n * bootstrap; components may override it (e.g. a pop-out window with its own\n * instance). `useTelemetry` reads it when called inside an injection context.\n */\nexport const TelemetryKey: InjectionKey<Telemetry> = Symbol('Telemetry');\n\nlet registeredTelemetry: Telemetry | undefined;\n\n/**\n * Register the application's telemetry instance. Called once at bootstrap by\n * the editor-ui telemetry plugin so package-side `useTelemetry` can return it\n * from any context, including outside of component setup.\n */\nexport function setTelemetry(instance: Telemetry | undefined): void {\n\tregisteredTelemetry = instance;\n}\n\n/** The instance registered via {@link setTelemetry}, if bootstrap has run. */\nexport function getRegisteredTelemetry(): Telemetry | undefined {\n\treturn registeredTelemetry;\n}\n"],"mappings":";;;;;;AA0DA,MAAaA,eAAwC,OAAO,YAAY;AAExE,IAAIC;;;;;;AAOJ,SAAgB,aAAa,UAAuC;AACnE,uBAAsB;;;AAIvB,SAAgB,yBAAgD;AAC/D,QAAO"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/useClipboard.cjs
CHANGED
|
@@ -10,7 +10,8 @@ function useClipboard({ onPaste: onPasteFn = () => {} } = {}) {
|
|
|
10
10
|
async function copy(value) {
|
|
11
11
|
const nav = popOutWindow?.value?.navigator;
|
|
12
12
|
if (nav?.clipboard) try {
|
|
13
|
-
await
|
|
13
|
+
const resolvedValue = typeof value === "function" ? await value() : value;
|
|
14
|
+
await nav.clipboard.writeText(resolvedValue);
|
|
14
15
|
return;
|
|
15
16
|
} catch {}
|
|
16
17
|
await coreCopy(value);
|
|
@@ -1 +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) {\n\t\tconst nav = popOutWindow?.value?.navigator;\n\t\tif (nav?.clipboard) {\n\t\t\ttry {\n\t\t\t\tawait nav.clipboard.writeText(
|
|
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"}
|
package/dist/useClipboard.d.cts
CHANGED
|
@@ -7,7 +7,7 @@ declare function useClipboard({
|
|
|
7
7
|
}?: {
|
|
8
8
|
onPaste?: ClipboardEventFn;
|
|
9
9
|
}): {
|
|
10
|
-
copy: (value: string) => Promise<void>;
|
|
10
|
+
copy: (value: string | (() => Promise<string>)) => Promise<void>;
|
|
11
11
|
copied: Readonly<vue0.ShallowRef<boolean>>;
|
|
12
12
|
isSupported: vue0.ComputedRef<boolean>;
|
|
13
13
|
text: Readonly<vue0.ShallowRef<string>>;
|
package/dist/useClipboard.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ declare function useClipboard({
|
|
|
7
7
|
}?: {
|
|
8
8
|
onPaste?: ClipboardEventFn;
|
|
9
9
|
}): {
|
|
10
|
-
copy: (value: string) => Promise<void>;
|
|
10
|
+
copy: (value: string | (() => Promise<string>)) => Promise<void>;
|
|
11
11
|
copied: Readonly<vue0.ShallowRef<boolean>>;
|
|
12
12
|
isSupported: vue0.ComputedRef<boolean>;
|
|
13
13
|
text: Readonly<vue0.ShallowRef<string>>;
|
package/dist/useClipboard.mjs
CHANGED
|
@@ -9,7 +9,8 @@ function useClipboard({ onPaste: onPasteFn = () => {} } = {}) {
|
|
|
9
9
|
async function copy(value) {
|
|
10
10
|
const nav = popOutWindow?.value?.navigator;
|
|
11
11
|
if (nav?.clipboard) try {
|
|
12
|
-
await
|
|
12
|
+
const resolvedValue = typeof value === "function" ? await value() : value;
|
|
13
|
+
await nav.clipboard.writeText(resolvedValue);
|
|
13
14
|
return;
|
|
14
15
|
} catch {}
|
|
15
16
|
await coreCopy(value);
|
|
@@ -1 +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) {\n\t\tconst nav = popOutWindow?.value?.navigator;\n\t\tif (nav?.clipboard) {\n\t\t\ttry {\n\t\t\t\tawait nav.clipboard.writeText(
|
|
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue0 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: vue0.ComputedRef<"⌘" | "Ctrl">;
|
|
13
13
|
isCtrlKeyPressed: (e: MouseEvent | KeyboardEvent) => boolean;
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExternalHooks2.mjs","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,SADiB,qBAAqB,GAAG,OAAO,kBAAkB,KAAK,GAAG,SACvD,2BAA2B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_useDebounce = require('./useDebounce.cjs');
|
|
2
|
+
let __vueuse_core = require("@vueuse/core");
|
|
3
|
+
|
|
4
|
+
//#region src/useStorage.ts
|
|
5
|
+
function useStorage(key) {
|
|
6
|
+
const data = (0, __vueuse_core.useStorage)(key, null, void 0, { writeDefaults: false });
|
|
7
|
+
if (data.value === "undefined") data.value = null;
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.useStorage = useStorage;
|
|
13
|
+
//# sourceMappingURL=useStorage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorage.cjs","names":[],"sources":["../src/useStorage.ts"],"sourcesContent":["import { useStorage as useStorageComposable } from '@vueuse/core';\nimport type { Ref } from 'vue';\n\nexport function useStorage(key: string): Ref<string | null> {\n\tconst data = useStorageComposable(key, null, undefined, { writeDefaults: false });\n\n\t// bug in 1.15.1\n\tif (data.value === 'undefined') {\n\t\tdata.value = null;\n\t}\n\n\treturn data;\n}\n"],"mappings":";;;;AAGA,SAAgB,WAAW,KAAiC;CAC3D,MAAM,qCAA4B,KAAK,MAAM,QAAW,EAAE,eAAe,OAAO,CAAC;AAGjF,KAAI,KAAK,UAAU,YAClB,MAAK,QAAQ;AAGd,QAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useStorage as useStorage$1 } from "@vueuse/core";
|
|
2
|
+
|
|
3
|
+
//#region src/useStorage.ts
|
|
4
|
+
function useStorage(key) {
|
|
5
|
+
const data = useStorage$1(key, null, void 0, { writeDefaults: false });
|
|
6
|
+
if (data.value === "undefined") data.value = null;
|
|
7
|
+
return data;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useStorage };
|
|
12
|
+
//# sourceMappingURL=useStorage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorage.mjs","names":["useStorageComposable"],"sources":["../src/useStorage.ts"],"sourcesContent":["import { useStorage as useStorageComposable } from '@vueuse/core';\nimport type { Ref } from 'vue';\n\nexport function useStorage(key: string): Ref<string | null> {\n\tconst data = useStorageComposable(key, null, undefined, { writeDefaults: false });\n\n\t// bug in 1.15.1\n\tif (data.value === 'undefined') {\n\t\tdata.value = null;\n\t}\n\n\treturn data;\n}\n"],"mappings":";;;AAGA,SAAgB,WAAW,KAAiC;CAC3D,MAAM,OAAOA,aAAqB,KAAK,MAAM,QAAW,EAAE,eAAe,OAAO,CAAC;AAGjF,KAAI,KAAK,UAAU,YAClB,MAAK,QAAQ;AAGd,QAAO"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_useDebounce = require('./useDebounce.cjs');
|
|
2
|
+
let __n8n_frontend_constants_z_indexes = require("@n8n/frontend-constants/z-indexes");
|
|
3
|
+
|
|
4
|
+
//#region src/useStyles.ts
|
|
5
|
+
const setAppZIndexes = () => {
|
|
6
|
+
Object.keys(__n8n_frontend_constants_z_indexes.APP_Z_INDEXES).forEach((key) => {
|
|
7
|
+
const variableName = `--${key.toLowerCase().replaceAll("_", "-")}--z`;
|
|
8
|
+
const value = __n8n_frontend_constants_z_indexes.APP_Z_INDEXES[key];
|
|
9
|
+
document.documentElement.style.setProperty(variableName, `${value}`);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const useStyles = () => ({
|
|
13
|
+
APP_Z_INDEXES: __n8n_frontend_constants_z_indexes.APP_Z_INDEXES,
|
|
14
|
+
setAppZIndexes
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.useStyles = useStyles;
|
|
19
|
+
//# sourceMappingURL=useStyles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStyles.cjs","names":["APP_Z_INDEXES"],"sources":["../src/useStyles.ts"],"sourcesContent":["import { APP_Z_INDEXES } from '@n8n/frontend-constants/z-indexes';\n\nconst setAppZIndexes = () => {\n\tObject.keys(APP_Z_INDEXES).forEach((key) => {\n\t\tconst variableName = `--${key.toLowerCase().replaceAll('_', '-')}--z`;\n\t\tconst value = APP_Z_INDEXES[key as keyof typeof APP_Z_INDEXES];\n\t\tdocument.documentElement.style.setProperty(variableName, `${value}`);\n\t});\n};\n\nexport const useStyles = () => ({\n\tAPP_Z_INDEXES,\n\tsetAppZIndexes,\n});\n"],"mappings":";;;;AAEA,MAAM,uBAAuB;AAC5B,QAAO,KAAKA,iDAAc,CAAC,SAAS,QAAQ;EAC3C,MAAM,eAAe,KAAK,IAAI,aAAa,CAAC,WAAW,KAAK,IAAI,CAAC;EACjE,MAAM,QAAQA,iDAAc;AAC5B,WAAS,gBAAgB,MAAM,YAAY,cAAc,GAAG,QAAQ;GACnE;;AAGH,MAAa,mBAAmB;CAC/B;CACA;CACA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/useStyles.d.ts
|
|
2
|
+
declare const useStyles: () => {
|
|
3
|
+
APP_Z_INDEXES: {
|
|
4
|
+
readonly CONTEXT_MENU: 10;
|
|
5
|
+
readonly APP_HEADER: 99;
|
|
6
|
+
readonly SELECT_BOX: 100;
|
|
7
|
+
readonly CANVAS_ADD_BUTTON: 101;
|
|
8
|
+
readonly APP_SIDEBAR: 999;
|
|
9
|
+
readonly CANVAS_SELECT_BOX: 100;
|
|
10
|
+
readonly TOP_BANNERS: 999;
|
|
11
|
+
readonly NODE_CREATOR: 1700;
|
|
12
|
+
readonly ASK_ASSISTANT_CHAT: 1750;
|
|
13
|
+
readonly NDV: 1800;
|
|
14
|
+
readonly COMMAND_BAR: 1900;
|
|
15
|
+
readonly DIALOGS: 1950;
|
|
16
|
+
readonly MODALS: 2000;
|
|
17
|
+
readonly TOASTS: 2100;
|
|
18
|
+
readonly ASK_ASSISTANT_FLOATING_BUTTON: 3000;
|
|
19
|
+
readonly ASK_ASSISTANT_FLOATING_BUTTON_TOOLTIP: 3000;
|
|
20
|
+
readonly CODEMIRROR_TOOLTIP: 3000;
|
|
21
|
+
readonly FLOATING_UI: 3000;
|
|
22
|
+
readonly DRAGGABLE: 9999999;
|
|
23
|
+
readonly ACTIVE_STICKY: 9999999;
|
|
24
|
+
readonly WORKFLOW_PREVIEW_NDV: 9999999;
|
|
25
|
+
readonly NPS_SURVEY_MODAL: 3001;
|
|
26
|
+
};
|
|
27
|
+
setAppZIndexes: () => void;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useStyles };
|
|
31
|
+
//# sourceMappingURL=useStyles.d.cts.map
|