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