🚨 Fix linting errors
This commit is contained in:
@@ -1,13 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
|
||||||
/build
|
|
||||||
/.svelte-kit
|
|
||||||
/package
|
|
||||||
.env
|
|
||||||
.env.*
|
|
||||||
!.env.example
|
|
||||||
|
|
||||||
# Ignore files for PNPM, NPM and YARN
|
|
||||||
pnpm-lock.yaml
|
|
||||||
package-lock.json
|
|
||||||
yarn.lock
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/** @type { import("eslint").Linter.Config } */
|
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'plugin:svelte/recommended',
|
|
||||||
'prettier'
|
|
||||||
],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
plugins: ['@typescript-eslint'],
|
|
||||||
parserOptions: {
|
|
||||||
sourceType: 'module',
|
|
||||||
ecmaVersion: 2020,
|
|
||||||
extraFileExtensions: ['.svelte']
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2017: true,
|
|
||||||
node: true
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ['*.svelte'],
|
|
||||||
parser: 'svelte-eslint-parser',
|
|
||||||
parserOptions: {
|
|
||||||
parser: '@typescript-eslint/parser'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import ts from 'typescript-eslint'
|
||||||
|
import svelte from 'eslint-plugin-svelte'
|
||||||
|
import prettier from 'eslint-config-prettier'
|
||||||
|
import globals from 'globals'
|
||||||
|
|
||||||
|
export default ts.config(
|
||||||
|
js.configs.recommended,
|
||||||
|
...ts.configs.recommended,
|
||||||
|
...svelte.configs['flat/recommended'],
|
||||||
|
prettier,
|
||||||
|
...svelte.configs['flat/prettier'],
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.node
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.svelte'],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
parser: ts.parser
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'.DS_Store',
|
||||||
|
'node_modules/',
|
||||||
|
'build/',
|
||||||
|
'.svelte-kit/',
|
||||||
|
'package/',
|
||||||
|
'.env',
|
||||||
|
'.env.*',
|
||||||
|
'!.env.example',
|
||||||
|
'pnpm-lock.yaml',
|
||||||
|
'package-lock.json',
|
||||||
|
'yarn.lock'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
"test:unit": "vitest"
|
"test:unit": "vitest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.39.2",
|
||||||
"@iconify-json/mdi": "^1.2.3",
|
"@iconify-json/mdi": "^1.2.3",
|
||||||
"@iconify-json/tabler": "^1.2.23",
|
"@iconify-json/tabler": "^1.2.23",
|
||||||
"@playwright/test": "^1.56.0",
|
"@playwright/test": "^1.56.0",
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
"eslint": "^9.37.0",
|
"eslint": "^9.37.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-svelte": "^3.12.4",
|
"eslint-plugin-svelte": "^3.12.4",
|
||||||
|
"globals": "^17.0.0",
|
||||||
"jsdom": "^27.0.0",
|
"jsdom": "^27.0.0",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-svelte": "^3.4.0",
|
"prettier-plugin-svelte": "^3.4.0",
|
||||||
@@ -39,6 +41,7 @@
|
|||||||
"tailwindcss": "^4.1.14",
|
"tailwindcss": "^4.1.14",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
|
"typescript-eslint": "^8.51.0",
|
||||||
"unplugin-icons": "^22.4.2",
|
"unplugin-icons": "^22.4.2",
|
||||||
"vite": "^7.1.9",
|
"vite": "^7.1.9",
|
||||||
"vitest": "^3.2.4"
|
"vitest": "^3.2.4"
|
||||||
|
|||||||
Generated
+199
@@ -54,6 +54,9 @@ importers:
|
|||||||
specifier: ^0.3.10
|
specifier: ^0.3.10
|
||||||
version: 0.3.10
|
version: 0.3.10
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@eslint/js':
|
||||||
|
specifier: ^9.39.2
|
||||||
|
version: 9.39.2
|
||||||
'@iconify-json/mdi':
|
'@iconify-json/mdi':
|
||||||
specifier: ^1.2.3
|
specifier: ^1.2.3
|
||||||
version: 1.2.3
|
version: 1.2.3
|
||||||
@@ -96,6 +99,9 @@ importers:
|
|||||||
eslint-plugin-svelte:
|
eslint-plugin-svelte:
|
||||||
specifier: ^3.12.4
|
specifier: ^3.12.4
|
||||||
version: 3.12.4(eslint@9.37.0(jiti@2.6.1))(svelte@5.39.11)
|
version: 3.12.4(eslint@9.37.0(jiti@2.6.1))(svelte@5.39.11)
|
||||||
|
globals:
|
||||||
|
specifier: ^17.0.0
|
||||||
|
version: 17.0.0
|
||||||
jsdom:
|
jsdom:
|
||||||
specifier: ^27.0.0
|
specifier: ^27.0.0
|
||||||
version: 27.0.0(postcss@8.5.6)
|
version: 27.0.0(postcss@8.5.6)
|
||||||
@@ -123,6 +129,9 @@ importers:
|
|||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.9.3
|
specifier: ^5.9.3
|
||||||
version: 5.9.3
|
version: 5.9.3
|
||||||
|
typescript-eslint:
|
||||||
|
specifier: ^8.51.0
|
||||||
|
version: 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
unplugin-icons:
|
unplugin-icons:
|
||||||
specifier: ^22.4.2
|
specifier: ^22.4.2
|
||||||
version: 22.4.2(svelte@5.39.11)
|
version: 22.4.2(svelte@5.39.11)
|
||||||
@@ -376,6 +385,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-jaS+NJ+hximswBG6pjNX0uEJZkrT0zwpVi3BA3vX22aFGjJjmgSTSmPpZCRKmoBL5VY/M6p0xsSJx7rk7sy5gg==}
|
resolution: {integrity: sha512-jaS+NJ+hximswBG6pjNX0uEJZkrT0zwpVi3BA3vX22aFGjJjmgSTSmPpZCRKmoBL5VY/M6p0xsSJx7rk7sy5gg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
|
'@eslint/js@9.39.2':
|
||||||
|
resolution: {integrity: sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@eslint/object-schema@2.1.6':
|
'@eslint/object-schema@2.1.6':
|
||||||
resolution: {integrity: sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==}
|
resolution: {integrity: sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -749,6 +762,14 @@ packages:
|
|||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/eslint-plugin@8.51.0':
|
||||||
|
resolution: {integrity: sha512-XtssGWJvypyM2ytBnSnKtHYOGT+4ZwTnBVl36TA4nRO2f4PRNGz5/1OszHzcZCvcBMh+qb7I06uoCmLTRdR9og==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
'@typescript-eslint/parser': ^8.51.0
|
||||||
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.46.0':
|
'@typescript-eslint/parser@8.46.0':
|
||||||
resolution: {integrity: sha512-n1H6IcDhmmUEG7TNVSspGmiHHutt7iVKtZwRppD7e04wha5MrkV1h3pti9xQLcCMt6YWsncpoT0HMjkH1FNwWQ==}
|
resolution: {integrity: sha512-n1H6IcDhmmUEG7TNVSspGmiHHutt7iVKtZwRppD7e04wha5MrkV1h3pti9xQLcCMt6YWsncpoT0HMjkH1FNwWQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -756,22 +777,45 @@ packages:
|
|||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/parser@8.51.0':
|
||||||
|
resolution: {integrity: sha512-3xP4XzzDNQOIqBMWogftkwxhg5oMKApqY0BAflmLZiFYHqyhSOxv/cd/zPQLTcCXr4AkaKb25joocY0BD1WC6A==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/project-service@8.46.0':
|
'@typescript-eslint/project-service@8.46.0':
|
||||||
resolution: {integrity: sha512-OEhec0mH+U5Je2NZOeK1AbVCdm0ChyapAyTeXVIYTPXDJ3F07+cu87PPXcGoYqZ7M9YJVvFnfpGg1UmCIqM+QQ==}
|
resolution: {integrity: sha512-OEhec0mH+U5Je2NZOeK1AbVCdm0ChyapAyTeXVIYTPXDJ3F07+cu87PPXcGoYqZ7M9YJVvFnfpGg1UmCIqM+QQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/project-service@8.51.0':
|
||||||
|
resolution: {integrity: sha512-Luv/GafO07Z7HpiI7qeEW5NW8HUtZI/fo/kE0YbtQEFpJRUuR0ajcWfCE5bnMvL7QQFrmT/odMe8QZww8X2nfQ==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/scope-manager@8.46.0':
|
'@typescript-eslint/scope-manager@8.46.0':
|
||||||
resolution: {integrity: sha512-lWETPa9XGcBes4jqAMYD9fW0j4n6hrPtTJwWDmtqgFO/4HF4jmdH/Q6wggTw5qIT5TXjKzbt7GsZUBnWoO3dqw==}
|
resolution: {integrity: sha512-lWETPa9XGcBes4jqAMYD9fW0j4n6hrPtTJwWDmtqgFO/4HF4jmdH/Q6wggTw5qIT5TXjKzbt7GsZUBnWoO3dqw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
|
'@typescript-eslint/scope-manager@8.51.0':
|
||||||
|
resolution: {integrity: sha512-JhhJDVwsSx4hiOEQPeajGhCWgBMBwVkxC/Pet53EpBVs7zHHtayKefw1jtPaNRXpI9RA2uocdmpdfE7T+NrizA==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/tsconfig-utils@8.46.0':
|
'@typescript-eslint/tsconfig-utils@8.46.0':
|
||||||
resolution: {integrity: sha512-WrYXKGAHY836/N7zoK/kzi6p8tXFhasHh8ocFL9VZSAkvH956gfeRfcnhs3xzRy8qQ/dq3q44v1jvQieMFg2cw==}
|
resolution: {integrity: sha512-WrYXKGAHY836/N7zoK/kzi6p8tXFhasHh8ocFL9VZSAkvH956gfeRfcnhs3xzRy8qQ/dq3q44v1jvQieMFg2cw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/tsconfig-utils@8.51.0':
|
||||||
|
resolution: {integrity: sha512-Qi5bSy/vuHeWyir2C8u/uqGMIlIDu8fuiYWv48ZGlZ/k+PRPHtaAu7erpc7p5bzw2WNNSniuxoMSO4Ar6V9OXw==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.46.0':
|
'@typescript-eslint/type-utils@8.46.0':
|
||||||
resolution: {integrity: sha512-hy+lvYV1lZpVs2jRaEYvgCblZxUoJiPyCemwbQZ+NGulWkQRy0HRPYAoef/CNSzaLt+MLvMptZsHXHlkEilaeg==}
|
resolution: {integrity: sha512-hy+lvYV1lZpVs2jRaEYvgCblZxUoJiPyCemwbQZ+NGulWkQRy0HRPYAoef/CNSzaLt+MLvMptZsHXHlkEilaeg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -779,16 +823,33 @@ packages:
|
|||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/type-utils@8.51.0':
|
||||||
|
resolution: {integrity: sha512-0XVtYzxnobc9K0VU7wRWg1yiUrw4oQzexCG2V2IDxxCxhqBMSMbjB+6o91A+Uc0GWtgjCa3Y8bi7hwI0Tu4n5Q==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/types@8.46.0':
|
'@typescript-eslint/types@8.46.0':
|
||||||
resolution: {integrity: sha512-bHGGJyVjSE4dJJIO5yyEWt/cHyNwga/zXGJbJJ8TiO01aVREK6gCTu3L+5wrkb1FbDkQ+TKjMNe9R/QQQP9+rA==}
|
resolution: {integrity: sha512-bHGGJyVjSE4dJJIO5yyEWt/cHyNwga/zXGJbJJ8TiO01aVREK6gCTu3L+5wrkb1FbDkQ+TKjMNe9R/QQQP9+rA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
|
'@typescript-eslint/types@8.51.0':
|
||||||
|
resolution: {integrity: sha512-TizAvWYFM6sSscmEakjY3sPqGwxZRSywSsPEiuZF6d5GmGD9Gvlsv0f6N8FvAAA0CD06l3rIcWNbsN1e5F/9Ag==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/typescript-estree@8.46.0':
|
'@typescript-eslint/typescript-estree@8.46.0':
|
||||||
resolution: {integrity: sha512-ekDCUfVpAKWJbRfm8T1YRrCot1KFxZn21oV76v5Fj4tr7ELyk84OS+ouvYdcDAwZL89WpEkEj2DKQ+qg//+ucg==}
|
resolution: {integrity: sha512-ekDCUfVpAKWJbRfm8T1YRrCot1KFxZn21oV76v5Fj4tr7ELyk84OS+ouvYdcDAwZL89WpEkEj2DKQ+qg//+ucg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/typescript-estree@8.51.0':
|
||||||
|
resolution: {integrity: sha512-1qNjGqFRmlq0VW5iVlcyHBbCjPB7y6SxpBkrbhNWMy/65ZoncXCEPJxkRZL8McrseNH6lFhaxCIaX+vBuFnRng==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.46.0':
|
'@typescript-eslint/utils@8.46.0':
|
||||||
resolution: {integrity: sha512-nD6yGWPj1xiOm4Gk0k6hLSZz2XkNXhuYmyIrOWcHoPuAhjT9i5bAG+xbWPgFeNR8HPHHtpNKdYUXJl/D3x7f5g==}
|
resolution: {integrity: sha512-nD6yGWPj1xiOm4Gk0k6hLSZz2XkNXhuYmyIrOWcHoPuAhjT9i5bAG+xbWPgFeNR8HPHHtpNKdYUXJl/D3x7f5g==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
@@ -796,10 +857,21 @@ packages:
|
|||||||
eslint: ^8.57.0 || ^9.0.0
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
typescript: '>=4.8.4 <6.0.0'
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
|
'@typescript-eslint/utils@8.51.0':
|
||||||
|
resolution: {integrity: sha512-11rZYxSe0zabiKaCP2QAwRf/dnmgFgvTmeDTtZvUvXG3UuAdg/GU02NExmmIXzz3vLGgMdtrIosI84jITQOxUA==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
'@typescript-eslint/visitor-keys@8.46.0':
|
'@typescript-eslint/visitor-keys@8.46.0':
|
||||||
resolution: {integrity: sha512-FrvMpAK+hTbFy7vH5j1+tMYHMSKLE6RzluFJlkFNKD0p9YsUT75JlBSmr5so3QRzvMwU5/bIEdeNrxm8du8l3Q==}
|
resolution: {integrity: sha512-FrvMpAK+hTbFy7vH5j1+tMYHMSKLE6RzluFJlkFNKD0p9YsUT75JlBSmr5so3QRzvMwU5/bIEdeNrxm8du8l3Q==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
|
'@typescript-eslint/visitor-keys@8.51.0':
|
||||||
|
resolution: {integrity: sha512-mM/JRQOzhVN1ykejrvwnBRV3+7yTKK8tVANVN3o1O0t0v7o+jqdVu9crPy5Y9dov15TJk/FTIgoUGHrTOVL3Zg==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@vitest/expect@3.2.4':
|
'@vitest/expect@3.2.4':
|
||||||
resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}
|
resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}
|
||||||
|
|
||||||
@@ -1220,6 +1292,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==}
|
resolution: {integrity: sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
globals@17.0.0:
|
||||||
|
resolution: {integrity: sha512-gv5BeD2EssA793rlFWVPMMCqefTlpusw6/2TbAVMy0FzcG8wKJn4O+NqJ4+XWmmwrayJgw5TzrmWjFgmz1XPqw==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
graceful-fs@4.2.11:
|
graceful-fs@4.2.11:
|
||||||
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
||||||
|
|
||||||
@@ -1880,6 +1956,12 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4'
|
typescript: '>=4.8.4'
|
||||||
|
|
||||||
|
ts-api-utils@2.4.0:
|
||||||
|
resolution: {integrity: sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==}
|
||||||
|
engines: {node: '>=18.12'}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.8.4'
|
||||||
|
|
||||||
tslib@2.8.1:
|
tslib@2.8.1:
|
||||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||||
|
|
||||||
@@ -1887,6 +1969,13 @@ packages:
|
|||||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
|
|
||||||
|
typescript-eslint@8.51.0:
|
||||||
|
resolution: {integrity: sha512-jh8ZuM5oEh2PSdyQG9YAEM1TCGuWenLSuSUhf/irbVUNW9O5FhbFVONviN2TgMTBnUmyHv7E56rYnfLZK6TkiA==}
|
||||||
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: ^8.57.0 || ^9.0.0
|
||||||
|
typescript: '>=4.8.4 <6.0.0'
|
||||||
|
|
||||||
typescript@5.9.3:
|
typescript@5.9.3:
|
||||||
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
@@ -2293,6 +2382,8 @@ snapshots:
|
|||||||
|
|
||||||
'@eslint/js@9.37.0': {}
|
'@eslint/js@9.37.0': {}
|
||||||
|
|
||||||
|
'@eslint/js@9.39.2': {}
|
||||||
|
|
||||||
'@eslint/object-schema@2.1.6': {}
|
'@eslint/object-schema@2.1.6': {}
|
||||||
|
|
||||||
'@eslint/plugin-kit@0.4.0':
|
'@eslint/plugin-kit@0.4.0':
|
||||||
@@ -2629,6 +2720,22 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@typescript-eslint/eslint-plugin@8.51.0(@typescript-eslint/parser@8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
'@eslint-community/regexpp': 4.12.1
|
||||||
|
'@typescript-eslint/parser': 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/scope-manager': 8.51.0
|
||||||
|
'@typescript-eslint/type-utils': 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/utils': 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/visitor-keys': 8.51.0
|
||||||
|
eslint: 9.37.0(jiti@2.6.1)
|
||||||
|
ignore: 7.0.5
|
||||||
|
natural-compare: 1.4.0
|
||||||
|
ts-api-utils: 2.4.0(typescript@5.9.3)
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.46.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
'@typescript-eslint/parser@8.46.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/scope-manager': 8.46.0
|
'@typescript-eslint/scope-manager': 8.46.0
|
||||||
@@ -2641,6 +2748,18 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@typescript-eslint/parser@8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/scope-manager': 8.51.0
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
'@typescript-eslint/typescript-estree': 8.51.0(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/visitor-keys': 8.51.0
|
||||||
|
debug: 4.4.3
|
||||||
|
eslint: 9.37.0(jiti@2.6.1)
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/project-service@8.46.0(typescript@5.9.3)':
|
'@typescript-eslint/project-service@8.46.0(typescript@5.9.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/tsconfig-utils': 8.46.0(typescript@5.9.3)
|
'@typescript-eslint/tsconfig-utils': 8.46.0(typescript@5.9.3)
|
||||||
@@ -2650,15 +2769,33 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@typescript-eslint/project-service@8.51.0(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/tsconfig-utils': 8.51.0(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
debug: 4.4.3
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/scope-manager@8.46.0':
|
'@typescript-eslint/scope-manager@8.46.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.46.0
|
'@typescript-eslint/types': 8.46.0
|
||||||
'@typescript-eslint/visitor-keys': 8.46.0
|
'@typescript-eslint/visitor-keys': 8.46.0
|
||||||
|
|
||||||
|
'@typescript-eslint/scope-manager@8.51.0':
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
'@typescript-eslint/visitor-keys': 8.51.0
|
||||||
|
|
||||||
'@typescript-eslint/tsconfig-utils@8.46.0(typescript@5.9.3)':
|
'@typescript-eslint/tsconfig-utils@8.46.0(typescript@5.9.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.9.3
|
typescript: 5.9.3
|
||||||
|
|
||||||
|
'@typescript-eslint/tsconfig-utils@8.51.0(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
typescript: 5.9.3
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.46.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
'@typescript-eslint/type-utils@8.46.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.46.0
|
'@typescript-eslint/types': 8.46.0
|
||||||
@@ -2671,8 +2808,22 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@typescript-eslint/type-utils@8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
'@typescript-eslint/typescript-estree': 8.51.0(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/utils': 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
debug: 4.4.3
|
||||||
|
eslint: 9.37.0(jiti@2.6.1)
|
||||||
|
ts-api-utils: 2.4.0(typescript@5.9.3)
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/types@8.46.0': {}
|
'@typescript-eslint/types@8.46.0': {}
|
||||||
|
|
||||||
|
'@typescript-eslint/types@8.51.0': {}
|
||||||
|
|
||||||
'@typescript-eslint/typescript-estree@8.46.0(typescript@5.9.3)':
|
'@typescript-eslint/typescript-estree@8.46.0(typescript@5.9.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/project-service': 8.46.0(typescript@5.9.3)
|
'@typescript-eslint/project-service': 8.46.0(typescript@5.9.3)
|
||||||
@@ -2689,6 +2840,21 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@typescript-eslint/typescript-estree@8.51.0(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/project-service': 8.51.0(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/tsconfig-utils': 8.51.0(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
'@typescript-eslint/visitor-keys': 8.51.0
|
||||||
|
debug: 4.4.3
|
||||||
|
minimatch: 9.0.5
|
||||||
|
semver: 7.7.3
|
||||||
|
tinyglobby: 0.2.15
|
||||||
|
ts-api-utils: 2.4.0(typescript@5.9.3)
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.46.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
'@typescript-eslint/utils@8.46.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.9.0(eslint@9.37.0(jiti@2.6.1))
|
'@eslint-community/eslint-utils': 4.9.0(eslint@9.37.0(jiti@2.6.1))
|
||||||
@@ -2700,11 +2866,27 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
'@typescript-eslint/utils@8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)':
|
||||||
|
dependencies:
|
||||||
|
'@eslint-community/eslint-utils': 4.9.0(eslint@9.37.0(jiti@2.6.1))
|
||||||
|
'@typescript-eslint/scope-manager': 8.51.0
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
'@typescript-eslint/typescript-estree': 8.51.0(typescript@5.9.3)
|
||||||
|
eslint: 9.37.0(jiti@2.6.1)
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/visitor-keys@8.46.0':
|
'@typescript-eslint/visitor-keys@8.46.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.46.0
|
'@typescript-eslint/types': 8.46.0
|
||||||
eslint-visitor-keys: 4.2.1
|
eslint-visitor-keys: 4.2.1
|
||||||
|
|
||||||
|
'@typescript-eslint/visitor-keys@8.51.0':
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/types': 8.51.0
|
||||||
|
eslint-visitor-keys: 4.2.1
|
||||||
|
|
||||||
'@vitest/expect@3.2.4':
|
'@vitest/expect@3.2.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/chai': 5.2.2
|
'@types/chai': 5.2.2
|
||||||
@@ -3142,6 +3324,8 @@ snapshots:
|
|||||||
|
|
||||||
globals@16.4.0: {}
|
globals@16.4.0: {}
|
||||||
|
|
||||||
|
globals@17.0.0: {}
|
||||||
|
|
||||||
graceful-fs@4.2.11: {}
|
graceful-fs@4.2.11: {}
|
||||||
|
|
||||||
graphemer@1.4.0: {}
|
graphemer@1.4.0: {}
|
||||||
@@ -3734,12 +3918,27 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.9.3
|
typescript: 5.9.3
|
||||||
|
|
||||||
|
ts-api-utils@2.4.0(typescript@5.9.3):
|
||||||
|
dependencies:
|
||||||
|
typescript: 5.9.3
|
||||||
|
|
||||||
tslib@2.8.1: {}
|
tslib@2.8.1: {}
|
||||||
|
|
||||||
type-check@0.4.0:
|
type-check@0.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
prelude-ls: 1.2.1
|
prelude-ls: 1.2.1
|
||||||
|
|
||||||
|
typescript-eslint@8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3):
|
||||||
|
dependencies:
|
||||||
|
'@typescript-eslint/eslint-plugin': 8.51.0(@typescript-eslint/parser@8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/parser': 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/typescript-estree': 8.51.0(typescript@5.9.3)
|
||||||
|
'@typescript-eslint/utils': 8.51.0(eslint@9.37.0(jiti@2.6.1))(typescript@5.9.3)
|
||||||
|
eslint: 9.37.0(jiti@2.6.1)
|
||||||
|
typescript: 5.9.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
typescript@5.9.3: {}
|
typescript@5.9.3: {}
|
||||||
|
|
||||||
ufo@1.6.1: {}
|
ufo@1.6.1: {}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { get } from 'svelte/store'
|
import { get } from 'svelte/store'
|
||||||
import { Err, Ok, type Result } from './utilities'
|
import { Err, Ok, type Result } from './utilities'
|
||||||
import { apiLocation } from './stores'
|
import { apiLocation } from './stores/location-store'
|
||||||
|
|
||||||
export const api = {
|
export const api = {
|
||||||
get<TResponse>(endpoint: string, params?: RequestInit) {
|
get<TResponse>(endpoint: string, params?: RequestInit) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ComponentType } from 'svelte'
|
import type { Component } from 'svelte'
|
||||||
|
|
||||||
type Variant = 'success' | 'error' | 'primary' | 'info' | 'warning'
|
type Variant = 'success' | 'error' | 'primary' | 'info' | 'warning'
|
||||||
|
|
||||||
@@ -11,12 +11,12 @@
|
|||||||
class: klass = '',
|
class: klass = '',
|
||||||
children = null
|
children = null
|
||||||
} = $props<{
|
} = $props<{
|
||||||
icon?: ComponentType
|
icon?: Component
|
||||||
title: string
|
title: string
|
||||||
description?: string | number
|
description?: string | number
|
||||||
variant?: Variant
|
variant?: Variant
|
||||||
class?: string
|
class?: string
|
||||||
children?: () => ComponentType
|
children?: () => Component
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const Icon = $derived(icon)
|
const Icon = $derived(icon)
|
||||||
|
|||||||
@@ -119,7 +119,6 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
canvas.remove()
|
|
||||||
gui_panel?.destroy()
|
gui_panel?.destroy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
max?: number
|
max?: number
|
||||||
step?: number
|
step?: number
|
||||||
value?: number
|
value?: number
|
||||||
oninput?: (value: number) => void
|
oninput?: (value: Event) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
import { Github } from '../icons'
|
import { Github } from '../icons'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
github: { url: string; version: string; active?: boolean; href?: string }
|
github: { href: string; active?: boolean }
|
||||||
}
|
}
|
||||||
|
|
||||||
let { github }: Props = $props()
|
let { github }: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if github.active}
|
{#if github.active}
|
||||||
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- external URL -->
|
||||||
<a href={github.href} class="btn btn-ghost" target="_blank" rel="noopener noreferrer">
|
<a href={github.href} class="btn btn-ghost" target="_blank" rel="noopener noreferrer">
|
||||||
<Github class="h-5 w-5" />
|
<Github class="h-5 w-5" />
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import { base } from '$app/paths'
|
import { resolve } from '$app/paths'
|
||||||
import { useFeatureFlags } from '$lib/stores/featureFlags'
|
import { useFeatureFlags } from '$lib/stores/featureFlags'
|
||||||
import GithubButton from '../menu/GithubButton.svelte'
|
import GithubButton from '../menu/GithubButton.svelte'
|
||||||
import LogoButton from '../menu/LogoButton.svelte'
|
import LogoButton from '../menu/LogoButton.svelte'
|
||||||
@@ -33,11 +33,11 @@
|
|||||||
|
|
||||||
const github = { href: 'https://github.com/' + page.data.github, active: true }
|
const github = { href: 'https://github.com/' + page.data.github, active: true }
|
||||||
|
|
||||||
import type { ComponentType } from 'svelte'
|
import type { Component } from 'svelte'
|
||||||
|
|
||||||
type menuItem = {
|
type menuItem = {
|
||||||
title: string
|
title: string
|
||||||
icon: ComponentType
|
icon: Component
|
||||||
href?: string
|
href?: string
|
||||||
feature: boolean
|
feature: boolean
|
||||||
active?: boolean
|
active?: boolean
|
||||||
@@ -45,13 +45,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function withBase(path: string) {
|
function withBase(path: string) {
|
||||||
return `${base}${path.startsWith('/') ? path : '/' + path}`
|
return `${resolve('/')}${path.startsWith('/') ? path.slice(1) : path}`
|
||||||
}
|
}
|
||||||
|
|
||||||
let menuItems = $state<menuItem[]>([])
|
const { menuClicked } = $props()
|
||||||
|
|
||||||
$effect(() => {
|
const activeTitle = $derived(page.data.title)
|
||||||
menuItems = [
|
|
||||||
|
const menuItems = $derived<menuItem[]>(
|
||||||
|
[
|
||||||
{
|
{
|
||||||
title: 'Connection',
|
title: 'Connection',
|
||||||
icon: WiFi,
|
icon: WiFi,
|
||||||
@@ -79,7 +81,7 @@
|
|||||||
title: 'Camera',
|
title: 'Camera',
|
||||||
icon: Camera,
|
icon: Camera,
|
||||||
href: withBase('/peripherals/camera'),
|
href: withBase('/peripherals/camera'),
|
||||||
feature: $features.camera
|
feature: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Servo',
|
title: 'Servo',
|
||||||
@@ -91,9 +93,9 @@
|
|||||||
title: 'IMU',
|
title: 'IMU',
|
||||||
icon: Rotate3d,
|
icon: Rotate3d,
|
||||||
href: withBase('/peripherals/imu'),
|
href: withBase('/peripherals/imu'),
|
||||||
feature: $features.imu || $features.mag || $features.bmp
|
feature: true
|
||||||
}
|
}
|
||||||
]
|
].map(sub => ({ ...sub, active: sub.title === activeTitle }))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'WiFi',
|
title: 'WiFi',
|
||||||
@@ -118,7 +120,7 @@
|
|||||||
href: withBase('/wifi/mdns'),
|
href: withBase('/wifi/mdns'),
|
||||||
feature: true
|
feature: true
|
||||||
}
|
}
|
||||||
]
|
].map(sub => ({ ...sub, active: sub.title === activeTitle }))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'System',
|
title: 'System',
|
||||||
@@ -147,36 +149,20 @@
|
|||||||
title: 'Firmware Update',
|
title: 'Firmware Update',
|
||||||
icon: Update,
|
icon: Update,
|
||||||
href: withBase('/system/update'),
|
href: withBase('/system/update'),
|
||||||
feature:
|
feature: !!(
|
||||||
$features.ota ||
|
$features.ota ||
|
||||||
$features.upload_firmware ||
|
$features.upload_firmware ||
|
||||||
$features.download_firmware
|
$features.download_firmware
|
||||||
|
)
|
||||||
}
|
}
|
||||||
]
|
].map(sub => ({ ...sub, active: sub.title === activeTitle }))
|
||||||
}
|
}
|
||||||
] as menuItem[]
|
].map(item => ({ ...item, active: item.title === activeTitle }))
|
||||||
})
|
)
|
||||||
|
|
||||||
const { menuClicked } = $props()
|
const updateMenu = () => {
|
||||||
|
|
||||||
function setActiveMenuItem(targetTitle: string) {
|
|
||||||
menuItems.forEach(item => {
|
|
||||||
item.active = item.title === targetTitle
|
|
||||||
item.submenu?.forEach(subItem => {
|
|
||||||
subItem.active = subItem.title === targetTitle
|
|
||||||
})
|
|
||||||
})
|
|
||||||
menuItems = menuItems
|
|
||||||
menuClicked()
|
menuClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
$effect(() => {
|
|
||||||
setActiveMenuItem(page.data.title)
|
|
||||||
})
|
|
||||||
|
|
||||||
const updateMenu = (event: CustomEvent) => {
|
|
||||||
setActiveMenuItem(event.details)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex h-full w-80 flex-col p-4 bg-base-200 text-base-content">
|
<div class="flex h-full w-80 flex-col p-4 bg-base-200 text-base-content">
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import MenuList from './MenuList.svelte'
|
import MenuList from './MenuList.svelte'
|
||||||
import type { ComponentType } from 'svelte'
|
import type { Component } from 'svelte'
|
||||||
|
|
||||||
type MenuItem = {
|
type MenuItem = {
|
||||||
title: string
|
title: string
|
||||||
icon: ComponentType
|
icon: Component
|
||||||
href?: string
|
href?: string
|
||||||
feature: boolean
|
feature: boolean
|
||||||
active?: boolean
|
active?: boolean
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve --><a
|
||||||
href={menuItem.href}
|
href={menuItem.href}
|
||||||
class="font-bold"
|
class="font-bold"
|
||||||
class:bg-base-100={menuItem.active}
|
class:bg-base-100={menuItem.active}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
{...rest}
|
{...rest}
|
||||||
class="select select-bordered select-sm lg:select-md max-w-xs {rest.class || ''}"
|
class="select select-bordered select-sm lg:select-md max-w-xs {rest.class || ''}"
|
||||||
>
|
>
|
||||||
{#each options as option}
|
{#each options as option (option)}
|
||||||
<option value={option}>{option}</option>
|
<option value={option}>{option}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ export const isFullscreen = writable(false)
|
|||||||
|
|
||||||
export function toggleFullscreen() {
|
export function toggleFullscreen() {
|
||||||
isFullscreen.update(state => {
|
isFullscreen.update(state => {
|
||||||
!state ? document.documentElement.requestFullscreen() : document.exitFullscreen()
|
if (!state) document.documentElement.requestFullscreen()
|
||||||
|
else document.exitFullscreen()
|
||||||
return !state
|
return !state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const cacheModelFiles = async () => {
|
|||||||
|
|
||||||
for (const [path, data] of Object.entries(files) as [path: string, data: Uint8Array][]) {
|
for (const [path, data] of Object.entries(files) as [path: string, data: Uint8Array][]) {
|
||||||
const normalizedPath = path.startsWith('/') ? path : '/' + path
|
const normalizedPath = path.startsWith('/') ? path : '/' + path
|
||||||
const resolvedUrl = resolve(normalizedPath as any)
|
const resolvedUrl = `${resolve('/')}${normalizedPath}`
|
||||||
fileService?.saveFile(resolvedUrl, data)
|
fileService?.saveFile(resolvedUrl, data)
|
||||||
fileService?.saveFile(normalizedPath, data)
|
fileService?.saveFile(normalizedPath, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ const registerFetchIntercept = async () => {
|
|||||||
const pathOnly = urlObj.pathname
|
const pathOnly = urlObj.pathname
|
||||||
file = await fileService?.getFile(pathOnly)
|
file = await fileService?.getFile(pathOnly)
|
||||||
if (file?.isOk() && file.inner) return new Response(new Uint8Array(file.inner))
|
if (file?.isOk() && file.inner) return new Response(new Uint8Array(file.inner))
|
||||||
} catch {}
|
} catch {
|
||||||
|
console.error('Failed to get file for ', url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return originalFetch(resource, config)
|
return originalFetch(resource, config)
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
class="flex items-end gap-4 backdrop-blur-sm bg-base-300/60 h-min rounded-tr-2xl pl-0 p-3 border-t border-r border-base-content/5 pointer-events-auto"
|
class="flex items-end gap-4 backdrop-blur-sm bg-base-300/60 h-min rounded-tr-2xl pl-0 p-3 border-t border-r border-base-content/5 pointer-events-auto"
|
||||||
>
|
>
|
||||||
<div class="join shadow-lg">
|
<div class="join shadow-lg">
|
||||||
{#each modes as modeValue}
|
{#each modes as modeValue (modeValue)}
|
||||||
<button
|
<button
|
||||||
class="btn join-item btn-sm transition-all duration-200"
|
class="btn join-item btn-sm transition-all duration-200"
|
||||||
class:btn-primary={$mode === modes.indexOf(modeValue)}
|
class:btn-primary={$mode === modes.indexOf(modeValue)}
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
|
|
||||||
{#if $mode === ModesEnum.Walk}
|
{#if $mode === ModesEnum.Walk}
|
||||||
<div class="join shadow-md">
|
<div class="join shadow-md">
|
||||||
{#each Object.values(WalkGaits) as gaitValue}
|
{#each Object.values(WalkGaits) as gaitValue (gaitValue)}
|
||||||
{#if typeof gaitValue === 'number'}
|
{#if typeof gaitValue === 'number'}
|
||||||
<button
|
<button
|
||||||
class="btn join-item btn-xs transition-all duration-200"
|
class="btn join-item btn-xs transition-all duration-200"
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
{#if active_devices.length === 0}
|
{#if active_devices.length === 0}
|
||||||
<div>No I2C devices found</div>
|
<div>No I2C devices found</div>
|
||||||
{:else}
|
{:else}
|
||||||
{#each active_devices as device}
|
{#each active_devices as device (device.address)}
|
||||||
<div>[{device.address.toString(16)}] {device.part_number} - {device.name}</div>
|
<div>[{device.address.toString(16)}] {device.part_number} - {device.name}</div>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -252,7 +252,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
{#if calibrationResult}
|
{#if calibrationResult}
|
||||||
<span class="badge" class:badge-success={calibrationResult.success} class:badge-error={!calibrationResult.success}>
|
<span
|
||||||
|
class="badge"
|
||||||
|
class:badge-success={calibrationResult.success}
|
||||||
|
class:badge-error={!calibrationResult.success}
|
||||||
|
>
|
||||||
{calibrationResult.success ? 'Calibrated' : 'Failed'}
|
{calibrationResult.success ? 'Calibrated' : 'Failed'}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each data.servos as servo, index}
|
{#each data.servos as servo, index (index)}
|
||||||
<tr class="hover:bg-base-200">
|
<tr class="hover:bg-base-200">
|
||||||
<td class="font-medium">Servo {index}</td>
|
<td class="font-medium">Servo {index}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
{#if expanded}
|
{#if expanded}
|
||||||
<ul class="ml-4 border-l border-gray-600 mt-1">
|
<ul class="ml-4 border-l border-gray-600 mt-1">
|
||||||
{#each Object.entries(files) as [itemName, content]}
|
{#each Object.entries(files) as [itemName, content] (itemName)}
|
||||||
<li class="py-1">
|
<li class="py-1">
|
||||||
{#if typeof content === 'object'}
|
{#if typeof content === 'object'}
|
||||||
<Folder name={itemName} files={content} {selected} {onDelete} />
|
<Folder name={itemName} files={content} {selected} {onDelete} />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy, onMount } from 'svelte'
|
||||||
import type { ComponentType } from 'svelte'
|
import type { Component } from 'svelte'
|
||||||
import { modals } from 'svelte-modals'
|
import { modals } from 'svelte-modals'
|
||||||
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte'
|
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte'
|
||||||
import SettingsCard from '$lib/components/SettingsCard.svelte'
|
import SettingsCard from '$lib/components/SettingsCard.svelte'
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ActionButtonDef {
|
interface ActionButtonDef {
|
||||||
icon: ComponentType
|
icon: Component
|
||||||
label: string
|
label: string
|
||||||
onClick: () => void
|
onClick: () => void
|
||||||
type?: string
|
type?: string
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4 flex flex-wrap justify-end gap-2">
|
<div class="mt-4 flex flex-wrap justify-end gap-2">
|
||||||
{#each actionButtons as button}
|
{#each actionButtons as button (button.label)}
|
||||||
{#if button.condition === undefined || button.condition()}
|
{#if button.condition === undefined || button.condition()}
|
||||||
<ActionButton
|
<ActionButton
|
||||||
onclick={button.onClick}
|
onclick={button.onClick}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each githubReleases as release}
|
{#each githubReleases as release (release.tag_name)}
|
||||||
<tr
|
<tr
|
||||||
class={(
|
class={(
|
||||||
compareVersions(
|
compareVersions(
|
||||||
@@ -119,8 +119,8 @@
|
|||||||
'bg-primary text-primary-content'
|
'bg-primary text-primary-content'
|
||||||
: 'bg-base-100 h-14'}
|
: 'bg-base-100 h-14'}
|
||||||
>
|
>
|
||||||
<td align="left" class="text-base font-semibold">
|
<td align="left" class="text-base font-semibold"
|
||||||
<a
|
><!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- external URL --><a
|
||||||
href={release.html_url}
|
href={release.html_url}
|
||||||
class="link link-hover"
|
class="link link-hover"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { preventDefault } from 'svelte/legacy'
|
|
||||||
|
|
||||||
import { onMount, onDestroy } from 'svelte'
|
import { onMount, onDestroy } from 'svelte'
|
||||||
import { slide } from 'svelte/transition'
|
import { slide } from 'svelte/transition'
|
||||||
import { cubicOut } from 'svelte/easing'
|
import { cubicOut } from 'svelte/easing'
|
||||||
@@ -16,7 +14,7 @@
|
|||||||
let apSettings: ApSettings | null = $state(null)
|
let apSettings: ApSettings | null = $state(null)
|
||||||
let apStatus: ApStatus | null = $state(null)
|
let apStatus: ApStatus | null = $state(null)
|
||||||
|
|
||||||
let formField: Record<string, unknown> = $state()
|
let formField: Record<string, unknown> = $state({})
|
||||||
|
|
||||||
async function getAPStatus() {
|
async function getAPStatus() {
|
||||||
const result = await api.get<ApStatus>('/api/wifi/ap/status')
|
const result = await api.get<ApStatus>('/api/wifi/ap/status')
|
||||||
@@ -87,7 +85,8 @@
|
|||||||
apSettings = result.inner
|
apSettings = result.inner
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSubmitAP() {
|
function handleSubmitAP(e: Event) {
|
||||||
|
e.preventDefault()
|
||||||
if (!apSettings) return
|
if (!apSettings) return
|
||||||
let valid = true
|
let valid = true
|
||||||
|
|
||||||
@@ -205,7 +204,7 @@
|
|||||||
>
|
>
|
||||||
<form
|
<form
|
||||||
class="grid w-full grid-cols-1 content-center gap-x-4 p-0s sm:grid-cols-2"
|
class="grid w-full grid-cols-1 content-center gap-x-4 p-0s sm:grid-cols-2"
|
||||||
onsubmit={preventDefault(handleSubmitAP)}
|
onsubmit={handleSubmitAP}
|
||||||
novalidate
|
novalidate
|
||||||
bind:this={formField}
|
bind:this={formField}
|
||||||
>
|
>
|
||||||
@@ -218,7 +217,7 @@
|
|||||||
id="apmode"
|
id="apmode"
|
||||||
bind:value={apSettings.provision_mode}
|
bind:value={apSettings.provision_mode}
|
||||||
>
|
>
|
||||||
{#each provisionMode as mode}
|
{#each provisionMode as mode (mode.id)}
|
||||||
<option value={mode.id}>
|
<option value={mode.id}>
|
||||||
{mode.text}
|
{mode.text}
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each services as service}
|
{#each services as service (service.ip)}
|
||||||
<tr>
|
<tr>
|
||||||
<td><Devices class="h-6 w-6" /></td>
|
<td><Devices class="h-6 w-6" /></td>
|
||||||
<td>{service.name}</td>
|
<td>{service.name}</td>
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
{#each listOfNetworks as network}
|
{#each listOfNetworks as network (network.ssid)}
|
||||||
<li>
|
<li>
|
||||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { expect, test } from '@playwright/test'
|
import { expect, test } from '@playwright/test'
|
||||||
|
|
||||||
test('has title', async ({ page }) => {
|
test('has title', async ({ page }) => {
|
||||||
await page.goto('/')
|
await page.goto('/')
|
||||||
await expect(page).toHaveTitle(/Spot micro controller/)
|
await expect(page).toHaveTitle(/Spot micro controller/)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('index page has expected h1', async ({ page }) => {
|
test('index page has expected h1', async ({ page }) => {
|
||||||
await page.goto('/')
|
await page.goto('/')
|
||||||
await expect(page.getByRole('heading', { name: 'Spot micro controller' }).first()).toBeVisible()
|
await expect(page.getByRole('heading', { name: 'Spot micro controller' }).first()).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest'
|
||||||
import { humanFileSize } from '../../src/lib/utilities/string-utilities';
|
import { humanFileSize } from '../../src/lib/utilities/string-utilities'
|
||||||
|
|
||||||
describe('humanFileSize', () => {
|
describe('humanFileSize', () => {
|
||||||
it('returns "0B" for 0 bytes', () => {
|
it('returns "0B" for 0 bytes', () => {
|
||||||
expect(humanFileSize(0)).toBe('0B');
|
expect(humanFileSize(0)).toBe('0B')
|
||||||
});
|
})
|
||||||
|
|
||||||
it('returns the size in bytes correctly', () => {
|
it('returns the size in bytes correctly', () => {
|
||||||
expect(humanFileSize(500)).toBe('500B');
|
expect(humanFileSize(500)).toBe('500B')
|
||||||
});
|
})
|
||||||
|
|
||||||
it('returns the size in kB correctly', () => {
|
it('returns the size in kB correctly', () => {
|
||||||
expect(humanFileSize(1024)).toBe('1kB');
|
expect(humanFileSize(1024)).toBe('1kB')
|
||||||
});
|
})
|
||||||
|
|
||||||
it('returns the size in MB correctly', () => {
|
it('returns the size in MB correctly', () => {
|
||||||
expect(humanFileSize(1048576)).toBe('1MB'); // 1024 * 1024
|
expect(humanFileSize(1048576)).toBe('1MB') // 1024 * 1024
|
||||||
});
|
})
|
||||||
|
|
||||||
it('returns the size in GB correctly', () => {
|
it('returns the size in GB correctly', () => {
|
||||||
expect(humanFileSize(1073741824)).toBe('1GB'); // 1024 * 1024 * 1024
|
expect(humanFileSize(1073741824)).toBe('1GB') // 1024 * 1024 * 1024
|
||||||
});
|
})
|
||||||
|
|
||||||
it('rounds to 2 decimal places correctly', () => {
|
it('rounds to 2 decimal places correctly', () => {
|
||||||
expect(humanFileSize(1536)).toBe('1.5kB'); // 1024 + 512
|
expect(humanFileSize(1536)).toBe('1.5kB') // 1024 + 512
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest'
|
||||||
import { toUint8, toInt8 } from '../../src/lib/utilities/math-utilities';
|
import { toUint8, toInt8 } from '../../src/lib/utilities/math-utilities'
|
||||||
|
|
||||||
describe('toUint8', () => {
|
describe('toUint8', () => {
|
||||||
it('min interval value should get 0', () => {
|
it('min interval value should get 0', () => {
|
||||||
expect(toUint8(-1, -1, 1)).toBe(0);
|
expect(toUint8(-1, -1, 1)).toBe(0)
|
||||||
});
|
})
|
||||||
it('middle interval value should get 128', () => {
|
it('middle interval value should get 128', () => {
|
||||||
expect(toUint8(0, -1, 1)).toBe(128);
|
expect(toUint8(0, -1, 1)).toBe(128)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('max interval value should get 255', () => {
|
it('max interval value should get 255', () => {
|
||||||
expect(toUint8(1, -1, 1)).toBe(255);
|
expect(toUint8(1, -1, 1)).toBe(255)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('min value should be clamped', () => {
|
it('min value should be clamped', () => {
|
||||||
expect(toUint8(-2, -1, 1)).toBe(0);
|
expect(toUint8(-2, -1, 1)).toBe(0)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('max value should be clamped', () => {
|
it('max value should be clamped', () => {
|
||||||
expect(toUint8(2, -1, 1)).toBe(255);
|
expect(toUint8(2, -1, 1)).toBe(255)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
describe('toInt8', () => {
|
describe('toInt8', () => {
|
||||||
it('min interval value should get -128', () => {
|
it('min interval value should get -128', () => {
|
||||||
expect(toInt8(-1, -1, 1)).toBe(-128);
|
expect(toInt8(-1, -1, 1)).toBe(-128)
|
||||||
});
|
})
|
||||||
it('middle interval value should get 0', () => {
|
it('middle interval value should get 0', () => {
|
||||||
expect(toInt8(0, -1, 1)).toBe(0);
|
expect(toInt8(0, -1, 1)).toBe(0)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('max interval value should get 127', () => {
|
it('max interval value should get 127', () => {
|
||||||
expect(toInt8(1, -1, 1)).toBe(127);
|
expect(toInt8(1, -1, 1)).toBe(127)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('min value should be clamped', () => {
|
it('min value should be clamped', () => {
|
||||||
expect(toInt8(-2, -1, 1)).toBe(-128);
|
expect(toInt8(-2, -1, 1)).toBe(-128)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('max value should be clamped', () => {
|
it('max value should be clamped', () => {
|
||||||
expect(toInt8(2, -1, 1)).toBe(127);
|
expect(toInt8(2, -1, 1)).toBe(127)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest'
|
||||||
import { Result } from '../../src/lib/utilities/result';
|
import { Result } from '../../src/lib/utilities/result'
|
||||||
|
|
||||||
describe('Result', () => {
|
describe('Result', () => {
|
||||||
it('should create a success result correctly', () => {
|
it('should create a success result correctly', () => {
|
||||||
const successValue = 'Success value';
|
const successValue = 'Success value'
|
||||||
const result = Result.ok(successValue);
|
const result = Result.ok(successValue)
|
||||||
|
|
||||||
expect(result.isOk()).toBe(true);
|
expect(result.isOk()).toBe(true)
|
||||||
expect(result.isErr()).toBe(false);
|
expect(result.isErr()).toBe(false)
|
||||||
expect(result.inner).toBe(successValue);
|
expect(result.inner).toBe(successValue)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should create an error result correctly', () => {
|
it('should create an error result correctly', () => {
|
||||||
const errorMessage = 'Error message';
|
const errorMessage = 'Error message'
|
||||||
const result = Result.err(errorMessage);
|
const result = Result.err(errorMessage)
|
||||||
|
|
||||||
expect(result.isOk()).toBe(false);
|
expect(result.isOk()).toBe(false)
|
||||||
expect(result.isErr()).toBe(true);
|
expect(result.isErr()).toBe(true)
|
||||||
expect(result.inner).toBe(errorMessage);
|
expect(result.inner).toBe(errorMessage)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should type guard success and error results correctly', () => {
|
it('should type guard success and error results correctly', () => {
|
||||||
const successResult = Result.ok(123);
|
const successResult = Result.ok(123)
|
||||||
const errorResult = Result.err('Error');
|
const errorResult = Result.err('Error')
|
||||||
|
|
||||||
if (successResult.isOk()) {
|
if (successResult.isOk()) {
|
||||||
expect(typeof successResult.inner).toBe('number');
|
expect(typeof successResult.inner).toBe('number')
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Expected successResult to be ok');
|
throw new Error('Expected successResult to be ok')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorResult.isErr()) {
|
if (errorResult.isErr()) {
|
||||||
expect(typeof errorResult.inner).toBe('string');
|
expect(typeof errorResult.inner).toBe('string')
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Expected errorResult to be fail');
|
throw new Error('Expected errorResult to be fail')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,46 +1,46 @@
|
|||||||
import { describe, it, expect, beforeEach, afterEach, vitest } from 'vitest';
|
import { describe, it, expect, beforeEach, afterEach, vitest } from 'vitest'
|
||||||
import { throttler } from '../../src/lib/utilities/buffer-utilities';
|
import { throttler } from '../../src/lib/utilities/buffer-utilities'
|
||||||
|
|
||||||
describe('throttler', () => {
|
describe('throttler', () => {
|
||||||
let throttleInstance: throttler;
|
let throttleInstance: throttler
|
||||||
let callback: Function;
|
let callback: () => void
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vitest.useFakeTimers();
|
vitest.useFakeTimers()
|
||||||
throttleInstance = new throttler();
|
throttleInstance = new throttler()
|
||||||
callback = vitest.fn();
|
callback = vitest.fn()
|
||||||
});
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
vitest.useRealTimers();
|
vitest.useRealTimers()
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should call the callback function after the specified time', () => {
|
it('should call the callback function after the specified time', () => {
|
||||||
throttleInstance.throttle(callback, 1000);
|
throttleInstance.throttle(callback, 1000)
|
||||||
expect(callback).not.toHaveBeenCalled();
|
expect(callback).not.toHaveBeenCalled()
|
||||||
|
|
||||||
vitest.advanceTimersByTime(1000);
|
vitest.advanceTimersByTime(1000)
|
||||||
expect(callback).toHaveBeenCalledTimes(1);
|
expect(callback).toHaveBeenCalledTimes(1)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should not call the callback function if throttle is called again within the timeout period', () => {
|
it('should not call the callback function if throttle is called again within the timeout period', () => {
|
||||||
throttleInstance.throttle(callback, 1000);
|
throttleInstance.throttle(callback, 1000)
|
||||||
throttleInstance.throttle(callback, 1000);
|
throttleInstance.throttle(callback, 1000)
|
||||||
|
|
||||||
vitest.advanceTimersByTime(500);
|
vitest.advanceTimersByTime(500)
|
||||||
expect(callback).not.toHaveBeenCalled();
|
expect(callback).not.toHaveBeenCalled()
|
||||||
|
|
||||||
vitest.advanceTimersByTime(500);
|
vitest.advanceTimersByTime(500)
|
||||||
expect(callback).toHaveBeenCalledTimes(1);
|
expect(callback).toHaveBeenCalledTimes(1)
|
||||||
});
|
})
|
||||||
|
|
||||||
it('should allow the callback to be called again after the timeout period', () => {
|
it('should allow the callback to be called again after the timeout period', () => {
|
||||||
throttleInstance.throttle(callback, 1000);
|
throttleInstance.throttle(callback, 1000)
|
||||||
vitest.advanceTimersByTime(1000);
|
vitest.advanceTimersByTime(1000)
|
||||||
expect(callback).toHaveBeenCalledTimes(1);
|
expect(callback).toHaveBeenCalledTimes(1)
|
||||||
|
|
||||||
throttleInstance.throttle(callback, 1000);
|
throttleInstance.throttle(callback, 1000)
|
||||||
vitest.advanceTimersByTime(1000);
|
vitest.advanceTimersByTime(1000)
|
||||||
expect(callback).toHaveBeenCalledTimes(2);
|
expect(callback).toHaveBeenCalledTimes(2)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { defineConfig, UserConfigExport } from 'vitest/config'
|
import { defineConfig, UserConfigExport } from 'vitest/config'
|
||||||
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||||
|
|
||||||
|
|
||||||
const config: UserConfigExport = {
|
const config: UserConfigExport = {
|
||||||
plugins: [svelte()],
|
plugins: [svelte()],
|
||||||
test: {
|
test: {
|
||||||
globals: true,
|
globals: true,
|
||||||
environment: 'jsdom'
|
environment: 'jsdom'
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
export default defineConfig(config)
|
export default defineConfig(config)
|
||||||
Reference in New Issue
Block a user