From 1057c9bc2d3aca062bc947045e5f78e6a4ce4315 Mon Sep 17 00:00:00 2001 From: Nicola Spadari Date: Thu, 20 Feb 2025 16:17:25 +0100 Subject: [PATCH 01/15] Implement webview example --- app/modules/tauri.ts | 2 ++ app/pages/webview.vue | 48 +++++++++++++++++++++++++ eslint.config.mjs | 1 + src-tauri/Cargo.toml | 5 ++- src-tauri/capabilities/main.json | 9 +++-- src-tauri/gen/schemas/capabilities.json | 2 +- 6 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 app/pages/webview.vue diff --git a/app/modules/tauri.ts b/app/modules/tauri.ts index 9a04ca1..53208c4 100644 --- a/app/modules/tauri.ts +++ b/app/modules/tauri.ts @@ -1,4 +1,5 @@ import * as tauriApp from "@tauri-apps/api/app"; +import * as tauriWebviewWindow from "@tauri-apps/api/webviewWindow"; import * as tauriFs from "@tauri-apps/plugin-fs"; import * as tauriNotification from "@tauri-apps/plugin-notification"; import * as tauriOs from "@tauri-apps/plugin-os"; @@ -12,6 +13,7 @@ const capitalize = (name: string) => { const tauriModules = [ { module: tauriApp, prefix: "App", importPath: "@tauri-apps/api/app" }, + { module: tauriWebviewWindow, prefix: "WebviewWindow", importPath: "@tauri-apps/api/webviewWindow" }, { module: tauriShell, prefix: "Shell", importPath: "@tauri-apps/plugin-shell" }, { module: tauriOs, prefix: "Os", importPath: "@tauri-apps/plugin-os" }, { module: tauriNotification, prefix: "Notification", importPath: "@tauri-apps/plugin-notification" }, diff --git a/app/pages/webview.vue b/app/pages/webview.vue new file mode 100644 index 0000000..c6fcdcf --- /dev/null +++ b/app/pages/webview.vue @@ -0,0 +1,48 @@ + + + diff --git a/eslint.config.mjs b/eslint.config.mjs index 178befc..3004088 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -29,6 +29,7 @@ export default eslintConfig( "vue/comma-dangle": ["warn", "never"], "antfu/top-level-function": "off", "antfu/if-newline": "off", + "new-cap": "off", "node/prefer-global/process": ["off"] } }, diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 059eb4f..f20ef16 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -29,7 +29,10 @@ serde_json = "1" [dependencies.tauri] version = "2.2.5" -features = [ "tray-icon" ] +features = [ + "tray-icon", + "unstable" +] [dependencies.serde] version = "1" diff --git a/src-tauri/capabilities/main.json b/src-tauri/capabilities/main.json index 65c05f0..a17f416 100644 --- a/src-tauri/capabilities/main.json +++ b/src-tauri/capabilities/main.json @@ -1,9 +1,10 @@ { "$schema": "../gen/schemas/desktop-schema.json", "identifier": "main", - "description": "Capabilities for the main window", + "description": "Capabilities for the app window", "windows": [ - "main" + "main", + "secondary" ], "permissions": [ "core:path:default", @@ -38,6 +39,8 @@ "os:allow-locale", "fs:allow-document-read", "fs:allow-document-write", - "store:default" + "store:default", + "core:webview:allow-create-webview", + "core:webview:allow-create-webview-window" ] } diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json index bb04784..df1bbc0 100644 --- a/src-tauri/gen/schemas/capabilities.json +++ b/src-tauri/gen/schemas/capabilities.json @@ -1 +1 @@ -{"main":{"identifier":"main","description":"Capabilities for the main window","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},"notification:default","os:allow-platform","os:allow-arch","os:allow-family","os:allow-version","os:allow-locale","fs:allow-document-read","fs:allow-document-write","store:default"]}} \ No newline at end of file +{"main":{"identifier":"main","description":"Capabilities for the app window","local":true,"windows":["main","secondary"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","shell:allow-open",{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},"notification:default","os:allow-platform","os:allow-arch","os:allow-family","os:allow-version","os:allow-locale","fs:allow-document-read","fs:allow-document-write","store:default","core:webview:allow-create-webview","core:webview:allow-create-webview-window"]}} \ No newline at end of file From d1d4a4df1859555c31db8385bb89fcec8c939169 Mon Sep 17 00:00:00 2001 From: Nicola Spadari Date: Thu, 20 Feb 2025 16:30:01 +0100 Subject: [PATCH 02/15] Add a title for new webviews --- app/pages/webview.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/app/pages/webview.vue b/app/pages/webview.vue index c6fcdcf..bbcb11d 100644 --- a/app/pages/webview.vue +++ b/app/pages/webview.vue @@ -25,6 +25,7 @@ const openWindow = async (id: string, page: string) => { const webview = new useTauriWebviewWindowWebviewWindow(id, { + title: "Nuxtor webview", url: page, width: 1280, height: 720 From 41e9520986a3b9f001a86ed037930c07cd246090 Mon Sep 17 00:00:00 2001 From: Nicola Spadari Date: Fri, 21 Feb 2025 09:40:34 +0100 Subject: [PATCH 03/15] Add router options --- app/router.options.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/router.options.ts diff --git a/app/router.options.ts b/app/router.options.ts new file mode 100644 index 0000000..7fe4711 --- /dev/null +++ b/app/router.options.ts @@ -0,0 +1,22 @@ +import type { RouterOptions } from "@nuxt/schema"; + +export default { + scrollBehavior(to, _from, savedPosition) { + return new Promise((resolve, _reject) => { + setTimeout(() => { + if (savedPosition) { + resolve(savedPosition); + } else { + if (to.hash) { + resolve({ + el: to.hash, + top: 0 + }); + } else { + resolve({ top: 0 }); + } + } + }, 100); + }); + } +} satisfies RouterOptions; From 733f6a47e81bed5cad6bf26e734e3ae2c22acea8 Mon Sep 17 00:00:00 2001 From: Nicola Spadari Date: Fri, 21 Feb 2025 09:41:02 +0100 Subject: [PATCH 04/15] Update node, pnpm and packages versions --- .github/workflows/release.yml | 4 ++-- .nvmrc | 2 +- nuxt.config.ts | 13 ++++++++----- package.json | 22 +++++++++++----------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b64188..ad070fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: - name: setup node uses: actions/setup-node@v4 with: - node-version: 23.5.0 + node-version: 23.8.0 - name: install Rust stable uses: dtolnay/rust-toolchain@stable @@ -46,7 +46,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 9.15.4 + version: 10.4.1 - name: install frontend dependencies run: pnpm install diff --git a/.nvmrc b/.nvmrc index dd6db9f..801a2a0 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -23.5.0 \ No newline at end of file +23.8.0 \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index fbd2051..79fe236 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -46,11 +46,14 @@ export default defineNuxtConfig({ presets: [ { from: "zod", - imports: ["z", { - name: "infer", - as: "zInfer", - type: true - }] + imports: [ + "z", + { + name: "infer", + as: "zInfer", + type: true + } + ] } ] }, diff --git a/package.json b/package.json index 836c2e4..8448d4d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "type": "module", "version": "1.2.0", "private": true, - "packageManager": "pnpm@9.15.4", + "packageManager": "pnpm@10.4.1", "description": "Starter template for Nuxt 3 and Tauri 2", "author": "Nicola Spadari", "license": "MIT", @@ -23,8 +23,8 @@ "tauri:build:debug": "tauri build --debug" }, "dependencies": { - "@nuxt/ui": "3.0.0-alpha.12", - "@tauri-apps/api": ">=2.2.0", + "@nuxt/ui": "^3.0.0-alpha.13", + "@tauri-apps/api": "^2.2.0", "@tauri-apps/plugin-fs": "^2.2.0", "@tauri-apps/plugin-notification": "^2.2.1", "@tauri-apps/plugin-os": "^2.2.0", @@ -33,16 +33,16 @@ "nuxt": "^3.15.4", "vue": "^3.5.13", "vue-router": "^4.5.0", - "zod": "^3.24.1" + "zod": "^3.24.2" }, "devDependencies": { - "@antfu/eslint-config": "^4.1.1", - "@nuxt/eslint": "^1.0.1", - "@tauri-apps/cli": ">=2.2.7", - "@vueuse/core": "^12.5.0", - "@vueuse/nuxt": "^12.5.0", - "bumpp": "^10.0.2", - "eslint": "9.17.0", + "@antfu/eslint-config": "^4.3.0", + "@nuxt/eslint": "^1.1.0", + "@tauri-apps/cli": "^2.2.7", + "@vueuse/core": "^12.7.0", + "@vueuse/nuxt": "^12.7.0", + "bumpp": "^10.0.3", + "eslint": "^9.20.1", "nuxt-svgo": "^4.0.14", "typescript": "^5.7.3" } From 2afee8254b7280a756af569c8af9a30bd3bf549c Mon Sep 17 00:00:00 2001 From: Nicola Spadari Date: Wed, 26 Feb 2025 10:33:52 +0100 Subject: [PATCH 05/15] Temporarily fix nuxtui a.13 missing styles --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index 8448d4d..0cda80a 100644 --- a/package.json +++ b/package.json @@ -45,5 +45,10 @@ "eslint": "^9.20.1", "nuxt-svgo": "^4.0.14", "typescript": "^5.7.3" + }, + "resolutions": { + "@tailwindcss/postcss": "4.0.7", + "@tailwindcss/vite": "4.0.7", + "tailwindcss": "4.0.7" } } From 8f5efa0a172eb3406dc5a11acd0094b7918bfe4c Mon Sep 17 00:00:00 2001 From: Nicola Spadari Date: Wed, 26 Feb 2025 15:26:42 +0100 Subject: [PATCH 06/15] Categorize routes --- app/components/Site/Navbar.vue | 1 + app/composables/pages.ts | 33 ++++++++++++++++++++++++++------- app/pages/commands.vue | 7 +++++-- app/pages/file.vue | 5 ++++- app/pages/notifications.vue | 5 ++++- app/pages/os.vue | 5 ++++- app/pages/store.vue | 5 ++++- app/pages/webview.vue | 5 ++++- 8 files changed, 52 insertions(+), 14 deletions(-) diff --git a/app/components/Site/Navbar.vue b/app/components/Site/Navbar.vue index c02cbee..6bc3b11 100644 --- a/app/components/Site/Navbar.vue +++ b/app/components/Site/Navbar.vue @@ -13,6 +13,7 @@ variant="link" :ui="{ root: 'hidden md:flex', + viewportWrapper: 'max-w-2xl absolute-center-h', list: 'md:gap-x-2' }" /> diff --git a/app/composables/pages.ts b/app/composables/pages.ts index 1f96d51..62a853a 100644 --- a/app/composables/pages.ts +++ b/app/composables/pages.ts @@ -1,13 +1,32 @@ export const usePages = () => { const router = useRouter(); - const pages = router.getRoutes().filter((route) => route.name !== "index" && route.name !== "all").map((route) => { - return { - label: route.meta.name, - to: route.path, - icon: route.meta.icon - }; - }); + const routes = router.getRoutes().filter((route) => route.name !== "index" && route.name !== "all"); + + const categorizedRoutes = routes.reduce((acc, route) => { + const category = route.meta.category as string; + if (!category) return acc; + + if (!acc[category]) { + acc[category] = { + label: category.charAt(0).toUpperCase() + category.slice(1), + icon: route.meta.categoryIcon || "i-lucide-folder", + to: route.path, + children: [] + }; + } + + acc[category].children.push({ + label: route.meta.name as string, + description: route.meta.description as string, + icon: `i-${route.meta.icon}`, + to: route.path + }); + + return acc; + }, {} as Record); + + const pages = Object.values(categorizedRoutes); return { pages diff --git a/app/pages/commands.vue b/app/pages/commands.vue index fca35ca..4d16482 100644 --- a/app/pages/commands.vue +++ b/app/pages/commands.vue @@ -25,8 +25,11 @@