Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0cfefaa3d | |||
| 9a0b73d27c | |||
| b5ace9871d | |||
| 981566c3ba | |||
| 3aa6590c9a | |||
| ca2bd2f50a | |||
| fb01fe583e | |||
| 4925e6b739 | |||
| 0d4c71926d | |||
| e994430d28 | |||
| 63d76accff |
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM node:23-slim AS base
|
||||
LABEL Author="eisterman"
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
FROM base AS prod-deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
|
||||
FROM base AS build
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
RUN pnpm run build
|
||||
|
||||
FROM base
|
||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||
COPY --from=build /app/build /app/build
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["node", "build"]
|
||||
42
README.md
42
README.md
@@ -1,38 +1,8 @@
|
||||
# sv
|
||||
# Svelte-Kit RE Charge.re
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
|
||||
### Missing in TODO:
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npx sv create
|
||||
|
||||
# create a new project in my-app
|
||||
npx sv create my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To create a production version of your app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
||||
- [ ] Localizzazione
|
||||
- [ ] Opzione per selezione lingue
|
||||
- [ ] Aggiornamento paraglide
|
||||
- [ ] Pagina di "attesa 30 secondi avvio carica"
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
"@eslint/compat": "^1.2.5",
|
||||
"@eslint/js": "^9.18.0",
|
||||
"@iconify/svelte": "^4.2.0",
|
||||
"@sveltejs/adapter-auto": "^4.0.0",
|
||||
"@melt-ui/pp": "^0.3.2",
|
||||
"@melt-ui/svelte": "^0.86.5",
|
||||
"@sveltejs/adapter-node": "^5.2.12",
|
||||
"@sveltejs/enhanced-img": "^0.4.4",
|
||||
"@sveltejs/kit": "^2.16.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||
|
||||
244
pnpm-lock.yaml
generated
244
pnpm-lock.yaml
generated
@@ -30,9 +30,15 @@ importers:
|
||||
'@iconify/svelte':
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0(svelte@5.25.3)
|
||||
'@sveltejs/adapter-auto':
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0(@sveltejs/kit@2.20.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))
|
||||
'@melt-ui/pp':
|
||||
specifier: ^0.3.2
|
||||
version: 0.3.2(@melt-ui/svelte@0.86.5(svelte@5.25.3))(svelte@5.25.3)
|
||||
'@melt-ui/svelte':
|
||||
specifier: ^0.86.5
|
||||
version: 0.86.5(svelte@5.25.3)
|
||||
'@sveltejs/adapter-node':
|
||||
specifier: ^5.2.12
|
||||
version: 5.2.12(@sveltejs/kit@2.20.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))
|
||||
'@sveltejs/enhanced-img':
|
||||
specifier: ^0.4.4
|
||||
version: 0.4.4(rollup@4.37.0)(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2))
|
||||
@@ -301,6 +307,15 @@ packages:
|
||||
'@exodus/schemasafe@1.3.0':
|
||||
resolution: {integrity: sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==}
|
||||
|
||||
'@floating-ui/core@1.6.9':
|
||||
resolution: {integrity: sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==}
|
||||
|
||||
'@floating-ui/dom@1.6.13':
|
||||
resolution: {integrity: sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==}
|
||||
|
||||
'@floating-ui/utils@0.2.9':
|
||||
resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==}
|
||||
|
||||
'@gcornut/valibot-json-schema@0.31.0':
|
||||
resolution: {integrity: sha512-3xGptCurm23e7nuPQkdrE5rEs1FeTPHhAUsBuwwqG4/YeZLwJOoYZv+fmsppUEfo5y9lzUwNQrNqLS/q7HMc7g==}
|
||||
hasBin: true
|
||||
@@ -455,6 +470,9 @@ packages:
|
||||
resolution: {integrity: sha512-1cbeEzfQLTHTl1Y2qthZWItiZHe0ok0w1rNeANW1IO8GcFCmx44WGt7KnNssiUjPl7YKi4JG9XhwwaVPqNJfyA==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
||||
'@internationalized/date@3.7.0':
|
||||
resolution: {integrity: sha512-VJ5WS3fcVx0bejE/YHfbDKR/yawZgKqn/if+oEeLqNwBtPzVB06olkfcnojTmEMX+gTpH+FlQ69SHNitJ8/erQ==}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.8':
|
||||
resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
@@ -480,6 +498,17 @@ packages:
|
||||
'@lix-js/server-api-schema@0.1.1':
|
||||
resolution: {integrity: sha512-W1Z7KKOxAQ4Dag9V2wrDevHPh5rPk+icBUsxNfNCNB2tlPrKpba99562vcTCPoT03KXpihEbWutZNujCRtMA+g==}
|
||||
|
||||
'@melt-ui/pp@0.3.2':
|
||||
resolution: {integrity: sha512-xKkPvaIAFinklLXcQOpwZ8YSpqAFxykjWf8Y/fSJQwsixV/0rcFs07hJ49hJjPy5vItvw5Qa0uOjzFUbXzBypQ==}
|
||||
peerDependencies:
|
||||
'@melt-ui/svelte': '>= 0.29.0'
|
||||
svelte: ^3.55.0 || ^4.0.0 || ^5.0.0-next.1
|
||||
|
||||
'@melt-ui/svelte@0.86.5':
|
||||
resolution: {integrity: sha512-aaVfc0pxCf6B3ByrzGJ+hB2Sop9wJamw2lNHZlzaolU0Ew1D6O9CbeJElGODT8IbH8/bhI3LcN0nCJRh2ePq+A==}
|
||||
peerDependencies:
|
||||
svelte: ^3.0.0 || ^4.0.0 || ^5.0.0-next.118
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
@@ -499,6 +528,33 @@ packages:
|
||||
resolution: {integrity: sha512-ct43jurbe7lsUX5eIrj4ijO3j/6zIPp7CDnFWXDs7UPAbw1Pu1iH3oAmFdP4jcskKJBURH5M9oTtyeiUXyHX8Q==}
|
||||
engines: {node: '>=18.16.0'}
|
||||
|
||||
'@rollup/plugin-commonjs@28.0.3':
|
||||
resolution: {integrity: sha512-pyltgilam1QPdn+Zd9gaCfOLcnjMEJ9gV+bTw6/r73INdvzf1ah9zLIJBm+kW7R6IUFIQ1YO+VqZtYxZNWFPEQ==}
|
||||
engines: {node: '>=16.0.0 || 14 >= 14.17'}
|
||||
peerDependencies:
|
||||
rollup: ^2.68.0||^3.0.0||^4.0.0
|
||||
peerDependenciesMeta:
|
||||
rollup:
|
||||
optional: true
|
||||
|
||||
'@rollup/plugin-json@6.1.0':
|
||||
resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
peerDependencies:
|
||||
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
|
||||
peerDependenciesMeta:
|
||||
rollup:
|
||||
optional: true
|
||||
|
||||
'@rollup/plugin-node-resolve@16.0.1':
|
||||
resolution: {integrity: sha512-tk5YCxJWIG81umIvNkSod2qK5KyQW19qcBF/B78n1bjtOON6gzKoVeSzAE8yHCZEDmqkHKkxplExA8KzdJLJpA==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
peerDependencies:
|
||||
rollup: ^2.78.0||^3.0.0||^4.0.0
|
||||
peerDependenciesMeta:
|
||||
rollup:
|
||||
optional: true
|
||||
|
||||
'@rollup/pluginutils@5.1.4':
|
||||
resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
@@ -635,10 +691,10 @@ packages:
|
||||
peerDependencies:
|
||||
acorn: ^8.9.0
|
||||
|
||||
'@sveltejs/adapter-auto@4.0.0':
|
||||
resolution: {integrity: sha512-kmuYSQdD2AwThymQF0haQhM8rE5rhutQXG4LNbnbShwhMO4qQGnKaaTy+88DuNSuoQDi58+thpq8XpHc1+oEKQ==}
|
||||
'@sveltejs/adapter-node@5.2.12':
|
||||
resolution: {integrity: sha512-0bp4Yb3jKIEcZWVcJC/L1xXp9zzJS4hDwfb4VITAkfT4OVdkspSHsx7YhqJDbb2hgLl6R9Vs7VQR+fqIVOxPUQ==}
|
||||
peerDependencies:
|
||||
'@sveltejs/kit': ^2.0.0
|
||||
'@sveltejs/kit': ^2.4.0
|
||||
|
||||
'@sveltejs/enhanced-img@0.4.4':
|
||||
resolution: {integrity: sha512-BlBTGfbLUgHa+zSVrsGLOd+noCKWfipoOjoxE26bAAX97v7zh5eiCAp1KEdpkluL05Tl3+nR14gQdPsATyZqoA==}
|
||||
@@ -670,6 +726,9 @@ packages:
|
||||
svelte: ^5.0.0
|
||||
vite: ^6.0.0
|
||||
|
||||
'@swc/helpers@0.5.15':
|
||||
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
|
||||
|
||||
'@tailwindcss/node@4.0.15':
|
||||
resolution: {integrity: sha512-IODaJjNmiasfZX3IoS+4Em3iu0fD2HS0/tgrnkYfW4hyUor01Smnr5eY3jc4rRgaTDrJlDmBTHbFO0ETTDaxWA==}
|
||||
|
||||
@@ -766,6 +825,9 @@ packages:
|
||||
'@types/leaflet@1.9.17':
|
||||
resolution: {integrity: sha512-IJ4K6t7I3Fh5qXbQ1uwL3CFVbCi6haW9+53oLWgdKlLP7EaS21byWFJxxqOx9y8I0AP0actXSJLVMbyvxhkUTA==}
|
||||
|
||||
'@types/resolve@1.20.2':
|
||||
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
|
||||
|
||||
'@types/validator@13.12.2':
|
||||
resolution: {integrity: sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==}
|
||||
|
||||
@@ -935,6 +997,9 @@ packages:
|
||||
resolution: {integrity: sha512-bKw/r35jR3HGt5PEPm1ljsQQGyCrR8sFGNiN5L+ykDHdpO8Smxkrkla9Yi6NkQyUrb8V54PGhfMs6NrIwtxtdw==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
commondir@1.0.1:
|
||||
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
|
||||
|
||||
concat-map@0.0.1:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
|
||||
@@ -988,6 +1053,10 @@ packages:
|
||||
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
dequal@2.0.3:
|
||||
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
detect-libc@2.0.3:
|
||||
resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -1088,6 +1157,9 @@ packages:
|
||||
estree-walker@2.0.2:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
estree-walker@3.0.3:
|
||||
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
|
||||
|
||||
esutils@2.0.3:
|
||||
resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -1139,6 +1211,9 @@ packages:
|
||||
flatted@3.3.3:
|
||||
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
|
||||
|
||||
focus-trap@7.6.4:
|
||||
resolution: {integrity: sha512-xx560wGBk7seZ6y933idtjJQc1l+ck+pI3sKvhKozdBV1dRZoKhkW5xoCaFv9tQiX5RH1xfSxjuNu6g+lmN/gw==}
|
||||
|
||||
formsnap@2.0.0:
|
||||
resolution: {integrity: sha512-W61elddvdzeBEs10nNvwxQnx/FctJFHBXPk9uluNQAckHo1nuSUvSQGIjtLjTKIbQdQnwEOoxqWrk9tuv0U7hA==}
|
||||
engines: {node: '>=18', pnpm: '>=8.7.0'}
|
||||
@@ -1151,6 +1226,9 @@ packages:
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
|
||||
function-bind@1.1.2:
|
||||
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
||||
engines: {node: '>= 6'}
|
||||
@@ -1181,6 +1259,10 @@ packages:
|
||||
resolution: {integrity: sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
hasown@2.0.2:
|
||||
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
human-id@4.1.1:
|
||||
resolution: {integrity: sha512-3gKm/gCSUipeLsRYZbbdA1BD83lBoWUkZ7G9VFrhWPAU76KwYo5KR8V28bpoPm/ygy0x5/GCbpRQdY7VLYCoIg==}
|
||||
hasBin: true
|
||||
@@ -1210,6 +1292,10 @@ packages:
|
||||
is-arrayish@0.3.2:
|
||||
resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==}
|
||||
|
||||
is-core-module@2.16.1:
|
||||
resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
is-extglob@2.1.1:
|
||||
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -1218,10 +1304,16 @@ packages:
|
||||
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
is-module@1.0.0:
|
||||
resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==}
|
||||
|
||||
is-number@7.0.0:
|
||||
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
|
||||
is-reference@1.2.1:
|
||||
resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==}
|
||||
|
||||
is-reference@3.0.3:
|
||||
resolution: {integrity: sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==}
|
||||
|
||||
@@ -1399,6 +1491,11 @@ packages:
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
nanoid@5.1.5:
|
||||
resolution: {integrity: sha512-Ir/+ZpE9fDsNH0hQ3C68uyThDXzYcim2EqcZ8zn8Chtt1iylPT9xXJB0kPCnqzgcEGikO9RxSrh63MsmVCU7Fw==}
|
||||
engines: {node: ^18 || >=20}
|
||||
hasBin: true
|
||||
|
||||
natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
|
||||
@@ -1430,6 +1527,9 @@ packages:
|
||||
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
path-parse@1.0.7:
|
||||
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
|
||||
|
||||
picocolors@1.1.1:
|
||||
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||
|
||||
@@ -1505,6 +1605,11 @@ packages:
|
||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
resolve@1.22.10:
|
||||
resolution: {integrity: sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
hasBin: true
|
||||
|
||||
reusify@1.1.0:
|
||||
resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==}
|
||||
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
|
||||
@@ -1579,6 +1684,10 @@ packages:
|
||||
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
supports-preserve-symlinks-flag@1.0.0:
|
||||
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
svelte-check@4.1.5:
|
||||
resolution: {integrity: sha512-Gb0T2IqBNe1tLB9EB1Qh+LOe+JB8wt2/rNBDGvkxQVvk8vNeAoG+vZgFB/3P5+zC7RWlyBlzm9dVjZFph/maIg==}
|
||||
engines: {node: '>= 18.0.0'}
|
||||
@@ -1617,6 +1726,9 @@ packages:
|
||||
'@sveltejs/kit': 1.x || 2.x
|
||||
svelte: 3.x || 4.x || >=5.0.0-next.51
|
||||
|
||||
tabbable@6.2.0:
|
||||
resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==}
|
||||
|
||||
tailwindcss@4.0.15:
|
||||
resolution: {integrity: sha512-6ZMg+hHdMJpjpeCCFasX7K+U615U9D+7k5/cDK/iRwl6GptF24+I/AbKgOnXhVKePzrEyIXutLv36n4cRsq3Sg==}
|
||||
|
||||
@@ -1654,6 +1766,9 @@ packages:
|
||||
tslib@2.4.0:
|
||||
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
||||
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
type-check@0.4.0:
|
||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@@ -1941,6 +2056,17 @@ snapshots:
|
||||
'@exodus/schemasafe@1.3.0':
|
||||
optional: true
|
||||
|
||||
'@floating-ui/core@1.6.9':
|
||||
dependencies:
|
||||
'@floating-ui/utils': 0.2.9
|
||||
|
||||
'@floating-ui/dom@1.6.13':
|
||||
dependencies:
|
||||
'@floating-ui/core': 1.6.9
|
||||
'@floating-ui/utils': 0.2.9
|
||||
|
||||
'@floating-ui/utils@0.2.9': {}
|
||||
|
||||
'@gcornut/valibot-json-schema@0.31.0':
|
||||
dependencies:
|
||||
valibot: 0.31.1
|
||||
@@ -2079,6 +2205,10 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- babel-plugin-macros
|
||||
|
||||
'@internationalized/date@3.7.0':
|
||||
dependencies:
|
||||
'@swc/helpers': 0.5.15
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.8':
|
||||
dependencies:
|
||||
'@jridgewell/set-array': 1.2.1
|
||||
@@ -2110,6 +2240,23 @@ snapshots:
|
||||
|
||||
'@lix-js/server-api-schema@0.1.1': {}
|
||||
|
||||
'@melt-ui/pp@0.3.2(@melt-ui/svelte@0.86.5(svelte@5.25.3))(svelte@5.25.3)':
|
||||
dependencies:
|
||||
'@melt-ui/svelte': 0.86.5(svelte@5.25.3)
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.17
|
||||
svelte: 5.25.3
|
||||
|
||||
'@melt-ui/svelte@0.86.5(svelte@5.25.3)':
|
||||
dependencies:
|
||||
'@floating-ui/core': 1.6.9
|
||||
'@floating-ui/dom': 1.6.13
|
||||
'@internationalized/date': 3.7.0
|
||||
dequal: 2.0.3
|
||||
focus-trap: 7.6.4
|
||||
nanoid: 5.1.5
|
||||
svelte: 5.25.3
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
@@ -2127,6 +2274,34 @@ snapshots:
|
||||
'@poppinss/macroable@1.0.4':
|
||||
optional: true
|
||||
|
||||
'@rollup/plugin-commonjs@28.0.3(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.4(rollup@4.37.0)
|
||||
commondir: 1.0.1
|
||||
estree-walker: 2.0.2
|
||||
fdir: 6.4.3(picomatch@4.0.2)
|
||||
is-reference: 1.2.1
|
||||
magic-string: 0.30.17
|
||||
picomatch: 4.0.2
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-json@6.1.0(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.4(rollup@4.37.0)
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-node-resolve@16.0.1(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.4(rollup@4.37.0)
|
||||
'@types/resolve': 1.20.2
|
||||
deepmerge: 4.3.1
|
||||
is-module: 1.0.0
|
||||
resolve: 1.22.10
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/pluginutils@5.1.4(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.7
|
||||
@@ -2220,10 +2395,13 @@ snapshots:
|
||||
dependencies:
|
||||
acorn: 8.14.1
|
||||
|
||||
'@sveltejs/adapter-auto@4.0.0(@sveltejs/kit@2.20.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))':
|
||||
'@sveltejs/adapter-node@5.2.12(@sveltejs/kit@2.20.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))':
|
||||
dependencies:
|
||||
'@rollup/plugin-commonjs': 28.0.3(rollup@4.37.0)
|
||||
'@rollup/plugin-json': 6.1.0(rollup@4.37.0)
|
||||
'@rollup/plugin-node-resolve': 16.0.1(rollup@4.37.0)
|
||||
'@sveltejs/kit': 2.20.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2))
|
||||
import-meta-resolve: 4.1.0
|
||||
rollup: 4.37.0
|
||||
|
||||
'@sveltejs/enhanced-img@0.4.4(rollup@4.37.0)(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2))':
|
||||
dependencies:
|
||||
@@ -2276,6 +2454,10 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@swc/helpers@0.5.15':
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
|
||||
'@tailwindcss/node@4.0.15':
|
||||
dependencies:
|
||||
enhanced-resolve: 5.18.1
|
||||
@@ -2351,6 +2533,8 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/geojson': 7946.0.16
|
||||
|
||||
'@types/resolve@1.20.2': {}
|
||||
|
||||
'@types/validator@13.12.2':
|
||||
optional: true
|
||||
|
||||
@@ -2557,6 +2741,8 @@ snapshots:
|
||||
has-own-prop: 2.0.0
|
||||
repeat-string: 1.6.1
|
||||
|
||||
commondir@1.0.1: {}
|
||||
|
||||
concat-map@0.0.1: {}
|
||||
|
||||
consola@3.4.0: {}
|
||||
@@ -2588,6 +2774,8 @@ snapshots:
|
||||
|
||||
deepmerge@4.3.1: {}
|
||||
|
||||
dequal@2.0.3: {}
|
||||
|
||||
detect-libc@2.0.3: {}
|
||||
|
||||
devalue@5.1.1: {}
|
||||
@@ -2743,6 +2931,10 @@ snapshots:
|
||||
|
||||
estree-walker@2.0.2: {}
|
||||
|
||||
estree-walker@3.0.3:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.7
|
||||
|
||||
esutils@2.0.3: {}
|
||||
|
||||
fast-check@3.23.2:
|
||||
@@ -2792,6 +2984,10 @@ snapshots:
|
||||
|
||||
flatted@3.3.3: {}
|
||||
|
||||
focus-trap@7.6.4:
|
||||
dependencies:
|
||||
tabbable: 6.2.0
|
||||
|
||||
formsnap@2.0.0(svelte@5.25.3)(sveltekit-superforms@2.24.0(@sveltejs/kit@2.20.2(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(svelte@5.25.3)(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)))(@types/json-schema@7.0.15)(svelte@5.25.3)(typescript@5.8.2)):
|
||||
dependencies:
|
||||
svelte: 5.25.3
|
||||
@@ -2801,6 +2997,8 @@ snapshots:
|
||||
fsevents@2.3.3:
|
||||
optional: true
|
||||
|
||||
function-bind@1.1.2: {}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
@@ -2821,6 +3019,10 @@ snapshots:
|
||||
|
||||
has-own-prop@2.0.0: {}
|
||||
|
||||
hasown@2.0.2:
|
||||
dependencies:
|
||||
function-bind: 1.1.2
|
||||
|
||||
human-id@4.1.1: {}
|
||||
|
||||
ignore@5.3.2: {}
|
||||
@@ -2840,14 +3042,24 @@ snapshots:
|
||||
|
||||
is-arrayish@0.3.2: {}
|
||||
|
||||
is-core-module@2.16.1:
|
||||
dependencies:
|
||||
hasown: 2.0.2
|
||||
|
||||
is-extglob@2.1.1: {}
|
||||
|
||||
is-glob@4.0.3:
|
||||
dependencies:
|
||||
is-extglob: 2.1.1
|
||||
|
||||
is-module@1.0.0: {}
|
||||
|
||||
is-number@7.0.0: {}
|
||||
|
||||
is-reference@1.2.1:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.7
|
||||
|
||||
is-reference@3.0.3:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.7
|
||||
@@ -2989,6 +3201,8 @@ snapshots:
|
||||
|
||||
nanoid@3.3.11: {}
|
||||
|
||||
nanoid@5.1.5: {}
|
||||
|
||||
natural-compare@1.4.0: {}
|
||||
|
||||
normalize-url@8.0.1:
|
||||
@@ -3019,6 +3233,8 @@ snapshots:
|
||||
|
||||
path-key@3.1.1: {}
|
||||
|
||||
path-parse@1.0.7: {}
|
||||
|
||||
picocolors@1.1.1: {}
|
||||
|
||||
picomatch@2.3.1: {}
|
||||
@@ -3072,6 +3288,12 @@ snapshots:
|
||||
|
||||
resolve-from@4.0.0: {}
|
||||
|
||||
resolve@1.22.10:
|
||||
dependencies:
|
||||
is-core-module: 2.16.1
|
||||
path-parse: 1.0.7
|
||||
supports-preserve-symlinks-flag: 1.0.0
|
||||
|
||||
reusify@1.1.0: {}
|
||||
|
||||
rollup@4.37.0:
|
||||
@@ -3183,6 +3405,8 @@ snapshots:
|
||||
dependencies:
|
||||
has-flag: 4.0.0
|
||||
|
||||
supports-preserve-symlinks-flag@1.0.0: {}
|
||||
|
||||
svelte-check@4.1.5(picomatch@4.0.2)(svelte@5.25.3)(typescript@5.8.2):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
@@ -3260,6 +3484,8 @@ snapshots:
|
||||
- '@types/json-schema'
|
||||
- typescript
|
||||
|
||||
tabbable@6.2.0: {}
|
||||
|
||||
tailwindcss@4.0.15: {}
|
||||
|
||||
tapable@2.2.1: {}
|
||||
@@ -3288,6 +3514,8 @@ snapshots:
|
||||
tslib@2.4.0:
|
||||
optional: true
|
||||
|
||||
tslib@2.8.1: {}
|
||||
|
||||
type-check@0.4.0:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
</script>
|
||||
|
||||
{#if show}
|
||||
<div class="fixed inset-0 h-screen w-screen z-20 pointer-events-auto flex flex-col justify-end items-center">
|
||||
<button type="button" class="bg-base-100/50 w-full grow z-20"
|
||||
<div class="visible fixed inset-0 h-screen w-screen z-20 pointer-events-auto flex flex-col justify-end items-center">
|
||||
<button type="button" class="bg-base-100/50 absolute inset-0 h-full w-full"
|
||||
transition:fade={{duration:200}}
|
||||
onclick={closeOverlay}
|
||||
aria-label="Close Overlay"
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { ToastType } from "$lib/ToastService/types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
const { toast, destroyer }: {
|
||||
toast: ToastType,
|
||||
destroyer: () => void
|
||||
} = $props();
|
||||
|
||||
const alertClass = $derived.by(() => {
|
||||
switch (toast.type) {
|
||||
case "success":
|
||||
return 'alert-success';
|
||||
case "warning":
|
||||
return 'alert-warning';
|
||||
case "error":
|
||||
return 'alert-error';
|
||||
case "info":
|
||||
return 'alert-info';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
let timeMs = $state(0);
|
||||
let expireTime = 50000;
|
||||
let progressMax = 100;
|
||||
let segmentTime = Math.round(expireTime / progressMax);
|
||||
const progressValue = $derived(Math.round(timeMs / segmentTime));
|
||||
|
||||
function increment() {
|
||||
timeMs += segmentTime;
|
||||
if (timeMs >= expireTime) destroyer();
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const interval = setInterval(increment, segmentTime);
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="w-[60vw]">
|
||||
<div class="absolute w-full flex flex-col px-2">
|
||||
<progress class="progress h-1 w-full" value={progressValue} max="100"></progress>
|
||||
</div>
|
||||
<div class={["alert", alertClass]}>
|
||||
<span>{toast.content}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,27 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { ServiceState, ToastType } from "$lib/ToastService/types";
|
||||
import { setContext } from "svelte";
|
||||
import Toast from "./Toast.svelte";
|
||||
|
||||
const { children } = $props();
|
||||
|
||||
let serviceState: ServiceState = $state({ toasts: {}, nextId: 0 });
|
||||
|
||||
function addToast(toast: ToastType) {
|
||||
serviceState.toasts[serviceState.nextId++] = toast;
|
||||
}
|
||||
|
||||
setContext('toastservice', addToast);
|
||||
|
||||
function destroyToast(id: string) {
|
||||
delete serviceState.toasts[id];
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{@render children()}
|
||||
<div class="toast toast-top toast-center z-80">
|
||||
{#each Object.entries(serviceState.toasts) as [i, toast] (i)}
|
||||
<Toast {toast} destroyer={() => destroyToast(i)}/>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,13 +0,0 @@
|
||||
export type ToastType = {
|
||||
type: 'info' | 'success' | 'warning' | 'error',
|
||||
content: string,
|
||||
}
|
||||
|
||||
export type InternalToasts = {
|
||||
[key: string]: ToastType,
|
||||
}
|
||||
|
||||
export type ServiceState = {
|
||||
toasts: InternalToasts,
|
||||
nextId: number,
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { getContext } from "svelte";
|
||||
import type { ToastType } from "$lib/ToastService/types";
|
||||
|
||||
export function useToast(): { fireToast: (toast: ToastType) => void } {
|
||||
return {
|
||||
fireToast: getContext('toastservice')
|
||||
};
|
||||
}
|
||||
60
src/lib/ToastSystem/Toast.svelte
Normal file
60
src/lib/ToastSystem/Toast.svelte
Normal file
@@ -0,0 +1,60 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
melt,
|
||||
type Toast,
|
||||
type ToastsElements,
|
||||
} from '@melt-ui/svelte';
|
||||
import type { ToastData } from "$lib/ToastSystem/types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
interface Props {
|
||||
elements: ToastsElements,
|
||||
toast: Toast<ToastData>,
|
||||
}
|
||||
|
||||
const { elements, toast }: Props = $props();
|
||||
const { content, title, description, close } = $derived(elements);
|
||||
const { data, id, getPercentage } = $derived(toast);
|
||||
|
||||
const alertClass = $derived.by(() => {
|
||||
switch (data.type) {
|
||||
case "success":
|
||||
return 'alert-success';
|
||||
case "warning":
|
||||
return 'alert-warning';
|
||||
case "error":
|
||||
return 'alert-error';
|
||||
case "info":
|
||||
return 'alert-info';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
let percentage = $state(0);
|
||||
|
||||
onMount(() => {
|
||||
let frame: number;
|
||||
const updatePercentage = () => {
|
||||
percentage = getPercentage();
|
||||
frame = requestAnimationFrame(updatePercentage);
|
||||
};
|
||||
frame = requestAnimationFrame(updatePercentage);
|
||||
return () => cancelAnimationFrame(frame);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div use:melt={$content(id)} class="relative w-[70%] visible">
|
||||
<div class="absolute w-full flex flex-col px-2">
|
||||
<progress class="progress h-1 w-full" value={percentage} max="100"></progress>
|
||||
</div>
|
||||
<div class={["alert", alertClass]}>
|
||||
<button use:melt={$close(id)} aria-label="close notification" class="absolute right-2 top-0">x</button>
|
||||
<h3 use:melt={$title(id)} class="font-bold">
|
||||
{data.title}
|
||||
</h3>
|
||||
<div use:melt={$description(id)}>
|
||||
{data.description}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
23
src/lib/ToastSystem/Toaster.svelte
Normal file
23
src/lib/ToastSystem/Toaster.svelte
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts" module>
|
||||
import { createToaster } from '@melt-ui/svelte';
|
||||
import type { ToastData } from "$lib/ToastSystem/types";
|
||||
|
||||
const {
|
||||
elements,
|
||||
helpers,
|
||||
states: { toasts },
|
||||
actions: { portal }
|
||||
} = createToaster<ToastData>();
|
||||
|
||||
export const addToast = helpers.addToast;
|
||||
</script>
|
||||
<script>
|
||||
import Toast from "$lib/ToastSystem/Toast.svelte";
|
||||
</script>
|
||||
|
||||
<div use:portal
|
||||
class="fixed w-screen h-screen top-0 z-50 pb-4 flex flex-col-reverse justify-start items-center gap-2 invisible">
|
||||
{#each $toasts as toast (toast.id)}
|
||||
<Toast {elements} {toast}/>
|
||||
{/each}
|
||||
</div>
|
||||
5
src/lib/ToastSystem/types.ts
Normal file
5
src/lib/ToastSystem/types.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export type ToastData = {
|
||||
title: string
|
||||
description: string
|
||||
type: 'info' | 'success' | 'warning' | 'error',
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import ToastProvider from "$lib/ToastService/ToastProvider.svelte";
|
||||
import Toaster from "$lib/ToastSystem/Toaster.svelte";
|
||||
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<ToastProvider>
|
||||
{@render children()}
|
||||
</ToastProvider>
|
||||
{@render children()}
|
||||
<Toaster/>
|
||||
@@ -85,8 +85,8 @@
|
||||
</Map>
|
||||
{/await}
|
||||
</div>
|
||||
<div class="z-20 mt-16 grow pointer-events-none">
|
||||
<div class="flex justify-center items-center h-full pointer-events-none">
|
||||
<div class="z-20 mt-16 grow invisible">
|
||||
<div class="flex justify-center items-center h-full">
|
||||
{@render children()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { scale } from 'svelte/transition';
|
||||
import { goto } from "$app/navigation";
|
||||
import { goto, invalidate } from "$app/navigation";
|
||||
import BSlideOverlay from "$lib/BSlideOverlay.svelte";
|
||||
import { useToast } from "$lib/ToastService/useToast";
|
||||
import { addToast } from '$lib/ToastSystem/Toaster.svelte';
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
const { fireToast } = useToast();
|
||||
|
||||
let showOverlay = $state(false);
|
||||
let startingCharge = $state(false);
|
||||
|
||||
@@ -15,15 +13,33 @@
|
||||
if (startingCharge) return;
|
||||
startingCharge = true;
|
||||
try {
|
||||
// TODO: StartCharge fetch request
|
||||
// const response = await fetch(`/api/public/1/chargecontroller/${data.qrcode}/start_charge/`, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Accept': 'application/json',
|
||||
// }
|
||||
// });
|
||||
console.log("nop");
|
||||
await goto(`/${data.qrcode}/status`);
|
||||
const response = await fetch(`/api/public/1/chargecontroller/${data.qrcode}/start_charge/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
});
|
||||
if (response.ok) {
|
||||
addToast({
|
||||
closeDelay: 5000,
|
||||
data: {
|
||||
title: 'Charge Started',
|
||||
description: '',
|
||||
type: 'success',
|
||||
}
|
||||
});
|
||||
await invalidate('app:chargecontroller');
|
||||
await goto(`/${data.qrcode}/status`);
|
||||
} else {
|
||||
addToast({
|
||||
closeDelay: 5000,
|
||||
data: {
|
||||
title: 'Error',
|
||||
description: response.statusText ?? 'unknown',
|
||||
type: 'error',
|
||||
}
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
startingCharge = false;
|
||||
}
|
||||
@@ -32,11 +48,8 @@
|
||||
|
||||
<div class="grid grid-rows-6 h-full w-full">
|
||||
<div class="row-start-5 col-start-1 flex flex-col justify-center items-center">
|
||||
<div class="pointer-events-auto">
|
||||
<div class="visible">
|
||||
<button class="btn btn-primary btn-lg uppercase" onclick={() => showOverlay = true}>Attivare la Ricarica</button>
|
||||
<button class="btn btn-secondary" onclick={() => fireToast({type: 'success', content: 'Messaggio Ricevuto!'})}>
|
||||
TEST
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<BSlideOverlay bind:show={showOverlay} closable={!startingCharge}>
|
||||
|
||||
@@ -3,11 +3,12 @@ import { redirect } from "@sveltejs/kit";
|
||||
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
const parentData = await parent();
|
||||
if (parentData.user === null) return redirect(303, `${parentData.qrcode}/login`);
|
||||
if (parentData.user === null) return redirect(303, `/${parentData.qrcode}/login`);
|
||||
else {
|
||||
if (!parentData.chargePermission.includes(parentData.qrcode)) {
|
||||
return redirect(303, `${parentData.qrcode}/forbidden`);
|
||||
return redirect(303, `/${parentData.qrcode}/forbidden`);
|
||||
}
|
||||
}
|
||||
if (parentData.chargecontroller.active_charge !== null) return redirect(303, `/${parentData.qrcode}/status`);
|
||||
return parentData;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
<script lang="ts">
|
||||
import * as L from 'leaflet';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import lmiUrl from 'leaflet/dist/images/marker-icon.png';
|
||||
import lmi2Url from 'leaflet/dist/images/marker-icon-2x.png';
|
||||
import lmsUrl from 'leaflet/dist/images/marker-shadow.png';
|
||||
import { onMount, type Snippet } from "svelte";
|
||||
import type { SvelteHTMLElements } from "svelte/elements";
|
||||
|
||||
if (import.meta.env.MODE === 'production') {
|
||||
// Fix bundling bug for leaflet default marker icon on production
|
||||
L.Icon.Default.prototype.options.iconUrl = lmiUrl;
|
||||
L.Icon.Default.prototype.options.iconRetinaUrl = lmi2Url;
|
||||
L.Icon.Default.prototype.options.shadowUrl = lmsUrl;
|
||||
}
|
||||
|
||||
type Props = {
|
||||
x: number,
|
||||
y: number,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="pointer-events-auto bg-red-500/50 h-full w-full flex justify-center items-center">
|
||||
<div class="visible bg-red-500/50 h-full w-full flex justify-center items-center">
|
||||
<div class="card card-border bg-base-100">
|
||||
<div class="card-body items-center">
|
||||
<h2 class="card-title">Forbidden</h2>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
const { message, enhance, submitting } = form;
|
||||
</script>
|
||||
|
||||
<div class="pointer-events-auto bg-gray-300/50 h-full w-full flex justify-center items-center">
|
||||
<div class="visible bg-gray-300/50 h-full w-full flex justify-center items-center">
|
||||
<div class="card bg-base-100 w-fit shadow-md">
|
||||
<form class="card-body" method="POST" use:enhance>
|
||||
<h2 class="card-title">Accesso Utente</h2>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { onMount } from "svelte";
|
||||
import { goto, invalidate } from "$app/navigation";
|
||||
import { scale } from 'svelte/transition';
|
||||
import { addToast } from '$lib/ToastSystem/Toaster.svelte';
|
||||
import BatteryIcon from "$lib/icons/BatteryIcon.svelte";
|
||||
import BSlideOverlay from "$lib/BSlideOverlay.svelte";
|
||||
|
||||
@@ -32,16 +33,40 @@
|
||||
if (stoppingCharge) return;
|
||||
stoppingCharge = true;
|
||||
try {
|
||||
// TODO: StopCharge fetch request
|
||||
console.log("nop");
|
||||
await goto(`/${data.qrcode}`);
|
||||
const response = await fetch(`/api/public/1/chargecontroller/${data.qrcode}/stop_charge/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
});
|
||||
if (response.ok) {
|
||||
addToast({
|
||||
closeDelay: 5000,
|
||||
data: {
|
||||
title: 'Charge Stopped',
|
||||
description: '',
|
||||
type: 'success',
|
||||
}
|
||||
});
|
||||
await invalidate('app:chargecontroller');
|
||||
await goto(`/${data.qrcode}`);
|
||||
} else {
|
||||
addToast({
|
||||
closeDelay: 5000,
|
||||
data: {
|
||||
title: 'Error',
|
||||
description: response.statusText ?? 'unknown',
|
||||
type: 'error',
|
||||
}
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
stoppingCharge = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="pointer-events-auto bg-green-700/80 h-full w-full flex flex-col justify-center items-center gap-12">
|
||||
<div class="visible bg-green-700/80 h-full w-full flex flex-col justify-center items-center gap-12">
|
||||
<div>
|
||||
<BatteryIcon/>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { redirect } from "@sveltejs/kit";
|
||||
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
const parentData = await parent();
|
||||
if (parentData.user === null) return redirect(303, `${parentData.qrcode}/login`);
|
||||
if (parentData.user === null) return redirect(303, `/${parentData.qrcode}/login`);
|
||||
if (parentData.chargecontroller.active_charge === null) return redirect(303, `/${parentData.qrcode}`);
|
||||
return parentData;
|
||||
};
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import adapter from '@sveltejs/adapter-auto';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
import {preprocessMeltUI, sequence} from "@melt-ui/pp";
|
||||
import adapter from '@sveltejs/adapter-node';
|
||||
import {vitePreprocess} from '@sveltejs/vite-plugin-svelte';
|
||||
/** @type {import('@sveltejs/kit').Config}*/
|
||||
const config = {
|
||||
// Consult https://svelte.dev/docs/kit/integrations
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
}
|
||||
// Consult https://svelte.dev/docs/kit/integrations
|
||||
// for more information about preprocessors
|
||||
preprocess: sequence([vitePreprocess(), preprocessMeltUI()]),
|
||||
kit: {
|
||||
adapter: adapter()
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
Reference in New Issue
Block a user