@n8n/composables 1.34.0 → 1.35.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.
@@ -0,0 +1,58 @@
1
+ const require_useDebounce = require('./useDebounce.cjs');
2
+ let vue = require("vue");
3
+
4
+ //#region src/useIntersectionObserver.ts
5
+ /**
6
+ * Composable for observing element intersections with automatic cleanup
7
+ *
8
+ * @example
9
+ * const { observe } = useIntersectionObserver({
10
+ * root: containerRef,
11
+ * onIntersect: () => loadMore(),
12
+ * });
13
+ *
14
+ * // Observe last item in list
15
+ * observe(lastItemElement);
16
+ */
17
+ function useIntersectionObserver(options) {
18
+ const observer = (0, vue.ref)(null);
19
+ /**
20
+ * Stop observing and clean up the observer
21
+ */
22
+ const disconnect = () => {
23
+ if (observer.value) {
24
+ observer.value.disconnect();
25
+ observer.value = null;
26
+ }
27
+ };
28
+ /**
29
+ * Start observing an element for intersection
30
+ * Automatically cleans up any existing observer before creating a new one
31
+ */
32
+ const observe = (element) => {
33
+ if (!element) return;
34
+ disconnect();
35
+ observer.value = new IntersectionObserver(([entry]) => {
36
+ if (entry.isIntersecting) {
37
+ if (options.once !== false) disconnect();
38
+ options.onIntersect();
39
+ }
40
+ }, {
41
+ root: options.root.value,
42
+ threshold: options.threshold ?? .01
43
+ });
44
+ observer.value.observe(element);
45
+ };
46
+ (0, vue.onBeforeUnmount)(() => {
47
+ disconnect();
48
+ });
49
+ return {
50
+ observer,
51
+ observe,
52
+ disconnect
53
+ };
54
+ }
55
+
56
+ //#endregion
57
+ exports.useIntersectionObserver = useIntersectionObserver;
58
+ //# sourceMappingURL=useIntersectionObserver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.cjs","names":[],"sources":["../src/useIntersectionObserver.ts"],"sourcesContent":["import { ref, onBeforeUnmount, type Ref } from 'vue';\n\nexport interface UseIntersectionObserverOptions {\n\t/**\n\t * The root element for intersection detection (scrollable container)\n\t */\n\troot: Ref<Element | null>;\n\n\t/**\n\t * Threshold for intersection (0.0 to 1.0)\n\t * @default 0.01\n\t */\n\tthreshold?: number;\n\n\t/**\n\t * Callback to execute when element intersects\n\t */\n\tonIntersect: () => void;\n\n\t/**\n\t * Whether to disconnect observer after first intersection\n\t * @default true\n\t */\n\tonce?: boolean;\n}\n\n/**\n * Composable for observing element intersections with automatic cleanup\n *\n * @example\n * const { observe } = useIntersectionObserver({\n * root: containerRef,\n * onIntersect: () => loadMore(),\n * });\n *\n * // Observe last item in list\n * observe(lastItemElement);\n */\nexport function useIntersectionObserver(options: UseIntersectionObserverOptions) {\n\tconst observer = ref<IntersectionObserver | null>(null);\n\n\t/**\n\t * Stop observing and clean up the observer\n\t */\n\tconst disconnect = () => {\n\t\tif (observer.value) {\n\t\t\tobserver.value.disconnect();\n\t\t\tobserver.value = null;\n\t\t}\n\t};\n\n\t/**\n\t * Start observing an element for intersection\n\t * Automatically cleans up any existing observer before creating a new one\n\t */\n\tconst observe = (element: Element | null | undefined) => {\n\t\tif (!element) return;\n\n\t\t// Clean up existing observer if any\n\t\tdisconnect();\n\n\t\tobserver.value = new IntersectionObserver(\n\t\t\t([entry]) => {\n\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t// Disconnect first. The callback can call observe() and create a new observer.\n\t\t\t\t\tif (options.once !== false) {\n\t\t\t\t\t\tdisconnect();\n\t\t\t\t\t}\n\n\t\t\t\t\toptions.onIntersect();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\troot: options.root.value,\n\t\t\t\tthreshold: options.threshold ?? 0.01,\n\t\t\t},\n\t\t);\n\n\t\tobserver.value.observe(element);\n\t};\n\n\t// Cleanup observer when component unmounts\n\tonBeforeUnmount(() => {\n\t\tdisconnect();\n\t});\n\n\treturn {\n\t\tobserver,\n\t\tobserve,\n\t\tdisconnect,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,SAAgB,wBAAwB,SAAyC;CAChF,MAAM,wBAA4C,KAAK;;;;CAKvD,MAAM,mBAAmB;AACxB,MAAI,SAAS,OAAO;AACnB,YAAS,MAAM,YAAY;AAC3B,YAAS,QAAQ;;;;;;;CAQnB,MAAM,WAAW,YAAwC;AACxD,MAAI,CAAC,QAAS;AAGd,cAAY;AAEZ,WAAS,QAAQ,IAAI,sBACnB,CAAC,WAAW;AACZ,OAAI,MAAM,gBAAgB;AAEzB,QAAI,QAAQ,SAAS,MACpB,aAAY;AAGb,YAAQ,aAAa;;KAGvB;GACC,MAAM,QAAQ,KAAK;GACnB,WAAW,QAAQ,aAAa;GAChC,CACD;AAED,WAAS,MAAM,QAAQ,QAAQ;;AAIhC,gCAAsB;AACrB,cAAY;GACX;AAEF,QAAO;EACN;EACA;EACA;EACA"}
@@ -0,0 +1,35 @@
1
+ import { Ref } from "vue";
2
+
3
+ //#region src/useIntersectionObserver.d.ts
4
+ interface UseIntersectionObserverOptions {
5
+ root: Ref<Element | null>;
6
+ threshold?: number;
7
+ onIntersect: () => void;
8
+ once?: boolean;
9
+ }
10
+ declare function useIntersectionObserver(options: UseIntersectionObserverOptions): {
11
+ observer: Ref<{
12
+ readonly root: Element | Document | null;
13
+ readonly rootMargin: string;
14
+ readonly scrollMargin: string;
15
+ readonly thresholds: ReadonlyArray<number>;
16
+ disconnect: () => void;
17
+ observe: (target: Element) => void;
18
+ takeRecords: () => IntersectionObserverEntry[];
19
+ unobserve: (target: Element) => void;
20
+ } | null, IntersectionObserver | {
21
+ readonly root: Element | Document | null;
22
+ readonly rootMargin: string;
23
+ readonly scrollMargin: string;
24
+ readonly thresholds: ReadonlyArray<number>;
25
+ disconnect: () => void;
26
+ observe: (target: Element) => void;
27
+ takeRecords: () => IntersectionObserverEntry[];
28
+ unobserve: (target: Element) => void;
29
+ } | null>;
30
+ observe: (element: Element | null | undefined) => void;
31
+ disconnect: () => void;
32
+ };
33
+ //#endregion
34
+ export { UseIntersectionObserverOptions, useIntersectionObserver };
35
+ //# sourceMappingURL=useIntersectionObserver.d.cts.map
@@ -0,0 +1,35 @@
1
+ import { Ref } from "vue";
2
+
3
+ //#region src/useIntersectionObserver.d.ts
4
+ interface UseIntersectionObserverOptions {
5
+ root: Ref<Element | null>;
6
+ threshold?: number;
7
+ onIntersect: () => void;
8
+ once?: boolean;
9
+ }
10
+ declare function useIntersectionObserver(options: UseIntersectionObserverOptions): {
11
+ observer: Ref<{
12
+ readonly root: Element | Document | null;
13
+ readonly rootMargin: string;
14
+ readonly scrollMargin: string;
15
+ readonly thresholds: ReadonlyArray<number>;
16
+ disconnect: () => void;
17
+ observe: (target: Element) => void;
18
+ takeRecords: () => IntersectionObserverEntry[];
19
+ unobserve: (target: Element) => void;
20
+ } | null, IntersectionObserver | {
21
+ readonly root: Element | Document | null;
22
+ readonly rootMargin: string;
23
+ readonly scrollMargin: string;
24
+ readonly thresholds: ReadonlyArray<number>;
25
+ disconnect: () => void;
26
+ observe: (target: Element) => void;
27
+ takeRecords: () => IntersectionObserverEntry[];
28
+ unobserve: (target: Element) => void;
29
+ } | null>;
30
+ observe: (element: Element | null | undefined) => void;
31
+ disconnect: () => void;
32
+ };
33
+ //#endregion
34
+ export { UseIntersectionObserverOptions, useIntersectionObserver };
35
+ //# sourceMappingURL=useIntersectionObserver.d.mts.map
@@ -0,0 +1,57 @@
1
+ import { onBeforeUnmount, ref } from "vue";
2
+
3
+ //#region src/useIntersectionObserver.ts
4
+ /**
5
+ * Composable for observing element intersections with automatic cleanup
6
+ *
7
+ * @example
8
+ * const { observe } = useIntersectionObserver({
9
+ * root: containerRef,
10
+ * onIntersect: () => loadMore(),
11
+ * });
12
+ *
13
+ * // Observe last item in list
14
+ * observe(lastItemElement);
15
+ */
16
+ function useIntersectionObserver(options) {
17
+ const observer = ref(null);
18
+ /**
19
+ * Stop observing and clean up the observer
20
+ */
21
+ const disconnect = () => {
22
+ if (observer.value) {
23
+ observer.value.disconnect();
24
+ observer.value = null;
25
+ }
26
+ };
27
+ /**
28
+ * Start observing an element for intersection
29
+ * Automatically cleans up any existing observer before creating a new one
30
+ */
31
+ const observe = (element) => {
32
+ if (!element) return;
33
+ disconnect();
34
+ observer.value = new IntersectionObserver(([entry]) => {
35
+ if (entry.isIntersecting) {
36
+ if (options.once !== false) disconnect();
37
+ options.onIntersect();
38
+ }
39
+ }, {
40
+ root: options.root.value,
41
+ threshold: options.threshold ?? .01
42
+ });
43
+ observer.value.observe(element);
44
+ };
45
+ onBeforeUnmount(() => {
46
+ disconnect();
47
+ });
48
+ return {
49
+ observer,
50
+ observe,
51
+ disconnect
52
+ };
53
+ }
54
+
55
+ //#endregion
56
+ export { useIntersectionObserver };
57
+ //# sourceMappingURL=useIntersectionObserver.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntersectionObserver.mjs","names":[],"sources":["../src/useIntersectionObserver.ts"],"sourcesContent":["import { ref, onBeforeUnmount, type Ref } from 'vue';\n\nexport interface UseIntersectionObserverOptions {\n\t/**\n\t * The root element for intersection detection (scrollable container)\n\t */\n\troot: Ref<Element | null>;\n\n\t/**\n\t * Threshold for intersection (0.0 to 1.0)\n\t * @default 0.01\n\t */\n\tthreshold?: number;\n\n\t/**\n\t * Callback to execute when element intersects\n\t */\n\tonIntersect: () => void;\n\n\t/**\n\t * Whether to disconnect observer after first intersection\n\t * @default true\n\t */\n\tonce?: boolean;\n}\n\n/**\n * Composable for observing element intersections with automatic cleanup\n *\n * @example\n * const { observe } = useIntersectionObserver({\n * root: containerRef,\n * onIntersect: () => loadMore(),\n * });\n *\n * // Observe last item in list\n * observe(lastItemElement);\n */\nexport function useIntersectionObserver(options: UseIntersectionObserverOptions) {\n\tconst observer = ref<IntersectionObserver | null>(null);\n\n\t/**\n\t * Stop observing and clean up the observer\n\t */\n\tconst disconnect = () => {\n\t\tif (observer.value) {\n\t\t\tobserver.value.disconnect();\n\t\t\tobserver.value = null;\n\t\t}\n\t};\n\n\t/**\n\t * Start observing an element for intersection\n\t * Automatically cleans up any existing observer before creating a new one\n\t */\n\tconst observe = (element: Element | null | undefined) => {\n\t\tif (!element) return;\n\n\t\t// Clean up existing observer if any\n\t\tdisconnect();\n\n\t\tobserver.value = new IntersectionObserver(\n\t\t\t([entry]) => {\n\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t// Disconnect first. The callback can call observe() and create a new observer.\n\t\t\t\t\tif (options.once !== false) {\n\t\t\t\t\t\tdisconnect();\n\t\t\t\t\t}\n\n\t\t\t\t\toptions.onIntersect();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\troot: options.root.value,\n\t\t\t\tthreshold: options.threshold ?? 0.01,\n\t\t\t},\n\t\t);\n\n\t\tobserver.value.observe(element);\n\t};\n\n\t// Cleanup observer when component unmounts\n\tonBeforeUnmount(() => {\n\t\tdisconnect();\n\t});\n\n\treturn {\n\t\tobserver,\n\t\tobserve,\n\t\tdisconnect,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsCA,SAAgB,wBAAwB,SAAyC;CAChF,MAAM,WAAW,IAAiC,KAAK;;;;CAKvD,MAAM,mBAAmB;AACxB,MAAI,SAAS,OAAO;AACnB,YAAS,MAAM,YAAY;AAC3B,YAAS,QAAQ;;;;;;;CAQnB,MAAM,WAAW,YAAwC;AACxD,MAAI,CAAC,QAAS;AAGd,cAAY;AAEZ,WAAS,QAAQ,IAAI,sBACnB,CAAC,WAAW;AACZ,OAAI,MAAM,gBAAgB;AAEzB,QAAI,QAAQ,SAAS,MACpB,aAAY;AAGb,YAAQ,aAAa;;KAGvB;GACC,MAAM,QAAQ,KAAK;GACnB,WAAW,QAAQ,aAAa;GAChC,CACD;AAED,WAAS,MAAM,QAAQ,QAAQ;;AAIhC,uBAAsB;AACrB,cAAY;GACX;AAEF,QAAO;EACN;EACA;EACA;EACA"}
@@ -0,0 +1,17 @@
1
+ const require_useDebounce = require('./useDebounce.cjs');
2
+ let __n8n_i18n = require("@n8n/i18n");
3
+
4
+ //#region src/useWorkflowVersionLabel.ts
5
+ const generateVersionLabelFromId = (versionId) => {
6
+ return `Version ${versionId.substring(0, 8)}`;
7
+ };
8
+ const getVersionLabel = ({ workflowHistory, currentVersionId }) => {
9
+ const i18n = (0, __n8n_i18n.useI18n)();
10
+ if (workflowHistory.name) return workflowHistory.name;
11
+ return workflowHistory.versionId === currentVersionId ? i18n.baseText("workflowHistory.item.currentChanges") : generateVersionLabelFromId(workflowHistory.versionId);
12
+ };
13
+
14
+ //#endregion
15
+ exports.generateVersionLabelFromId = generateVersionLabelFromId;
16
+ exports.getVersionLabel = getVersionLabel;
17
+ //# sourceMappingURL=useWorkflowVersionLabel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWorkflowVersionLabel.cjs","names":[],"sources":["../src/useWorkflowVersionLabel.ts"],"sourcesContent":["import { useI18n } from '@n8n/i18n';\n\nexport const generateVersionLabelFromId = (versionId: string) => {\n\treturn `Version ${versionId.substring(0, 8)}`;\n};\n\nexport const getVersionLabel = ({\n\tworkflowHistory,\n\tcurrentVersionId,\n}: {\n\tworkflowHistory: { versionId: string; name?: string | null };\n\tcurrentVersionId?: string;\n}) => {\n\tconst i18n = useI18n();\n\tif (workflowHistory.name) {\n\t\treturn workflowHistory.name;\n\t}\n\n\tconst isCurrentVersion = workflowHistory.versionId === currentVersionId;\n\treturn isCurrentVersion\n\t\t? i18n.baseText('workflowHistory.item.currentChanges')\n\t\t: generateVersionLabelFromId(workflowHistory.versionId);\n};\n"],"mappings":";;;;AAEA,MAAa,8BAA8B,cAAsB;AAChE,QAAO,WAAW,UAAU,UAAU,GAAG,EAAE;;AAG5C,MAAa,mBAAmB,EAC/B,iBACA,uBAIK;CACL,MAAM,gCAAgB;AACtB,KAAI,gBAAgB,KACnB,QAAO,gBAAgB;AAIxB,QADyB,gBAAgB,cAAc,mBAEpD,KAAK,SAAS,sCAAsC,GACpD,2BAA2B,gBAAgB,UAAU"}
@@ -0,0 +1,15 @@
1
+ //#region src/useWorkflowVersionLabel.d.ts
2
+ declare const generateVersionLabelFromId: (versionId: string) => string;
3
+ declare const getVersionLabel: ({
4
+ workflowHistory,
5
+ currentVersionId
6
+ }: {
7
+ workflowHistory: {
8
+ versionId: string;
9
+ name?: string | null;
10
+ };
11
+ currentVersionId?: string;
12
+ }) => string;
13
+ //#endregion
14
+ export { generateVersionLabelFromId, getVersionLabel };
15
+ //# sourceMappingURL=useWorkflowVersionLabel.d.cts.map
@@ -0,0 +1,15 @@
1
+ //#region src/useWorkflowVersionLabel.d.ts
2
+ declare const generateVersionLabelFromId: (versionId: string) => string;
3
+ declare const getVersionLabel: ({
4
+ workflowHistory,
5
+ currentVersionId
6
+ }: {
7
+ workflowHistory: {
8
+ versionId: string;
9
+ name?: string | null;
10
+ };
11
+ currentVersionId?: string;
12
+ }) => string;
13
+ //#endregion
14
+ export { generateVersionLabelFromId, getVersionLabel };
15
+ //# sourceMappingURL=useWorkflowVersionLabel.d.mts.map
@@ -0,0 +1,15 @@
1
+ import { useI18n } from "@n8n/i18n";
2
+
3
+ //#region src/useWorkflowVersionLabel.ts
4
+ const generateVersionLabelFromId = (versionId) => {
5
+ return `Version ${versionId.substring(0, 8)}`;
6
+ };
7
+ const getVersionLabel = ({ workflowHistory, currentVersionId }) => {
8
+ const i18n = useI18n();
9
+ if (workflowHistory.name) return workflowHistory.name;
10
+ return workflowHistory.versionId === currentVersionId ? i18n.baseText("workflowHistory.item.currentChanges") : generateVersionLabelFromId(workflowHistory.versionId);
11
+ };
12
+
13
+ //#endregion
14
+ export { generateVersionLabelFromId, getVersionLabel };
15
+ //# sourceMappingURL=useWorkflowVersionLabel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWorkflowVersionLabel.mjs","names":[],"sources":["../src/useWorkflowVersionLabel.ts"],"sourcesContent":["import { useI18n } from '@n8n/i18n';\n\nexport const generateVersionLabelFromId = (versionId: string) => {\n\treturn `Version ${versionId.substring(0, 8)}`;\n};\n\nexport const getVersionLabel = ({\n\tworkflowHistory,\n\tcurrentVersionId,\n}: {\n\tworkflowHistory: { versionId: string; name?: string | null };\n\tcurrentVersionId?: string;\n}) => {\n\tconst i18n = useI18n();\n\tif (workflowHistory.name) {\n\t\treturn workflowHistory.name;\n\t}\n\n\tconst isCurrentVersion = workflowHistory.versionId === currentVersionId;\n\treturn isCurrentVersion\n\t\t? i18n.baseText('workflowHistory.item.currentChanges')\n\t\t: generateVersionLabelFromId(workflowHistory.versionId);\n};\n"],"mappings":";;;AAEA,MAAa,8BAA8B,cAAsB;AAChE,QAAO,WAAW,UAAU,UAAU,GAAG,EAAE;;AAG5C,MAAa,mBAAmB,EAC/B,iBACA,uBAIK;CACL,MAAM,OAAO,SAAS;AACtB,KAAI,gBAAgB,KACnB,QAAO,gBAAgB;AAIxB,QADyB,gBAAgB,cAAc,mBAEpD,KAAK,SAAS,sCAAsC,GACpD,2BAA2B,gBAAgB,UAAU"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@n8n/composables",
3
3
  "type": "module",
4
- "version": "1.34.0",
4
+ "version": "1.35.0",
5
5
  "files": [
6
6
  "dist",
7
7
  "LICENSE.md",
@@ -15,20 +15,20 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@n8n/api-types": "1.44.0",
19
- "@n8n/frontend-constants": "0.10.0",
18
+ "@n8n/api-types": "1.45.0",
19
+ "@n8n/frontend-constants": "0.11.0",
20
20
  "@n8n/frontend-utils": "0.4.0",
21
- "@n8n/i18n": "2.44.0",
21
+ "@n8n/i18n": "2.45.0",
22
22
  "@vueuse/core": "^14.3.0",
23
23
  "lodash": "4.18.1",
24
- "n8n-workflow": "2.44.0",
24
+ "n8n-workflow": "2.45.0",
25
25
  "vue": "^3.5.13",
26
26
  "vue-router": "^4.5.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@n8n/eslint-config": "0.0.1",
30
30
  "@n8n/playwright-janitor": "0.1.0",
31
- "@n8n/telemetry": "1.12.0",
31
+ "@n8n/telemetry": "1.13.0",
32
32
  "@n8n/typescript-config": "1.12.0",
33
33
  "@n8n/vitest-config": "1.24.0",
34
34
  "@pinia/testing": "^0.1.6",