diff --git a/.gitignore b/.gitignore index a547bf3..577fa48 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ dist-ssr *.njsproj *.sln *.sw? + +# Unplugin +components.d.ts diff --git a/index.html b/index.html index aa51dde..f1f33b0 100644 --- a/index.html +++ b/index.html @@ -1,14 +1,25 @@ - + - Tauri + Vue + TS + Grassator
+ diff --git a/package.json b/package.json index 4559049..b976dbe 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,12 @@ "@primevue/themes": "^4.0.0", "@tauri-apps/api": "2.0.0-beta.14", "@tauri-apps/plugin-shell": "2.0.0-beta.7", + "pinia": "^2.1.7", + "primeicons": "^7.0.0", "primevue": "^4.0.0", "unocss": "^0.61.3", - "vue": "^3.4.31" + "vue": "^3.4.31", + "vue-router": "^4.4.0" }, "devDependencies": { "@primevue/auto-import-resolver": "^4.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0e158fe..7010117 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,12 @@ importers: '@tauri-apps/plugin-shell': specifier: 2.0.0-beta.7 version: 2.0.0-beta.7 + pinia: + specifier: ^2.1.7 + version: 2.1.7(typescript@5.5.3)(vue@3.4.31(typescript@5.5.3)) + primeicons: + specifier: ^7.0.0 + version: 7.0.0 primevue: specifier: ^4.0.0 version: 4.0.0(@primeuix/utils@0.0.5)(vue@3.4.31(typescript@5.5.3)) @@ -26,6 +32,9 @@ importers: vue: specifier: ^3.4.31 version: 3.4.31(typescript@5.5.3) + vue-router: + specifier: ^4.4.0 + version: 4.4.0(vue@3.4.31(typescript@5.5.3)) devDependencies: '@primevue/auto-import-resolver': specifier: ^4.0.0 @@ -459,46 +468,55 @@ packages: resolution: {integrity: sha512-P9bSiAUnSSM7EmyRK+e5wgpqai86QOSv8BwvkGjLwYuOpaeomiZWifEos517CwbG+aZl1T4clSE1YqqH2JRs+g==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.18.1': resolution: {integrity: sha512-5RnjpACoxtS+aWOI1dURKno11d7krfpGDEn19jI8BuWmSBbUC4ytIADfROM1FZrFhQPSoP+KEa3NlEScznBTyQ==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.18.1': resolution: {integrity: sha512-8mwmGD668m8WaGbthrEYZ9CBmPug2QPGWxhJxh/vCgBjro5o96gL04WLlg5BA233OCWLqERy4YUzX3bJGXaJgQ==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.18.1': resolution: {integrity: sha512-dJX9u4r4bqInMGOAQoGYdwDP8lQiisWb9et+T84l2WXk41yEej8v2iGKodmdKimT8cTAYt0jFb+UEBxnPkbXEQ==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-powerpc64le-gnu@4.18.1': resolution: {integrity: sha512-V72cXdTl4EI0x6FNmho4D502sy7ed+LuVW6Ym8aI6DRQ9hQZdp5sj0a2usYOlqvFBNKQnLQGwmYnujo2HvjCxQ==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.18.1': resolution: {integrity: sha512-f+pJih7sxoKmbjghrM2RkWo2WHUW8UbfxIQiWo5yeCaCM0TveMEuAzKJte4QskBp1TIinpnRcxkquY+4WuY/tg==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.18.1': resolution: {integrity: sha512-qb1hMMT3Fr/Qz1OKovCuUM11MUNLUuHeBC2DPPAWUYYUAOFWaxInaTwTQmc7Fl5La7DShTEpmYwgdt2hG+4TEg==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.18.1': resolution: {integrity: sha512-7O5u/p6oKUFYjRbZkL2FLbwsyoJAjyeXHCU3O4ndvzg2OFO2GinFPSJFGbiwFDaCFc+k7gs9CF243PwdPQFh5g==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.18.1': resolution: {integrity: sha512-pDLkYITdYrH/9Cv/Vlj8HppDuLMDUBmgsM0+N+xLtFd18aXgM9Nyqupb/Uw+HeidhfYg2lD6CXvz6CjoVOaKjQ==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.18.1': resolution: {integrity: sha512-W2ZNI323O/8pJdBGil1oCauuCzmVd9lDmWBBqxYZcOqWD6aWqJtVBQ1dFrF4dYpZPks6F+xCZHfzG5hYlSHZ6g==} @@ -542,24 +560,28 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [glibc] '@tauri-apps/cli-linux-arm64-musl@2.0.0-beta.21': resolution: {integrity: sha512-s1rV01RIdowlPHfw7hTBnCEm2C3mZbynF+xpyRSv9vSczu4dpfwILMRwxB4nzMzdJ7RPHsf/R+5Ww86e8QM4Gw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] + libc: [musl] '@tauri-apps/cli-linux-x64-gnu@2.0.0-beta.21': resolution: {integrity: sha512-yGh7ktUycHT3mAnKxC7cx/vjcbjJzoxQCxnjWpmIayVwq+iXLD1mK7nRXRdJpL/rnBFTqqD29CKuypCEFiq3/A==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [glibc] '@tauri-apps/cli-linux-x64-musl@2.0.0-beta.21': resolution: {integrity: sha512-+79b8O3tsjbGR47pJtcSKGmtqj4rsSxB5AfMb4UCkmoNkbaOzB0YS/ZieUGAb+SHXZ/MMs7mcl96N9SqYOL7hw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] + libc: [musl] '@tauri-apps/cli-win32-arm64-msvc@2.0.0-beta.21': resolution: {integrity: sha512-rKlpcjx6t1ECZciMmHT5xkXKjC+O+TVxRKmA21tEq/Ezt7XdnufGko1hduwQmVJWkHxKg6ab7uf98ImMpDC5UA==} @@ -704,6 +726,9 @@ packages: '@vue/compiler-ssr@3.4.31': resolution: {integrity: sha512-RtefmITAje3fJ8FSg1gwgDhdKhZVntIVbwupdyZDSifZTRMiWxWehAOTCc8/KZDnBOcYQ4/9VWxsTbd3wT0hAA==} + '@vue/devtools-api@6.6.3': + resolution: {integrity: sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==} + '@vue/language-core@2.0.26': resolution: {integrity: sha512-/lt6SfQ3O1yDAhPsnLv9iSUgXd1dMHqUm/t3RctfqjuwQf1LnftZ414X3UBn6aXT4MiwXWtbNJ4Z0NZWwDWgJQ==} peerDependencies: @@ -1174,6 +1199,18 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + pinia@2.1.7: + resolution: {integrity: sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==} + peerDependencies: + '@vue/composition-api': ^1.4.0 + typescript: '>=4.4.4' + vue: ^2.6.14 || ^3.3.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + typescript: + optional: true + pkg-types@1.1.3: resolution: {integrity: sha512-+JrgthZG6m3ckicaOB74TwQ+tBWsFl3qVQg7mN8ulwSOElJ7gBhKzj2VkCPnZ4NlF6kEquYU+RIYNVAvzd54UA==} @@ -1181,6 +1218,9 @@ packages: resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} engines: {node: ^10 || ^12 || >=14} + primeicons@7.0.0: + resolution: {integrity: sha512-jK3Et9UzwzTsd6tzl2RmwrVY/b8raJ3QZLzoDACj+oTJ0oX7L9Hy+XnVwgo4QVKlKpnP/Ur13SXV/pVh4LzaDw==} + primevue@4.0.0: resolution: {integrity: sha512-2PFmmJqyXpOcKOdF+gbps5fpSXfoXZp2LwX+hya/b5SDseMt3UNboyEgVI6B+DNbJRrib35EbDiMw+7RIANQ1w==} engines: {node: '>=12.11.0'} @@ -1385,6 +1425,22 @@ packages: vscode-uri@3.0.8: resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==} + vue-demi@0.14.8: + resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==} + engines: {node: '>=12'} + hasBin: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + + vue-router@4.4.0: + resolution: {integrity: sha512-HB+t2p611aIZraV2aPSRNXf0Z/oLZFrlygJm+sZbdJaW6lcFqEDQwnzUBXn+DApw+/QzDU/I9TeWx9izEjTmsA==} + peerDependencies: + vue: ^3.2.0 + vue-template-compiler@2.7.16: resolution: {integrity: sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==} @@ -2106,6 +2162,8 @@ snapshots: '@vue/compiler-dom': 3.4.31 '@vue/shared': 3.4.31 + '@vue/devtools-api@6.6.3': {} + '@vue/language-core@2.0.26(typescript@5.5.3)': dependencies: '@volar/language-core': 2.4.0-alpha.15 @@ -2557,6 +2615,14 @@ snapshots: picomatch@2.3.1: {} + pinia@2.1.7(typescript@5.5.3)(vue@3.4.31(typescript@5.5.3)): + dependencies: + '@vue/devtools-api': 6.6.3 + vue: 3.4.31(typescript@5.5.3) + vue-demi: 0.14.8(vue@3.4.31(typescript@5.5.3)) + optionalDependencies: + typescript: 5.5.3 + pkg-types@1.1.3: dependencies: confbox: 0.1.7 @@ -2569,6 +2635,8 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + primeicons@7.0.0: {} + primevue@4.0.0(@primeuix/utils@0.0.5)(vue@3.4.31(typescript@5.5.3)): dependencies: '@primevue/core': 4.0.0(@primeuix/utils@0.0.5)(vue@3.4.31(typescript@5.5.3)) @@ -2772,6 +2840,15 @@ snapshots: vscode-uri@3.0.8: {} + vue-demi@0.14.8(vue@3.4.31(typescript@5.5.3)): + dependencies: + vue: 3.4.31(typescript@5.5.3) + + vue-router@4.4.0(vue@3.4.31(typescript@5.5.3)): + dependencies: + '@vue/devtools-api': 6.6.3 + vue: 3.4.31(typescript@5.5.3) + vue-template-compiler@2.7.16: dependencies: de-indent: 1.0.2 diff --git a/src/App.vue b/src/App.vue index bccf406..5aeb26f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,9 +2,7 @@ diff --git a/src/main.ts b/src/main.ts index d239914..4f3e25d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,22 @@ +import "virtual:uno.css"; +import "primeicons/primeicons.css"; + import { createApp } from "vue"; +import { createPinia } from "pinia"; import App from "./App.vue"; +import router from "./router"; import PrimeVue from 'primevue/config'; import Aura from '@primevue/themes/aura'; +import Ripple from "primevue/ripple"; +import Toast from "primevue/toast"; +import ToastService from "primevue/toastservice"; const app = createApp(App) +const pinia = createPinia() + app.use(PrimeVue, { + ripple: true, theme: { preset: Aura, options: { @@ -15,5 +26,11 @@ app.use(PrimeVue, { } } }); +app.use(ToastService); +app.directive("ripple", Ripple); +app.component("Toast", Toast); + +app.use(pinia); +app.use(router); app.mount("#app"); diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..3af9206 --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,37 @@ +import { + createRouter, + createWebHashHistory, + type RouteRecordRaw, +} from "vue-router"; + +const views = import.meta.glob([ + "../views/**/*.vue", + "../views/**/index.vue", + "../views/**/\\[*\\].vue", +]); + +const routes: RouteRecordRaw[] = Object.entries(views).map( + ([filePath, component]) => { + let path = filePath + .replace(/^\.\.\/views\//, "") + .replace(/\.vue$/, "") + .replace(/^(.*)\/?index$/, "$1") + .replace(/\[(\w+)\]$/, ":$1"); + path = "/" + path; + + return { + path, + name: filePath.replace(/^\.\.\/views\//, ""), + component, + } satisfies RouteRecordRaw; + } +); + +console.log(routes.length); + +const router = createRouter({ + history: createWebHashHistory(import.meta.env.BASE_URL), + routes: [...routes], +}); + +export default router; diff --git a/src/views/index.vue b/src/views/index.vue new file mode 100644 index 0000000..a5bbb60 --- /dev/null +++ b/src/views/index.vue @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file