diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b6b38e2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +# Every pull request: lint, tests and a type-checked build, without deploying. +# Pushes to master are checked (and deployed) by deploy.yml. +on: + pull_request: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Test + run: npm test + + - name: Build + run: npm run build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c2f926c..f8af80e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,6 +30,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Lint + run: npm run lint + - name: Test run: npm test diff --git a/.gitignore b/.gitignore index a547bf3..1f78a01 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ dist dist-ssr *.local +# Design mockups: kept locally, never committed +mockup/ + # Editor directories and files .vscode/* !.vscode/extensions.json diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..443c14c --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,18 @@ +import { globalIgnores } from 'eslint/config' +import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' +import pluginVue from 'eslint-plugin-vue' +import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' + +// Vue and TypeScript rules; formatting is left to Prettier (npm run format). +export default defineConfigWithVueTs( + { + name: 'app/files-to-lint', + files: ['**/*.{ts,mts,tsx,vue}'], + }, + + globalIgnores(['**/dist/**', 'android/**', 'mockup/**', 'social-previews/**']), + + pluginVue.configs['flat/recommended'], + vueTsConfigs.recommended, + skipFormatting, +) diff --git a/package-lock.json b/package-lock.json index a4af8f9..9814392 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,13 @@ "@capacitor/cli": "^8.3.1", "@types/node": "^24.12.2", "@vitejs/plugin-vue": "^6.0.6", + "@vue/eslint-config-prettier": "^10.2.0", + "@vue/eslint-config-typescript": "^14.9.0", + "@vue/test-utils": "^2.6.0", "@vue/tsconfig": "^0.9.1", + "eslint": "^10.15.0", + "eslint-plugin-vue": "^10.12.1", + "happy-dom": "^21.0.4", "prettier": "^3.8.3", "typescript": "~6.0.2", "vite": "^8.0.10", @@ -90,6 +96,30 @@ "node": ">=6.9.0" } }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, "node_modules/@capacitor/android": { "version": "8.3.1", "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-8.3.1.tgz", @@ -567,6 +597,17 @@ "node": ">=12" } }, + "node_modules/@dual-bundle/import-meta-resolve": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@dual-bundle/import-meta-resolve/-/import-meta-resolve-4.2.1.tgz", + "integrity": "sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/JounQin" + } + }, "node_modules/@emnapi/core": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", @@ -601,6 +642,183 @@ "tslib": "^2.4.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.3.tgz", + "integrity": "sha512-R76UKbvsqI68DJJVTVyqFKqU98CN4+B+acxNfEA2IFarSzP0SjtKf/3+fFiXzTyv5Fj3PxLkGHe2wnVWWMxobQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.6.tgz", + "integrity": "sha512-WrTH7nioI9QPY4NZGnsywmecswJdgeq4BCM76qok9VgjTO29ZgUzUvcuJLVPYVQM4uDbaPBU0M33R9DIxI8X3w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^11.0.5" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@hutson/parse-repository-url": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz", @@ -833,6 +1051,13 @@ "node": ">=18.0.0" } }, + "node_modules/@isaacs/nonrecursive-glob-match": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz", + "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", @@ -860,6 +1085,30 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, "node_modules/@lineiconshq/free-icons": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@lineiconshq/free-icons/-/free-icons-1.0.4.tgz", @@ -960,6 +1209,13 @@ "node": ">= 8" } }, + "node_modules/@one-ini/wasm": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@one-ini/wasm/-/wasm-0.2.1.tgz", + "integrity": "sha512-TUqERXGNTifZ9y2g3wPxQrw3HpHv/02DsW3D90T9x0hhonrL1ZqpSmNrU2XkoIq0fP1N6gZfVQzy2Fw1ZvGBNg==", + "dev": true, + "license": "MIT" + }, "node_modules/@oxc-project/types": { "version": "0.127.0", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.127.0.tgz", @@ -980,6 +1236,19 @@ "@noble/hashes": "^1.1.5" } }, + "node_modules/@pkgr/core": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.3.6.tgz", + "integrity": "sha512-SEeaJLb3qBNF/OaXnaR1NmmBbFYk1zC0ZH/52fATcRPLFg/p791YrcyFFy44Bo9sLaGuSuLp5Q6axbb/O+v/RA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/pkgr" + } + }, "node_modules/@prettier/plugin-xml": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz", @@ -1476,6 +1745,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", @@ -1493,6 +1769,13 @@ "@types/node": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", @@ -1524,100 +1807,383 @@ "dev": true, "license": "MIT" }, - "node_modules/@vitejs/plugin-vue": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.6.tgz", - "integrity": "sha512-u9HHgfrq3AjXlysn0eINFnWQOJQLO9WN6VprZ8FXl7A2bYisv3Hui9Ij+7QZ41F/WYWarHjwBbXtD7dKg3uxbg==", + "node_modules/@types/whatwg-mimetype": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-mimetype/-/whatwg-mimetype-3.0.2.tgz", + "integrity": "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==", "dev": true, "license": "MIT", "dependencies": { - "@rolldown/pluginutils": "1.0.0-rc.13" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", - "vue": "^3.2.25" + "@types/node": "*" } }, - "node_modules/@vitest/mocker": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.1.tgz", - "integrity": "sha512-b2OgTB4+3ImWIVafXKazJXwLKwQxUNnix6b3xUvUTMh7RyXlrtzoxfZr8aEz9zkHOMAS4K5lu3TvFWoiVeVTQg==", + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.74.0.tgz", + "integrity": "sha512-z3KXk1+Vm+d82ZRplOoC89ho4Rf1da5ju6sx8//92GnN532U62DGPjECXkkVqtYzIv0zoJlpO39SX2Z9tk6LVw==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "0.3.31", - "@vitest/spy": "5.1.1", - "estree-walker": "^3.0.3", - "magic-string": "^1.4.5" + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/type-utils": "8.74.0", + "@typescript-eslint/utils": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/vitest" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "msw": "^2.4.9 || ^3.0.0", - "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } + "@typescript-eslint/parser": "^8.74.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/@vitest/mocker/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.16", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz", + "integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.74.0.tgz", + "integrity": "sha512-ecr8AYdig7avVkxaHdQvxHnIJ/mOyliO4Gv/uWF8q69vBew/z3sexqBwHUZX5Vql+Ns0w4sH6gBLkICGbOvJkA==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/@vitest/mocker/node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "node_modules/@typescript-eslint/project-service": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.74.0.tgz", + "integrity": "sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g==", "dev": true, "license": "MIT", "dependencies": { - "@types/estree": "^1.0.0" + "@typescript-eslint/tsconfig-utils": "^8.74.0", + "@typescript-eslint/types": "^8.74.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/@vitest/mocker/node_modules/magic-string": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", - "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.74.0.tgz", + "integrity": "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.6.0" + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@vitest/spy": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.1.tgz", - "integrity": "sha512-6K8C6alQG1/Yc8/ZI22iJS7JEsxPdVzqtqDq+/xM4Z0mGVykemMVjLhqMy/q6/IHYG3kKD8hKSwRen/ZdyI9vQ==", + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.74.0.tgz", + "integrity": "sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ==", "dev": true, "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, "funding": { - "url": "https://opencollective.com/vitest" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/@volar/language-core": { - "version": "2.4.28", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.28.tgz", - "integrity": "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==", + "node_modules/@typescript-eslint/type-utils": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.74.0.tgz", + "integrity": "sha512-CV3Y3la8l3F9ANfxcfpgSSiQgJTe4IeLEoZV4O/gcW86Ugp8X6SKiQ0vm+QegXaRIbbDMokZZSF3A1CgiU/kPw==", "dev": true, "license": "MIT", "dependencies": { - "@volar/source-map": "2.4.28" + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/utils": "8.74.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.74.0.tgz", + "integrity": "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.74.0.tgz", + "integrity": "sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.74.0", + "@typescript-eslint/tsconfig-utils": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", + "debug": "^4.4.3", + "minimatch": "^11.0.1", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev", + "typescript": ">=4.8.4 <6.1.0" + }, + "peerDependenciesMeta": { + "@typescript/native": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.74.0.tgz", + "integrity": "sha512-IpWXPxXXomzxyTcvjhZJexgdvtTR1TooLAPpuxzaGqQ8BHll1lf4Ysp/BTE/l0U5TJ+x1j7B4bEM8pLRrvY+XA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.74.0.tgz", + "integrity": "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.74.0", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@vitejs/plugin-vue": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.6.tgz", + "integrity": "sha512-u9HHgfrq3AjXlysn0eINFnWQOJQLO9WN6VprZ8FXl7A2bYisv3Hui9Ij+7QZ41F/WYWarHjwBbXtD7dKg3uxbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "1.0.0-rc.13" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", + "vue": "^3.2.25" + } + }, + "node_modules/@vitest/mocker": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.1.tgz", + "integrity": "sha512-b2OgTB4+3ImWIVafXKazJXwLKwQxUNnix6b3xUvUTMh7RyXlrtzoxfZr8aEz9zkHOMAS4K5lu3TvFWoiVeVTQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.1.1", + "estree-walker": "^3.0.3", + "magic-string": "^1.4.5" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9 || ^3.0.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@vitest/mocker/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/@vitest/mocker/node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/@vitest/spy": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.1.tgz", + "integrity": "sha512-6K8C6alQG1/Yc8/ZI22iJS7JEsxPdVzqtqDq+/xM4Z0mGVykemMVjLhqMy/q6/IHYG3kKD8hKSwRen/ZdyI9vQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@volar/language-core": { + "version": "2.4.28", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.28.tgz", + "integrity": "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@volar/source-map": "2.4.28" } }, "node_modules/@volar/source-map": { @@ -1695,6 +2261,50 @@ "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==", "license": "MIT" }, + "node_modules/@vue/eslint-config-prettier": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-10.2.0.tgz", + "integrity": "sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-config-prettier": "^10.0.1", + "eslint-plugin-prettier": "^5.2.2" + }, + "peerDependencies": { + "eslint": ">= 8.21.0", + "prettier": ">= 3.0.0" + } + }, + "node_modules/@vue/eslint-config-typescript": { + "version": "14.9.0", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-typescript/-/eslint-config-typescript-14.9.0.tgz", + "integrity": "sha512-E3j9hDlfVf10F30MRcLTPY2IIhWIx1nsvkVukk14kTcuA+oBVot9zsP1hzsO+PAMDxV3Fd9FimBJtUBNBL5KFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/utils": "^8.60.0", + "fast-glob": "^3.3.3", + "typescript-eslint": "^8.60.0", + "vue-eslint-parser": "^10.4.0" + }, + "bin": { + "vue-eslint-config-typescript": "dist/bin.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": "^9.10.0 || ^10.0.0", + "eslint-plugin-vue": "^9.28.0 || ^10.0.0", + "typescript": ">=4.8.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@vue/language-core": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.2.7.tgz", @@ -1761,6 +2371,27 @@ "integrity": "sha512-5vR2QIlmaLG77Ygd4pMP6+SGQ5yox9VhtnbDWTy9DzMzdmeLxZ1QqxrywEZ9sa1AVubfIJyaCG3ytyWU81ufcQ==", "license": "MIT" }, + "node_modules/@vue/test-utils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@vue/test-utils/-/test-utils-2.6.0.tgz", + "integrity": "sha512-kTB6s2p34cA/xXSpt17G0enU9A3F3pdm+o5GZgE3WGXXXpXJ5SVBsRhgCJNCc+ekGAzY0T7Hjyo5yEfwencBlg==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-beautify": "^2.0.0", + "vue-component-type-helpers": "^3.0.0" + }, + "peerDependencies": { + "@vue/compiler-dom": "3.x", + "@vue/server-renderer": "3.x", + "vue": "3.x" + }, + "peerDependenciesMeta": { + "@vue/server-renderer": { + "optional": true + } + } + }, "node_modules/@vue/tsconfig": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/@vue/tsconfig/-/tsconfig-0.9.1.tgz", @@ -1800,6 +2431,16 @@ "node": ">=10.0.0" } }, + "node_modules/abbrev": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-5.0.0.tgz", + "integrity": "sha512-/XrFJgzQQQHpti1raDJC6m4ws6aNktmjBlhk8Fdlk7LwCEuDoieEJJY9OFHjfiFJFFRM2tK+Ky/IsfbbmlMu1w==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, "node_modules/acorn": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", @@ -1813,6 +2454,16 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/acorn-walk": { "version": "8.3.5", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", @@ -1847,6 +2498,23 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/alien-signals": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/alien-signals/-/alien-signals-3.1.2.tgz", @@ -2147,16 +2815,16 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", - "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz", + "integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==", "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" }, "engines": { - "node": "18 || 20 || >=22" + "node": "20 || >=22" } }, "node_modules/braces": { @@ -2207,6 +2875,33 @@ "node": "*" } }, + "node_modules/buffer-image-size": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/buffer-image-size/-/buffer-image-size-0.6.4.tgz", + "integrity": "sha512-nEh+kZOPY1w+gcCMobZ6ETUp9WfibndnosbpwB1iJk/8Gt5ZF2bhS6+B6bPYz424KtwsR6Rflc3tCz1/ghX2dQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -2408,6 +3103,24 @@ "dev": true, "license": "MIT" }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/config-chain/node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, + "license": "ISC" + }, "node_modules/conventional-changelog": { "version": "3.1.25", "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.25.tgz", @@ -2843,6 +3556,13 @@ "node": ">=4.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -3082,6 +3802,35 @@ "node": ">=8" } }, + "node_modules/editorconfig": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-3.0.2.tgz", + "integrity": "sha512-T0ix8GhtxyKVfUFEcvdNDt3YGqlwkFHbD4/5bgFUDgFmxhI/cSRAeJ87/Sz//Cq8Eam6JX/e23RkoFO71P7aAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@one-ini/wasm": "0.2.1", + "commander": "^14.0.3", + "minimatch": "~10.2.4", + "semver": "^7.7.4" + }, + "bin": { + "editorconfig": "bin/editorconfig" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/editorconfig/node_modules/commander": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, "node_modules/elementtree": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.7.tgz", @@ -3181,12 +3930,390 @@ "node": ">=0.8.0" } }, + "node_modules/eslint": { + "version": "10.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.15.0.tgz", + "integrity": "sha512-+5Wg4p+ze3sG1WErYgUO/3H1IQIfFBymVUA0Fo/XTeBOLS6UQIUekpSJ8sdRkn7O7wjh84b55w/roqavH2aScg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.6", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^11.0.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.5.7", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.7.tgz", + "integrity": "sha512-WjHyn3GrFd+ZR0rzsLiM4zJZ35PZMOE0SUIxzGmnWNG0126yNfJKJzObmmkYDwHJfGlkz3PSlzyG9ez/LJntwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.1", + "synckit": "^0.12.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-vue": { + "version": "10.12.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.12.1.tgz", + "integrity": "sha512-Z5hmchVWq4EEOCn131J2p/uS4hjkrC+goPV5c/YApTY68xTqV3K5IYqD0mYGupDvZ6iYoTSuhSZUoWN+gZIqZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "natural-compare": "^1.4.0", + "nth-check": "^2.1.1", + "postcss-selector-parser": "^7.1.7", + "semver": "^7.8.5", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "@stylistic/eslint-plugin": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", + "@typescript-eslint/parser": "^7.0.0 || ^8.0.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "vue-eslint-parser": "^10.3.0" + }, + "peerDependenciesMeta": { + "@stylistic/eslint-plugin": { + "optional": true + }, + "@typescript-eslint/parser": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/estree-walker": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "license": "MIT" }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/events-universal": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", @@ -3217,6 +4344,20 @@ "node": ">=12.0.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -3241,6 +4382,20 @@ "node": ">=8.6.0" } }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, "node_modules/fastq": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", @@ -3285,6 +4440,16 @@ "integrity": "sha512-f9c00hphOgeQTlDyavwTtu6RiK8AIFjD6+jvXkNkpeQ7rirK3uFWVpalkoS4LAwbdX7mfZ8aoBfFVQX1Re/8aw==", "license": "MIT" }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -3311,6 +4476,25 @@ "node": ">=4" } }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, "node_modules/formidable": { "version": "3.5.4", "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz", @@ -3711,6 +4895,25 @@ "uglify-js": "^3.1.4" } }, + "node_modules/happy-dom": { + "version": "21.0.4", + "resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-21.0.4.tgz", + "integrity": "sha512-tFm+GaLBgo6o0awHnvHaNoraVo27qJ+2tZEtZ+cIa08hXbeitrxAJajLI05hsUy/2/YTKcUjQYzHe5mCcraLBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": ">=20.0.0", + "@types/whatwg-mimetype": "^3.0.2", + "@types/ws": "^8.18.1", + "buffer-image-size": "^0.6.4", + "entities": "^7.0.1", + "whatwg-mimetype": "^3.0.0", + "ws": "^8.21.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -3731,6 +4934,19 @@ "node": ">=4" } }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/hasown": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", @@ -3754,6 +4970,13 @@ "he": "bin/he" } }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -3818,6 +5041,16 @@ "node": ">= 4" } }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -4032,6 +5265,35 @@ "dev": true, "license": "ISC" }, + "node_modules/js-beautify": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-2.0.3.tgz", + "integrity": "sha512-cyFbh3tkPhknnTD/0bLf0T0yy2ZIbqL05mttzbt4y1Zfr7NxqXQZ62dkBLKs3oHH/lpjmDRAnciJiSUyOy8XwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "config-chain": "^1.1.13", + "editorconfig": "^3.0.2", + "glob": "^13.0.6", + "js-cookie": "^3.0.8", + "nopt": "^10.0.1" + }, + "bin": { + "css-beautify": "js/bin/css-beautify.js", + "html-beautify": "js/bin/html-beautify.js", + "js-beautify": "js/bin/js-beautify.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/js-cookie": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.8.tgz", + "integrity": "sha512-yeJd4aNAdYZQjaon2bpD/Gb0B/omw7HQOsynXXcOiWVCacbBcPlgn8S/d1X6blFSaHao7ozqtW7NZW19xpCtIw==", + "dev": true, + "license": "MIT" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -4053,6 +5315,20 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -4100,6 +5376,16 @@ "node": "*" } }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -4120,6 +5406,20 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", @@ -4951,6 +6251,13 @@ "node": ">=16.0.0" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -5010,6 +6317,22 @@ "he": "1.2.0" } }, + "node_modules/nopt": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-10.0.1.tgz", + "integrity": "sha512-df3sBr/6ax9hSGuC3CspvLlbnX8cP5L5nZwXF8cGN8l0zSWR6BvzmQ6jPUKjvo6+/xdpkNvEcucBNUdBeeV13g==", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "^5.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, "node_modules/normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", @@ -5081,6 +6404,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -5326,6 +6667,19 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-selector-parser": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.2.1.tgz", + "integrity": "sha512-GwxlMgTTXwIom+ebC7an3k6RaJDwklRQQnfiXsLPGicu8FYV/k/+1/9YY2OU2+r938H2t4X0TDxoif+HP2rjzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/prebuild-install": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", @@ -5391,6 +6745,16 @@ "node": ">=6" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/prettier": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", @@ -5407,6 +6771,19 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.1.tgz", + "integrity": "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -5438,6 +6815,13 @@ "node": ">=6" } }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "dev": true, + "license": "ISC" + }, "node_modules/pump": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", @@ -5449,6 +6833,16 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -5461,6 +6855,26 @@ "teleport": ">=0.2.0" } }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -5981,9 +7395,9 @@ "license": "ISC" }, "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", "dev": true, "license": "ISC", "bin": { @@ -6382,6 +7796,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/synckit": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.12.3.tgz", + "integrity": "sha512-U+/AXT6LWsxnj2vz9HeUuPWBNgdWxjyIEjEPdbJARC9txmgPzo2VEdqnFo4hHaNyMPtycyVJrSaQYeQv/PoyyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@dual-bundle/import-meta-resolve": "^4.2.1", + "@pkgr/core": "^0.3.6" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/synckit" + } + }, "node_modules/tar": { "version": "7.5.13", "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.13.tgz", @@ -6604,6 +8035,19 @@ "node": ">=8" } }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -6677,6 +8121,19 @@ "node": "*" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "0.18.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", @@ -6704,6 +8161,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.74.0.tgz", + "integrity": "sha512-OsWQlsedt1ZpZXfZZMNK3m4SoQONFFcy4h/uRznsCeRfVuEic3gh4KGUs2pJJ5o0Jj0Jr7keUHQGN1Ns9aDw7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.74.0", + "@typescript-eslint/parser": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/utils": "8.74.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, "node_modules/uglify-js": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", @@ -6758,6 +8239,16 @@ "node": ">=8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6992,6 +8483,50 @@ } } }, + "node_modules/vue-component-type-helpers": { + "version": "3.3.14", + "resolved": "https://registry.npmjs.org/vue-component-type-helpers/-/vue-component-type-helpers-3.3.14.tgz", + "integrity": "sha512-Pq3+OnbCiPCHk0R7KSZrx+j/XXaUn2kSQ1epxq60w8CPbByLjC1EJgV51n4WY851sTXUVzsNMuitywdkdVyKjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/vue-eslint-parser": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-10.4.2.tgz", + "integrity": "sha512-WMpzulb50kb6snghzoGzS++62wcOszAk/piYcnvzdStM8Wni/BmogYltpoOFv2eK9hDbXxvwFQgnwZGpAoUfpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "eslint-scope": "^8.2.0 || ^9.0.0", + "eslint-visitor-keys": "^4.2.0 || ^5.0.0", + "espree": "^10.3.0 || ^11.0.0", + "esquery": "^1.6.0", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/vue-eslint-parser/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/vue-i18n": { "version": "11.4.0", "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-11.4.0.tgz", @@ -7037,6 +8572,16 @@ "dev": true, "license": "BSD-2-Clause" }, + "node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -7084,6 +8629,16 @@ "node": ">=20.11" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -7116,6 +8671,28 @@ "dev": true, "license": "ISC" }, + "node_modules/ws": { + "version": "8.23.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.23.0.tgz", + "integrity": "sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/xcode": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/xcode/-/xcode-3.0.1.tgz", @@ -7153,6 +8730,16 @@ "node": ">=11.0.0" } }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, "node_modules/xml2js": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", @@ -7286,6 +8873,19 @@ "engines": { "node": ">=6" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 7e7e692..dc79fd7 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "preview": "vite preview", "test": "vitest run", "test:watch": "vitest", + "lint": "eslint .", "generate-assets": "capacitor-assets generate", "format": "prettier --write \"src/**/*.{ts,vue,css,json}\" \"*.{ts,json}\"" }, @@ -26,7 +27,13 @@ "@capacitor/cli": "^8.3.1", "@types/node": "^24.12.2", "@vitejs/plugin-vue": "^6.0.6", + "@vue/eslint-config-prettier": "^10.2.0", + "@vue/eslint-config-typescript": "^14.9.0", + "@vue/test-utils": "^2.6.0", "@vue/tsconfig": "^0.9.1", + "eslint": "^10.15.0", + "eslint-plugin-vue": "^10.12.1", + "happy-dom": "^21.0.4", "prettier": "^3.8.3", "typescript": "~6.0.2", "vite": "^8.0.10", diff --git a/public/icons.svg b/public/icons.svg deleted file mode 100644 index e952219..0000000 --- a/public/icons.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/hero.svg b/src/assets/hero.svg deleted file mode 100644 index 9ee0c3d..0000000 --- a/src/assets/hero.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/icon.svg b/src/assets/icon.svg deleted file mode 100644 index 242a37b..0000000 --- a/src/assets/icon.svg +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/components/CentsMeter.vue b/src/components/CentsMeter.vue index 88d7a84..950de50 100644 --- a/src/components/CentsMeter.vue +++ b/src/components/CentsMeter.vue @@ -1,4 +1,6 @@ + + diff --git a/src/components/GuitarTuner.vue b/src/components/GuitarTuner.vue index 679dfb5..91c8a1d 100644 --- a/src/components/GuitarTuner.vue +++ b/src/components/GuitarTuner.vue @@ -166,3 +166,320 @@ const statusClass = computed(() => { + + diff --git a/src/components/SettingsMenu.vue b/src/components/SettingsMenu.vue index 961f62c..c03fcc3 100644 --- a/src/components/SettingsMenu.vue +++ b/src/components/SettingsMenu.vue @@ -78,3 +78,104 @@ function setLocale(lang: string) { + + diff --git a/src/components/StringChips.vue b/src/components/StringChips.vue index e24af52..bf48707 100644 --- a/src/components/StringChips.vue +++ b/src/components/StringChips.vue @@ -34,9 +34,133 @@ function arrayIdx(di: number): number { :disabled="!isListening" @click="emit('select', arrayIdx(di))" > - {{ tuning.strings - di }} + + {{ di + 1 }} {{ formatNote(str.note, tuning.preferFlats) }} {{ str.octave }} + + diff --git a/src/components/TunerRing.vue b/src/components/TunerRing.vue index 21dc07a..71a20c9 100644 --- a/src/components/TunerRing.vue +++ b/src/components/TunerRing.vue @@ -39,3 +39,65 @@ const ringGap = computed(() => ringCirc.value - ringDash.value) + + diff --git a/src/components/TuningSelector.vue b/src/components/TuningSelector.vue index c8d9d77..f45492e 100644 --- a/src/components/TuningSelector.vue +++ b/src/components/TuningSelector.vue @@ -107,7 +107,7 @@ function handleSelect(id: string) { >
{{ tuning.name }} - {{ tuning.strings }}str + {{ tuning.strings }} {{ t('tuner.strSuffix') }} {{ t('selector.custom') }}
+ + diff --git a/src/components/components.test.ts b/src/components/components.test.ts new file mode 100644 index 0000000..6cd5032 --- /dev/null +++ b/src/components/components.test.ts @@ -0,0 +1,91 @@ +// @vitest-environment happy-dom +import { mount } from '@vue/test-utils' +import { beforeEach, describe, expect, it } from 'vitest' +import { nextTick } from 'vue' +import { PRESET_TUNINGS, type TuningPreset } from '../data/tunings' +import { i18n } from '../i18n' +import { ACCEPT_CENTS } from '../tuner/engine' +import CentsMeter from './CentsMeter.vue' +import StringChips from './StringChips.vue' +import TuningSelector from './TuningSelector.vue' + +const preset = (id: string) => PRESET_TUNINGS.find((t) => t.id === id) as TuningPreset + +describe('StringChips', () => { + const chips = (tuning: TuningPreset, props = {}) => + mount(StringChips, { + props: { + tuning, + isListening: true, + tunedStrings: new Set(), + lockedStringIndex: 0, + ...props, + }, + }).findAll('.string-chip') + + it('shows the thinnest string first, numbered 1 as on a guitar', () => { + const shown = chips(preset('std6')).map( + (c) => + c.find('.chip-num').text() + c.find('.chip-note').text() + c.find('.chip-octave').text(), + ) + expect(shown).toEqual(['1E4', '2B3', '3G3', '4D3', '5A2', '6E2']) + }) + + it('numbers a re-entrant ukulele from A (1) to the high G (4)', () => { + const shown = chips(preset('uke_std')).map( + (c) => c.find('.chip-num').text() + c.find('.chip-note').text(), + ) + expect(shown).toEqual(['1A', '2E', '3C', '4G']) + }) + + it('marks the locked and the tuned strings, and selects by position in the tuning', async () => { + const wrapper = mount(StringChips, { + props: { + tuning: preset('std6'), + isListening: true, + tunedStrings: new Set([0]), + lockedStringIndex: 1, + }, + }) + const all = wrapper.findAll('.string-chip') + expect(all[5].classes()).toContain('tuned') // low E, index 0 + expect(all[4].classes()).toContain('locked') // A, index 1 + await all[0].trigger('click') // high E + expect(wrapper.emitted('select')).toEqual([[5]]) + }) +}) + +describe('CentsMeter', () => { + it("draws the green band over the engine's in-tune window (1¢ = 1% of the ±50¢ track)", () => { + const band = mount(CentsMeter, { props: { needlePercent: 50, status: 'idle' } }).find( + '.meter-range', + ) + const style = band.attributes('style') ?? '' + expect(style).toContain(`left: ${50 - ACCEPT_CENTS}%`) + expect(style).toContain(`width: ${2 * ACCEPT_CENTS}%`) + }) +}) + +describe('TuningSelector', () => { + beforeEach(() => { + i18n.global.locale.value = 'en' + }) + + it('says how many strings in the chosen language', async () => { + i18n.global.locale.value = 'it' + const wrapper = mount(TuningSelector, { global: { plugins: [i18n] } }) + await nextTick() + expect(wrapper.find('.card-strings').text()).toBe('6 corde') + }) +}) + +describe('language of the page', () => { + it('follows the language chosen in the settings', async () => { + i18n.global.locale.value = 'zh' + await nextTick() + expect(document.documentElement.lang).toBe('zh') + i18n.global.locale.value = 'it' + await nextTick() + expect(document.documentElement.lang).toBe('it') + }) +}) diff --git a/src/composables/useTheme.ts b/src/composables/useTheme.ts index 3949977..1fa499a 100644 --- a/src/composables/useTheme.ts +++ b/src/composables/useTheme.ts @@ -3,11 +3,17 @@ import { useSettings } from './useSettings' const { settings, setTheme: _setTheme } = useSettings() -// Apply theme to DOM whenever it changes +// Apply theme to DOM whenever it changes, and colour the browser's / installed app's bar to +// match the page background (--bg-base of the theme now applied) watch( () => settings.value.theme, (theme) => { document.documentElement.setAttribute('data-theme', theme) + const background = getComputedStyle(document.documentElement) + .getPropertyValue('--bg-base') + .trim() + const meta = document.querySelector('meta[name="theme-color"]') + if (meta && background) meta.content = background }, { immediate: true }, ) diff --git a/src/composables/useTuner.test.ts b/src/composables/useTuner.test.ts index f8f211c..c5f44d8 100644 --- a/src/composables/useTuner.test.ts +++ b/src/composables/useTuner.test.ts @@ -215,6 +215,35 @@ describe('noisy readings', () => { }) }) +describe('silence (no frames at all: the capture gates them out)', () => { + const E2 = GUITAR.tuning[0].frequency + + it('blanks the reading 500 ms after the last frame, keeping the needle', async () => { + const { tuner } = await setup() + await feed(note(E2, 4), 600) + expect(tuner.hint.value).toBe('in-range') + + await vi.advanceTimersByTimeAsync(450) + expect(tuner.hint.value).toBe('in-range') + + await vi.advanceTimersByTimeAsync(100) + expect(tuner.hint.value).toBeNull() + expect(tuner.frequency.value).toBeNull() + expect(tuner.stabilityProgress.value).toBe(0) + expect(tuner.needleCents.value).not.toBeNull() + }) + + it('shows the reading again with the next frame', async () => { + const { tuner } = await setup() + await feed(note(E2), 300) + await vi.advanceTimersByTimeAsync(800) + expect(tuner.frequency.value).toBeNull() + + await feed(note(E2), 100) + expect(tuner.frequency.value).toBe(82.4) + }) +}) + describe('moving through the strings', () => { it('after the last string: "all in tune", then stops by itself 2 s later', async () => { const { tuner } = await setup() diff --git a/src/composables/useTuner.ts b/src/composables/useTuner.ts index 87be6c8..85d25fe 100644 --- a/src/composables/useTuner.ts +++ b/src/composables/useTuner.ts @@ -1,219 +1,65 @@ /** - * useTuner — simplified sequential string tuner. + * useTuner — connects the tuning engine (src/tuner/engine.ts) to the microphone and to Vue. * - * Flow: - * 1. Start on string 0. Stay focused on it until confirmed in tune. - * 2. Once in tune, auto-advance to the next untuned string. - * 3. User can click any chip to jump to that string (resets its progress). - * 4. When all strings are confirmed tuned, stop listening and reset. - * - * No auto-string detection. No ghost detector. No manual-lock concept. - * The engine only ever listens for the currently locked string. - * - * Audio capture is delegated to useAudioCapture (Dependency Inversion). + * Audio capture is delegated to useAudioCapture, the analysis to the engine; this composable + * feeds one to the other, mirrors the engine's state into read-only refs for the UI, steers + * the low-pass filter to the string being tuned, and stops on its own once every string is + * in tune. */ import { readonly, ref, watch, type Ref } from 'vue' import type { TuningPreset } from '../data/tunings' +import { createTunerEngine, SIGNAL_HOLD_MS, type TunerHint } from '../tuner/engine' +import { createSessionLog } from '../tuner/sessionLog' import { useAudioCapture, type AudioFrame } from './useAudioCapture' -/** Cents window considered "in tune" (±8¢ is comfortable for guitar) */ -const ACCEPT_CENTS = 8 -/** Cents above ACCEPT_CENTS before we consider resetting stability (hysteresis) */ -const STABILITY_RESET_CENTS = 20 -/** How long (ms) pitch must remain outside before stability progress resets */ -const STABILITY_RESET_MS = 150 -/** Minimum ms between Presentation Layer writes to Vue reactive refs (~30fps) */ -const DISPLAY_INTERVAL_MS = 33 -/** EMA smoothing factor — 0.04 at 60fps ≈ 500ms settling time */ -const CENTS_EMA_ALPHA = 0.04 -/** How long (ms) to show the all-tuned banner before auto-stopping */ -const ALL_TUNED_RESET_MS = 2000 -/** RMS below which the SNR is too poor — apply tighter (decay) clarity gate */ -const LOW_RMS_THRESHOLD = 0.04 - -/** Per-instrument analysis configuration */ -interface InstrumentConfig { - /** Primary FFT window size — larger values improve low-freq fundamental detection */ - primaryFftSize: number - /** How long (ms) pitch must stay inside ACCEPT_CENTS to confirm the string */ - stableMs: number - /** Minimum pitchy clarity to accept a pitch reading */ - clarityThreshold: number - /** Stricter clarity gate when the string RMS is decaying */ - decayClarityThreshold: number -} - -const INSTRUMENT_CONFIGS: Record = { - // decayClarityThreshold MUST always be <= clarityThreshold: - // decaying strings produce noisier signals (lower RMS → worse SNR), - // so the clarity gate must be more permissive when the string is quiet, - // not stricter. Inverted values cause valid quiet-tail frames to be - // rejected, fragmenting the stability timer and requiring many plucks. - // - // bass: 8192 FFT resolves E1(41Hz) cleanly; long sustain warrants - // 1500ms hold. Low strings have heavy overtone content so - // decay threshold is relaxed to match guitar's tuned value. - // guitar: confirmed via session logs — 0.80 decay threshold accepts - // quiet-tail frames at 0.83-0.91 while rejecting noise at ≤0.76. - // ukulele: nylon strings, short sustain; quiet tail is brief but noisy. - // violin: bowed, no sharp attack; clarity drops fast after bow lift. - bass: { - primaryFftSize: 8192, - stableMs: 1500, - clarityThreshold: 0.93, - decayClarityThreshold: 0.82, - }, - guitar: { - primaryFftSize: 2048, - stableMs: 1100, - clarityThreshold: 0.92, - decayClarityThreshold: 0.8, - }, - ukulele: { - primaryFftSize: 2048, - stableMs: 800, - clarityThreshold: 0.85, - decayClarityThreshold: 0.75, - }, - violin: { - primaryFftSize: 2048, - stableMs: 600, - clarityThreshold: 0.8, - decayClarityThreshold: 0.7, - }, -} -const DEFAULT_INSTRUMENT_CONFIG: InstrumentConfig = INSTRUMENT_CONFIGS.guitar -/** Rolling median buffer size (22 × 16ms ≈ 350ms history) */ -const PITCH_BUFFER_SIZE = 22 -/** Max cents jump between EMA and incoming pitch before discarding as noise */ -const PITCH_CONTINUITY_CENTS = 500 -/** Wide hint window (±1 octave) — shows too-high/too-low even when heavily out of tune */ -const HINT_WINDOW_CENTS = 1200 -/** How long (ms) to hold the 'in-range' hint after pitch drifts slightly out */ -const HINT_GRACE_MS = 250 -/** How long (ms) to keep display alive after the last valid signal frame */ -const SIGNAL_HOLD_MS = 500 -/** Logging interval (ms) — throttles console output to ~2 logs/s */ -const LOG_INTERVAL_MS = 500 - -// --- Session log collector --- -// Entries accumulate while tuning; flushed to console as a single pasteable -// block when stop() is called. Reset on every start(). -let sessionLog: string[] = [] -function slog(msg: string) { - sessionLog.push(msg) -} - -export type TunerHint = 'too-high' | 'too-low' | 'in-range' | null - -function centsBetween(freq: number, targetFreq: number): number { - return Math.round(1200 * Math.log2(freq / targetFreq)) -} - -/** - * Returns true if `pitch` is approximately an integer harmonic (2×–6×) of - * `fundamentalFreq`. Tolerance ±8% covers natural intonation variance. - */ -function isHarmonicOf(pitch: number, fundamentalFreq: number): boolean { - for (let n = 2; n <= 6; n++) { - if (Math.abs(pitch / fundamentalFreq - n) < 0.08) return true - } - return false -} -function median(arr: number[]): number { - const s = [...arr].sort((a, b) => a - b) - return s[Math.floor(s.length / 2)] -} +export type { TunerHint } -/** - * Fold `pitch` toward `targetFreq` by dividing by N = 2..6. - * If dividing brings it within 300¢ AND improves the match by >400¢, - * return the folded value. Corrects pitchy latching onto upper harmonics. - */ -function foldTowardTarget(pitch: number, targetFreq: number): number { - const rawCents = Math.abs(centsBetween(pitch, targetFreq)) - let best = pitch - let bestCents = rawCents - for (let n = 2; n <= 6; n++) { - const folded = pitch / n - const fc = Math.abs(centsBetween(folded, targetFreq)) - if (fc < bestCents && rawCents - fc > 400 && fc < 300) { - bestCents = fc - best = folded - } - } - return best -} +/** How long (ms) to show the all-tuned banner before auto-stopping */ +const ALL_TUNED_RESET_MS = 2000 export function useTuner(activeTuning: Ref) { const { isCapturing, captureError, startCapture, stopCapture, setLowPassCutoff } = useAudioCapture() - // --- Reactive state (Presentation Layer) --- - // Written only on display frames (~30fps) to avoid Vue batching pressure. + const log = createSessionLog() + let allTunedResetTimer: ReturnType | null = null + const engine = createTunerEngine(activeTuning.value, { + log, + // All strings tuned — show the banner, then stop. + onAllTuned() { + allTunedResetTimer = setTimeout(() => { + allTunedResetTimer = null + stop() + }, ALL_TUNED_RESET_MS) + }, + }) + + // --- Reactive state for the UI, copied from the engine after each change --- const frequency = ref(null) - /** 0-based index into tuning array — the string currently being tuned */ const lockedStringIndex = ref(0) const cents = ref(null) const hint = ref(null) - /** 0–1: progress toward confirming current string as in tune */ const stabilityProgress = ref(0) - /** Indices of strings that have been confirmed tuned */ const tunedStrings = ref>(new Set()) const allTuned = ref(false) - /** Float cents for needle — holds last position on signal loss */ const needleCents = ref(null) - /** pitchy clarity (0–1) — drives needle opacity in the UI */ const signalClarity = ref(0) - // --- Engine state (internal, written every tick at ~60fps) --- - let cfg: InstrumentConfig = - INSTRUMENT_CONFIGS[activeTuning.value.category] ?? DEFAULT_INSTRUMENT_CONFIG - let stableStartTime: number | null = null - let smoothedCents: number | null = null - let allTunedResetTimer: ReturnType | null = null - let advancing = false - let minFreq = 0 - let maxFreq = 0 - let hintMinFreq = 0 - let hintMaxFreq = 0 - /** True once the pitch has entered the ±15% acceptance window for the current string. - * Disables the wide coarse-hint path so it cannot flicker back mid-tune. */ - let hasEnteredFineWindow = false - let pitchHistory: number[] = [] - let outOfRangeStart: number | null = null - let inRangeGraceUntil = 0 - let lastGoodSignalTime = 0 - let lastDisplayTime = 0 - let lastLogTime = 0 - // --- Tick counters for the session report --- - let tickTotal = 0 - let tickHasSignal = 0 - let tickCoarseHint = 0 - let tickOvertone = 0 - let tickSilence = 0 - let tickContinuityRejected = 0 - - // --- Frequency window (updated whenever the locked string changes) --- - // Accepts only pitches within ±15% of the locked fundamental. - // ±15% is tight enough to reject adjacent open strings - // (e.g. B3 at 247Hz is 33% below E4 at 330Hz) while still - // covering a guitar that is severely out of tune. - function cacheFreqBounds() { - const tuning = activeTuning.value.tuning - const idx = Math.min(lockedStringIndex.value, tuning.length - 1) - const lockedFreq = tuning[idx].frequency - // ±15% — tight enough to reject adjacent strings (e.g. B3 when listening for E4) - minFreq = lockedFreq * 0.85 - maxFreq = lockedFreq * 1.15 - // ±1 octave — wide window for coarse hint when string is heavily out of tune - hintMinFreq = lockedFreq * 2 ** (-HINT_WINDOW_CENTS / 1200) - hintMaxFreq = lockedFreq * 2 ** (HINT_WINDOW_CENTS / 1200) + function sync() { + const d = engine.display + frequency.value = d.frequency + cents.value = d.cents + hint.value = d.hint + stabilityProgress.value = d.stabilityProgress + needleCents.value = d.needleCents + signalClarity.value = d.signalClarity + lockedStringIndex.value = engine.lockedStringIndex + tunedStrings.value = engine.tunedStrings as Set + allTuned.value = engine.allTuned } - cacheFreqBounds() watch(activeTuning, async (newVal, oldVal) => { - cfg = INSTRUMENT_CONFIGS[newVal.category] ?? DEFAULT_INSTRUMENT_CONFIG + engine.setTuning(newVal) if (isCapturing.value) { // Category change requires restarting audio to apply a new FFT size if (newVal.category !== oldVal?.category) { @@ -223,67 +69,46 @@ export function useTuner(activeTuning: Ref) { resetState() } } - cacheFreqBounds() }) - watch(lockedStringIndex, () => { - cacheFreqBounds() - updateLpf() - }) + watch(lockedStringIndex, updateLpf) - // --- State helpers --- function updateLpf() { const tuningArr = activeTuning.value.tuning const lockedFreq = tuningArr[Math.min(lockedStringIndex.value, tuningArr.length - 1)].frequency setLowPassCutoff(Math.min(2000, Math.max(280, lockedFreq * 3))) } - function resetStringProgress() { - stableStartTime = null - stabilityProgress.value = 0 - advancing = false - smoothedCents = null - hasEnteredFineWindow = false - pitchHistory = [] - outOfRangeStart = null - inRangeGraceUntil = 0 - lastGoodSignalTime = 0 - lastDisplayTime = 0 - frequency.value = null - cents.value = null - hint.value = null - needleCents.value = null - signalClarity.value = 0 - } - function resetState() { - lockedStringIndex.value = 0 - tunedStrings.value = new Set() - allTuned.value = false - resetStringProgress() + engine.reset() if (allTunedResetTimer !== null) { clearTimeout(allTunedResetTimer) allTunedResetTimer = null } + clearSilenceTimer() + sync() } - function advanceToNextUntuned(fromIndex: number) { - const count = activeTuning.value.tuning.length - for (let offset = 1; offset <= count; offset++) { - const next = (fromIndex + offset) % count - if (!tunedStrings.value.has(next)) { - lockedStringIndex.value = next - resetStringProgress() - return - } + // Below its noise gate useAudioCapture sends no frames at all, so the engine's own + // latch-and-fade never runs in true silence. Blank the reading after the same hold time + // once frames stop coming; the engine's analysis state is left as it is. + let silenceTimer: ReturnType | null = null + function clearSilenceTimer() { + if (silenceTimer !== null) { + clearTimeout(silenceTimer) + silenceTimer = null } - // All strings tuned — show banner then stop. - // Keep advancing=true so no further tick can re-enter the confirmation block. - allTuned.value = true - allTunedResetTimer = setTimeout(() => { - allTunedResetTimer = null - stop() - }, ALL_TUNED_RESET_MS) + } + + function processTick(frame: AudioFrame) { + engine.process(frame, performance.now()) + sync() + clearSilenceTimer() + silenceTimer = setTimeout(() => { + silenceTimer = null + engine.clearDisplay() + sync() + }, SIGNAL_HOLD_MS) } /** @@ -291,322 +116,37 @@ export function useTuner(activeTuning: Ref) { * If the string was already marked tuned, un-mark it so it gets re-checked. */ function selectString(index: number) { - if (tunedStrings.value.has(index)) { - const next = new Set(tunedStrings.value) - next.delete(index) - tunedStrings.value = next - } - lockedStringIndex.value = index - resetStringProgress() - } - - // --- Audio processing (called on every Engine tick at ~60fps) --- - function processTick({ pitch, clarity, rms }: AudioFrame) { - const now = performance.now() - const isDisplayFrame = now - lastDisplayTime >= DISPLAY_INTERVAL_MS - const isLogFrame = now - lastLogTime >= LOG_INTERVAL_MS - - // Dual clarity gate: tighter when RMS is low (decaying string has worse SNR). - // Both thresholds come from INSTRUMENT_CONFIGS so bass/guitar/ukulele/violin - // each use appropriate values for their sustain characteristics. - const clarityGate = rms < LOW_RMS_THRESHOLD ? cfg.decayClarityThreshold : cfg.clarityThreshold - // Frequency window rejects pitches outside ±15% of the locked fundamental, - // blocking harmonics of other strings that fall outside this narrow band. - const hasSignal = clarity > clarityGate && pitch >= minFreq && pitch <= maxFreq - - tickTotal++ - if (isLogFrame) { - lastLogTime = now - const lockedFreq = activeTuning.value.tuning[lockedStringIndex.value].frequency - const stringName = activeTuning.value.tuning[lockedStringIndex.value].note - slog( - `t=${(now / 1000).toFixed(2)}s str=${stringName}(${lockedFreq.toFixed(1)}Hz)` + - ` pitch=${pitch.toFixed(1)}Hz clarity=${clarity.toFixed( - 3, - )} rms=${rms.toFixed(4)} gate=${clarityGate.toFixed(3)}` + - ` window=[${minFreq.toFixed(1)}-${maxFreq.toFixed(1)}]` + - ` hintWindow=[${hintMinFreq.toFixed(1)}-${hintMaxFreq.toFixed(1)}]` + - ` hasSignal=${hasSignal}` + - ` fineEntered=${hasEnteredFineWindow}` + - ` clarityOk=${clarity > clarityGate}` + - ` inFine=${pitch >= minFreq && pitch <= maxFreq}` + - ` inHint=${pitch >= hintMinFreq && pitch <= hintMaxFreq}`, - ) - } - - if (hasSignal) { - hasEnteredFineWindow = true - tickHasSignal++ - lastGoodSignalTime = now - - // --- Median filter --- - // Rolling buffer of the last PITCH_BUFFER_SIZE raw pitches. - // Median is more robust than mean against occasional octave-error spikes. - pitchHistory.push(pitch) - if (pitchHistory.length > PITCH_BUFFER_SIZE) pitchHistory.shift() - const medianPitch = median(pitchHistory) - - // --- Octave-fold correction --- - // If pitchy latches onto an upper harmonic (e.g. 2nd harmonic of Low E), - // dividing by N=2..6 may bring it within 300c of the target. We prefer - // that folded value when it improves the match by >400c. - const lockedFreq = activeTuning.value.tuning[lockedStringIndex.value].frequency - const stablePitch = foldTowardTarget(medianPitch, lockedFreq) - - // --- Pitch continuity gate --- - // Reject frames where the smoothed cents would jump by more than - // PITCH_CONTINUITY_CENTS in a single tick (transient noise or string change). - const rawCents = centsBetween(stablePitch, lockedFreq) - if (smoothedCents !== null && Math.abs(rawCents - smoothedCents) > PITCH_CONTINUITY_CENTS) { - tickContinuityRejected++ - slog( - ` CONTINUITY_REJECTED jump=${Math.abs(rawCents - smoothedCents).toFixed( - 0, - )}¢ (limit=${PITCH_CONTINUITY_CENTS}¢)`, - ) - return - } - - // --- EMA smoothing --- - // Exponential moving average over the raw-cents readings. - // alpha=0.04 at 60fps gives ~500ms settling time — heavy enough - // to prevent needle jitter without hiding genuine pitch drift. - smoothedCents = - smoothedCents === null - ? rawCents - : smoothedCents + CENTS_EMA_ALPHA * (rawCents - smoothedCents) - const displayCents = Math.round(smoothedCents) - - // --- Presentation write (~30fps) --- - // Only update Vue reactive refs on display frames to keep the reactive - // system from thrashing. Engine state (smoothedCents, stableStartTime) - // is updated every tick regardless. - if (isDisplayFrame) { - lastDisplayTime = now - frequency.value = Math.round(stablePitch * 10) / 10 - cents.value = displayCents - needleCents.value = smoothedCents - signalClarity.value = clarity - } - - // --- Hint + stability ring --- - // stableStartTime tracks when the pitch first entered the ACCEPT_CENTS - // window. cfg.stableMs varies by instrument (600ms violin – 1500ms bass). - // advanceToNextUntuned() is called exactly once per string via `advancing`. - if (Math.abs(displayCents) <= ACCEPT_CENTS) { - outOfRangeStart = null - if (stableStartTime === null) stableStartTime = now - const elapsed = now - stableStartTime - if (isDisplayFrame) { - hint.value = 'in-range' - inRangeGraceUntil = now + HINT_GRACE_MS - stabilityProgress.value = Math.min(1, elapsed / cfg.stableMs) - } - if (elapsed >= cfg.stableMs && !advancing) { - advancing = true - slog(`STRING_CONFIRMED str=${lockedStringIndex.value} after ${elapsed.toFixed(0)}ms`) - const completedIdx = lockedStringIndex.value - const next = new Set(tunedStrings.value) - next.add(completedIdx) - tunedStrings.value = next - advanceToNextUntuned(completedIdx) - } - } else { - if (isDisplayFrame) { - hint.value = - now < inRangeGraceUntil ? 'in-range' : displayCents > 0 ? 'too-high' : 'too-low' - } - if (Math.abs(displayCents) > STABILITY_RESET_CENTS) { - if (outOfRangeStart === null) outOfRangeStart = now - if (now - outOfRangeStart >= STABILITY_RESET_MS) { - stableStartTime = null - outOfRangeStart = null - if (isDisplayFrame) stabilityProgress.value = 0 - } - } else { - outOfRangeStart = null - } - } - } else { - // --- Overtone fold-and-route --- - // Pitchy sometimes returns a strong harmonic instead of the fundamental, - // especially on Low E/B at peak attack (rms high, 2× harmonic dominates). - // Previously we only refreshed the latch; now we attempt to fold the harmonic - // down to the fundamental and, if it lands in the fine window, route it through - // the normal hasSignal path so it contributes to stability progress. - const lockedFreqForOvertone = activeTuning.value.tuning[lockedStringIndex.value].frequency - if (clarity > cfg.clarityThreshold && isHarmonicOf(pitch, lockedFreqForOvertone)) { - tickOvertone++ - const foldedPitch = foldTowardTarget(pitch, lockedFreqForOvertone) - if (foldedPitch >= minFreq && foldedPitch <= maxFreq) { - // Folded pitch is in the fine window — treat it as a valid hasSignal tick. - if (isLogFrame) - slog( - ` OVERTONE_FOLDED pitch=${pitch.toFixed( - 1, - )}Hz → ${foldedPitch.toFixed(1)}Hz (in fine window)`, - ) - hasEnteredFineWindow = true - lastGoodSignalTime = now - pitchHistory.push(foldedPitch) - if (pitchHistory.length > PITCH_BUFFER_SIZE) pitchHistory.shift() - const medianPitch = median(pitchHistory) - const rawCents = centsBetween(medianPitch, lockedFreqForOvertone) - if (smoothedCents !== null && Math.abs(rawCents - smoothedCents) > PITCH_CONTINUITY_CENTS) - return - smoothedCents = - smoothedCents === null - ? rawCents - : smoothedCents + CENTS_EMA_ALPHA * (rawCents - smoothedCents) - const displayCents = Math.round(smoothedCents) - if (isDisplayFrame) { - lastDisplayTime = now - frequency.value = Math.round(foldedPitch * 10) / 10 - cents.value = displayCents - needleCents.value = smoothedCents - signalClarity.value = clarity - } - if (Math.abs(displayCents) <= ACCEPT_CENTS) { - outOfRangeStart = null - if (stableStartTime === null) stableStartTime = now - const elapsed = now - stableStartTime - if (isDisplayFrame) { - hint.value = 'in-range' - inRangeGraceUntil = now + HINT_GRACE_MS - stabilityProgress.value = Math.min(1, elapsed / cfg.stableMs) - } - if (elapsed >= cfg.stableMs && !advancing) { - advancing = true - slog( - `STRING_CONFIRMED str=${ - lockedStringIndex.value - } after ${elapsed.toFixed(0)}ms (via overtone fold)`, - ) - const completedIdx = lockedStringIndex.value - const next = new Set(tunedStrings.value) - next.add(completedIdx) - tunedStrings.value = next - advanceToNextUntuned(completedIdx) - } - } else if (isDisplayFrame) { - hint.value = - now < inRangeGraceUntil ? 'in-range' : displayCents > 0 ? 'too-high' : 'too-low' - } - } else { - // Folded pitch still outside fine window — just refresh latch as before. - if (isLogFrame) - slog( - ` OVERTONE_LATCH pitch=${pitch.toFixed( - 1, - )}Hz harmonic of ${lockedFreqForOvertone.toFixed(1)}Hz`, - ) - lastGoodSignalTime = now - } - return - } - - // --- Coarse hint (heavily out of tune) --- - // Only active before the pitch has ever entered the ±15% fine-tuning window - // for this string. Once hasEnteredFineWindow is set, this path is disabled - // so it cannot flicker back on mid-tune if the pitch briefly dips outside - // the acceptance window. Resets when the string resets (selectString / advance). - // Suppress coarse hint if the pitch is a harmonic of an already-tuned string - // (sympathetic resonance from a recently confirmed string can produce a - // spurious too-high/too-low flash before the user plucks the next string). - const isSympathetic = [...tunedStrings.value].some((idx) => { - const f = activeTuning.value.tuning[idx].frequency - return isHarmonicOf(pitch, f) || isHarmonicOf(f, pitch) - }) - if ( - !hasEnteredFineWindow && - !isSympathetic && - clarity > cfg.clarityThreshold && - pitch >= hintMinFreq && - pitch <= hintMaxFreq - ) { - tickCoarseHint++ - lastGoodSignalTime = now - smoothedCents = null - pitchHistory = [] - stableStartTime = null - const rawCents = centsBetween(pitch, lockedFreqForOvertone) - if (isLogFrame) - slog( - ` COARSE_HINT pitch=${pitch.toFixed(1)}Hz cents=${ - rawCents > 0 ? '+' : '' - }${rawCents}¢ hint=${rawCents > 0 ? 'too-high' : 'too-low'}`, - ) - if (isDisplayFrame) { - lastDisplayTime = now - frequency.value = Math.round(pitch * 10) / 10 - cents.value = rawCents - needleCents.value = rawCents - hint.value = rawCents > 0 ? 'too-high' : 'too-low' - signalClarity.value = clarity - stabilityProgress.value = 0 - } - return - } - - // --- Latch-and-Fade --- - // Keep the display alive for SIGNAL_HOLD_MS after the last valid frame. - // This bridges the natural decay gap when a string fades to silence, - // preventing the needle from snapping to blank between plucks. - // needleCents is intentionally NOT cleared — needle holds its last position. - pitchHistory = [] - const held = now - lastGoodSignalTime < SIGNAL_HOLD_MS - if (!held) { - tickSilence++ - stableStartTime = null - outOfRangeStart = null - inRangeGraceUntil = 0 - if (isDisplayFrame) { - lastDisplayTime = now - frequency.value = null - cents.value = null - hint.value = null - stabilityProgress.value = 0 - signalClarity.value = 0 - // needleCents intentionally NOT cleared — needle holds last position - } - } else if (isDisplayFrame && now < inRangeGraceUntil) { - hint.value = 'in-range' - } - } + engine.selectString(index) + sync() } async function start() { - sessionLog = [] - tickTotal = 0 - tickHasSignal = 0 - tickCoarseHint = 0 - tickOvertone = 0 - tickSilence = 0 - tickContinuityRejected = 0 - slog( + log.clear() + engine.resetCounters() + const cfg = engine.config + log.add( `=== TUNER SESSION START === instrument=${activeTuning.value.category} tuning=${activeTuning.value.name}`, ) - slog( + log.add( `cfg: fftSize=${cfg.primaryFftSize} stableMs=${cfg.stableMs} clarityThreshold=${cfg.clarityThreshold} decayThreshold=${cfg.decayClarityThreshold}`, ) resetState() await startCapture(processTick, { primaryFftSize: cfg.primaryFftSize }) - // LPF watcher fires before the audio graph exists; set it now for string 0. + // The LPF watcher fires before the audio graph exists; set it now for string 0. updateLpf() } function stop() { stopCapture() - slog(`=== TUNER SESSION STOP ===`) - slog( - `ticks: total=${tickTotal} hasSignal=${tickHasSignal} coarseHint=${tickCoarseHint} overtone=${tickOvertone} silence=${tickSilence} continuityRejected=${tickContinuityRejected}`, + const c = engine.counters + log.add(`=== TUNER SESSION STOP ===`) + log.add( + `ticks: total=${c.total} hasSignal=${c.hasSignal} coarseHint=${c.coarseHint} overtone=${c.overtone} silence=${c.silence} continuityRejected=${c.continuityRejected}`, ) - slog(`tunedStrings=${[...tunedStrings.value].join(',') || 'none'} allTuned=${allTuned.value}`) - console.log( - '\n===== TUNER SESSION LOG (paste to Copilot) =====\n' + - sessionLog.join('\n') + - '\n================================================\n', + log.add( + `tunedStrings=${[...engine.tunedStrings].join(',') || 'none'} allTuned=${engine.allTuned}`, ) + log.print() resetState() } diff --git a/src/composables/virtualGuitar.test.ts b/src/composables/virtualGuitar.test.ts index a235112..3375ced 100644 --- a/src/composables/virtualGuitar.test.ts +++ b/src/composables/virtualGuitar.test.ts @@ -136,10 +136,7 @@ describe('a string out of tune', () => { }) describe('silence', () => { - // Known: below its RMS gate useAudioCapture sends no frames at all, so useTuner's 500 ms - // latch-and-fade never runs: "Hold steady…" and a half-full ring stay on screen while - // nothing is playing. `it.fails` passes while that is so; make it `it` once it is fixed. - it.fails('clears the reading and the ring within a second after the string stops', async () => { + it('clears the reading and the ring within a second after the string stops', async () => { const guitar = preset('std6') const instrument = new VirtualInstrument() installFakeAudio(instrument) diff --git a/src/data/tunings.test.ts b/src/data/tunings.test.ts index 9aa9c04..362b2b4 100644 --- a/src/data/tunings.test.ts +++ b/src/data/tunings.test.ts @@ -42,9 +42,9 @@ describe('PRESET_TUNINGS', () => { expect(new Set(ids).size).toBe(ids.length) }) - // Known: 'bass_dropd5' (Drop D 5) has the same notes as 'bass_std5' (Standard 5). - // `it.fails` passes while that is so; turn it back into `it` once the preset is fixed. - it.fails('has no two presets of the same instrument with the same notes', () => { + it('has no two presets of the same instrument with the same notes, except named aliases', () => { + // A tenor ukulele with a low G is tuned like 'Low G (GCEA)': listed under its own name on purpose + const aliases = ['uke_tenor = uke_low_g'] const seen = new Map() const duplicates: string[] = [] for (const t of PRESET_TUNINGS) { @@ -53,7 +53,7 @@ describe('PRESET_TUNINGS', () => { if (other) duplicates.push(`${t.id} = ${other}`) else seen.set(key, t.id) } - expect(duplicates).toEqual([]) + expect(duplicates).toEqual(aliases) }) describe.each(PRESET_TUNINGS.map((t) => [t.id, t] as const))('%s', (_id, preset) => { diff --git a/src/data/tunings.ts b/src/data/tunings.ts index 908ec02..bedcdb7 100644 --- a/src/data/tunings.ts +++ b/src/data/tunings.ts @@ -223,7 +223,8 @@ export const PRESET_TUNINGS: readonly TuningPreset[] = [ name: 'Drop D 5', strings: 5, category: 'bass', - tuning: [s('B', 0), s('E', 1), s('A', 1), s('D', 2), s('G', 2)], + // Standard 5 with the E string dropped a whole tone to D + tuning: [s('B', 0), s('D', 1), s('A', 1), s('D', 2), s('G', 2)], }, { id: 'bass_std6', diff --git a/src/i18n.ts b/src/i18n.ts index 25763db..f40b1cf 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -1,3 +1,4 @@ +import { watch } from 'vue' import { createI18n } from 'vue-i18n' import { loadSettings } from './composables/useSettings' import en from './locales/en.json' @@ -12,3 +13,12 @@ export const i18n = createI18n({ fallbackLocale: 'en', messages: { en, it, zh }, }) + +// Keep on the language shown, for screen readers, hyphenation and translators +watch( + i18n.global.locale, + (locale) => { + document.documentElement.lang = locale + }, + { immediate: true }, +) diff --git a/src/main.ts b/src/main.ts index 777e9fa..6b19ff5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,12 +1,8 @@ +// Global styles first: theme tokens, page background and resets. Each component carries its +// own scoped styles, which come after them. +import './style.css' import { createApp } from 'vue' import App from './App.vue' import { i18n } from './i18n' -import './style.css' -import './styles/CentsMeter.css' -import './styles/GuitarTuner.css' -import './styles/SettingsMenu.css' -import './styles/StringChips.css' -import './styles/TunerRing.css' -import './styles/TuningSelector.css' createApp(App).use(i18n).mount('#app') diff --git a/src/styles/CentsMeter.css b/src/styles/CentsMeter.css deleted file mode 100644 index bafb4bf..0000000 --- a/src/styles/CentsMeter.css +++ /dev/null @@ -1,69 +0,0 @@ -.meter-wrapper { - width: 100%; - max-width: 300px; -} -.meter-track { - position: relative; - height: 6px; - background: var(--surface-raised); - border-radius: 3px; - overflow: visible; -} -.meter-range { - position: absolute; - left: 45%; - width: 10%; - top: -2px; - height: 10px; - background: color-mix(in srgb, var(--green) 20%, transparent); - border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); - border-radius: 3px; - pointer-events: none; -} -.meter-center { - position: absolute; - left: 50%; - top: -5px; - transform: translateX(-50%); - width: 2px; - height: 16px; - background: var(--meter-center); - border-radius: 1px; -} -.meter-needle { - position: absolute; - top: -7px; - width: 4px; - height: 20px; - background: var(--needle); - border-radius: 2px; - transform: translateX(-50%); - transition: - left 0.08s ease-out, - background 0.2s; -} -.meter-needle.in-tune { - background: var(--green); -} -.meter-needle.off { - background: var(--red); -} - -.meter-labels { - display: flex; - justify-content: space-between; - margin-top: 7px; - font-size: 0.62rem; - color: var(--meter-labels); -} - -/* ── Floating card breakpoint ────────────────────────────────────────────── */ -@media (min-width: 640px) and (min-height: 640px) { - .meter-wrapper { - max-width: 380px; - } - .meter-labels { - font-size: 0.72rem; - margin-top: 9px; - } -} diff --git a/src/styles/GuitarTuner.css b/src/styles/GuitarTuner.css deleted file mode 100644 index fddd178..0000000 --- a/src/styles/GuitarTuner.css +++ /dev/null @@ -1,314 +0,0 @@ -/* ── Layout wrapper ─────────────────────────────────────────────────────── */ -.tuner { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - min-height: 100dvh; - gap: 0.9rem; - color: var(--text-primary); - font-family: 'Elms Sans', system-ui, sans-serif; - box-sizing: border-box; - width: 100%; -} - -/* ── Top bar ─────────────────────────────────────────────────────────────── */ -.top-bar { - display: flex; - align-items: center; - gap: 0.5rem; - justify-content: center; - width: 100%; -} - -/* ── Central glass card — fullscreen by default ─────────────────────────── */ -/* border-radius and max-width are added only in the floating-card query. */ -.center-card { - display: flex; - flex-direction: column; - align-items: center; - gap: 0.9rem; - width: 100%; - min-height: 100dvh; - justify-content: center; - padding: max(env(safe-area-inset-top), 1.25rem) max(env(safe-area-inset-right), 1.5rem) - max(env(safe-area-inset-bottom), 1.5rem) max(env(safe-area-inset-left), 1.5rem); - background: var(--card-bg); - backdrop-filter: var(--card-blur); - -webkit-backdrop-filter: var(--card-blur); - box-shadow: var(--card-shadow); -} - -/* ── Ring section ────────────────────────────────────────────────────────── */ -.ring-section { - display: flex; - flex-direction: column; - align-items: center; - gap: 0.5rem; -} - -/* ── Controls section (meter + button stacked) ───────────────────────────── */ -.controls-section { - display: flex; - flex-direction: column; - align-items: center; - gap: 0.75rem; - width: 100%; - max-width: 320px; -} - -/* ── Tuning bar ──────────────────────────────────────────────────────────── */ -.tuning-bar { - display: flex; - align-items: center; - gap: 0.5rem; - background: rgba(255, 255, 255, 0.07); - border: 1px solid rgba(255, 255, 255, 0.1); - border-radius: 50px; - padding: 0.45rem 1.1rem; - cursor: pointer; - color: var(--text-secondary); - transition: - background 0.15s, - border-color 0.15s, - color 0.15s; -} -.tuning-bar:hover { - background: rgba(255, 255, 255, 0.13); - border-color: rgba(255, 255, 255, 0.2); - color: var(--text-primary); -} -.tuning-name { - font-size: 0.9rem; - font-weight: 500; -} -.tuning-strings { - font-size: 0.72rem; - color: var(--text-faint); -} -.tuning-arrow { - font-size: 1rem; - color: var(--text-faint); - margin-left: auto; -} - -/* ── Settings button ────────────────────────────────────────────────────── */ -.settings-btn { - display: flex; - align-items: center; - justify-content: center; - width: 2rem; - height: 2rem; - border-radius: 50%; - border: 1px solid rgba(255, 255, 255, 0.1); - background: rgba(255, 255, 255, 0.07); - color: var(--text-secondary); - font-size: 1rem; - cursor: pointer; - flex-shrink: 0; - transition: - background 0.15s, - border-color 0.15s, - color 0.15s; -} -.settings-btn:hover { - background: rgba(255, 255, 255, 0.14); - border-color: rgba(255, 255, 255, 0.22); - color: var(--text-primary); -} - -/* ── All tuned ───────────────────────────────────────────────────────────── */ -.all-tuned { - display: flex; - flex-direction: column; - align-items: center; - gap: 0.5rem; - padding: 2rem 0; -} -.all-tuned-icon { - font-size: 4rem; - color: var(--green); - line-height: 1; -} -.all-tuned-text { - font-size: 1.1rem; - font-weight: 500; - color: var(--green); - letter-spacing: 0.05em; -} - -/* ── Info row ────────────────────────────────────────────────────────────── */ -.info-row { - display: flex; - gap: 1rem; - align-items: center; -} -.string-label { - font-size: 0.8rem; - color: var(--text-faint); -} -.frequency { - font-size: 0.8rem; - color: var(--text-dim); - min-width: 70px; - text-align: right; -} - -/* ── Hint ────────────────────────────────────────────────────────────────── */ -.hint { - font-size: 0.95rem; - font-weight: 600; - min-height: 1.4rem; - letter-spacing: 0.03em; - transition: color 0.15s; - color: var(--text-dim); -} -.hint.too-high { - color: var(--red); -} -.hint.too-low { - color: var(--blue); -} -.hint.in-range { - color: var(--green); -} - -/* ── Error ───────────────────────────────────────────────────────────────── */ -.error { - color: var(--red); - font-size: 0.8rem; - text-align: center; - margin: 0; -} - -/* ── Start/Stop ──────────────────────────────────────────────────────────── */ -.toggle-btn { - margin-top: 0.5rem; - padding: 0.9rem 3.5rem; - font-size: 1rem; - font-weight: 600; - letter-spacing: 0.1em; - border: none; - border-radius: 50px; - cursor: pointer; - background: var(--accent-dim); - color: var(--accent); - transition: - background 0.2s, - transform 0.1s; -} -.toggle-btn:active { - transform: scale(0.97); -} -.toggle-btn.active { - background: var(--red-stop); - color: #fff; -} - -/* ── Sheet transition ────────────────────────────────────────────────────── */ -.sheet-enter-active, -.sheet-leave-active { - transition: - opacity 0.2s, - transform 0.25s cubic-bezier(0.32, 0.72, 0, 1); -} -.sheet-enter-from, -.sheet-leave-to { - opacity: 0; - transform: translateY(100%); -} - -/* ── Fullscreen: when either dimension is too small for a floating card ───── */ -/* Fires when width < 640 OR height < 640 — already the default above. */ -/* This block resets .tuner layout for the fullscreen case. */ -@media (max-width: 639px), (max-height: 639px) { - .tuner { - gap: 0; - align-items: stretch; - justify-content: stretch; - } -} - -/* ── Landscape short: two-column grid ───────────────────────────────────── */ -@media (orientation: landscape) and (max-height: 639px) { - .center-card { - display: grid; - grid-template-columns: 1fr 1fr; - grid-template-rows: auto 1fr auto; - grid-template-areas: - 'topbar topbar' - 'chips ring' - 'controls ring'; - align-items: start; - padding: 0.75rem 1.25rem; - gap: 0.4rem 1.5rem; - justify-content: unset; - } - .top-bar { - grid-area: topbar; - } - .strings-display { - grid-area: chips; - justify-content: flex-start; - } - .ring-section { - grid-area: ring; - grid-row: 2 / 4; - align-self: center; - justify-self: center; - } - .controls-section { - grid-area: controls; - max-width: none; - align-self: end; - } - .all-tuned { - grid-column: 1 / -1; - padding: 1rem 0; - } - .ring-wrapper { - width: 140px; - height: 140px; - } - .note-name { - font-size: 2.75rem; - } - .note-octave { - font-size: 1.1rem; - } - .toggle-btn { - padding: 0.7rem 2.5rem; - font-size: 0.9rem; - } -} - -/* ── Floating card: both dimensions ≥640px ──────────────────────────────── */ -@media (min-width: 640px) and (min-height: 640px) { - .tuner { - padding: max(env(safe-area-inset-top), 1rem) max(env(safe-area-inset-right), 1.25rem) - max(env(safe-area-inset-bottom), 1.5rem) max(env(safe-area-inset-left), 1.25rem); - } - .center-card { - min-height: auto; - max-width: 500px; - border-radius: 28px; - padding: 2rem 2.5rem 2.25rem; - gap: 1.25rem; - } - .controls-section { - max-width: 380px; - } - .tuning-name { - font-size: 1.05rem; - } - .tuning-strings { - font-size: 0.82rem; - } - .string-label, - .frequency { - font-size: 0.92rem; - } - .all-tuned-text { - font-size: 1.25rem; - } -} diff --git a/src/styles/SettingsMenu.css b/src/styles/SettingsMenu.css deleted file mode 100644 index 50d7685..0000000 --- a/src/styles/SettingsMenu.css +++ /dev/null @@ -1,98 +0,0 @@ -.settings-overlay { - position: fixed; - inset: 0; - background: rgba(0, 0, 0, 0.6); - display: flex; - align-items: flex-end; - z-index: 100; -} - -.settings-sheet { - width: 100%; - background: var(--surface); - border-radius: 16px 16px 0 0; - display: flex; - flex-direction: column; - overflow: hidden; - padding-bottom: max(env(safe-area-inset-bottom), 1rem); -} - -.sheet-header { - display: flex; - align-items: center; - justify-content: space-between; - padding: 1rem 1.25rem 0.75rem; - border-bottom: 1px solid var(--border); - flex-shrink: 0; -} - -.sheet-title { - font-size: 1rem; - font-weight: 600; - letter-spacing: 0.05em; - color: var(--text-primary); -} - -.close-btn { - background: none; - border: none; - color: var(--text-muted); - font-size: 1.1rem; - cursor: pointer; - padding: 0.25rem; - line-height: 1; -} -.close-btn:hover { - color: var(--text-primary); -} - -.sheet-body { - display: flex; - flex-direction: column; - gap: 1.25rem; - padding: 1.25rem; -} - -.settings-section { - display: flex; - flex-direction: column; - gap: 0.5rem; -} - -.settings-label { - font-size: 0.7rem; - font-weight: 600; - text-transform: uppercase; - letter-spacing: 0.09em; - color: var(--text-muted); -} - -.options-row { - display: flex; - gap: 0.5rem; -} - -.option-btn { - flex: 1; - padding: 0.55rem 0.75rem; - border-radius: 10px; - border: none; - background: transparent; - color: var(--text-muted); - font-size: 0.9rem; - font-weight: 500; - font-family: 'Elms Sans', system-ui, sans-serif; - cursor: pointer; - transition: - background 0.15s, - color 0.15s; -} -.option-btn:hover { - background: var(--surface-raised); - color: var(--text-primary); -} -.option-btn.active { - background: var(--accent-dim); - color: var(--accent); - font-weight: 600; -} diff --git a/src/styles/StringChips.css b/src/styles/StringChips.css deleted file mode 100644 index 30f461f..0000000 --- a/src/styles/StringChips.css +++ /dev/null @@ -1,120 +0,0 @@ -.strings-display { - display: flex; - gap: 0.4rem; - flex-wrap: wrap; - justify-content: center; -} - -.string-chip { - display: flex; - flex-direction: column; - align-items: center; - padding: 0.35rem 0.5rem; - border-radius: 9px; - background: var(--surface-low); - border: 2px solid var(--border-chip); - cursor: pointer; - min-width: 34px; - transition: - border-color 0.15s, - background 0.15s, - transform 0.1s; -} -.string-chip:not(:disabled):hover { - background: var(--surface-raised); - border-color: var(--text-muted); -} -.string-chip:not(:disabled):active { - transform: scale(0.93); -} -.string-chip:disabled { - cursor: default; -} - -.string-chip.tuned { - background: color-mix(in srgb, var(--green) 15%, transparent); - border-color: var(--green); -} -.string-chip.locked { - border-color: var(--needle); - background: var(--surface-raised); -} -.string-chip.tuned.locked { - background: color-mix(in srgb, var(--green) 20%, transparent); - border-color: var(--green-bright); -} -.string-chip.pinned { - border-color: var(--amber) !important; - background: color-mix(in srgb, var(--amber) 12%, transparent) !important; -} -.string-chip.pinned .chip-note { - color: var(--amber) !important; -} -.string-chip.pinned .chip-num { - color: var(--amber-dark) !important; -} -/* Ghost detector "searching" state — dimmed pulse while confidence builds */ -.string-chip.searching { - border-color: var(--text-muted); - background: var(--surface-raised); - opacity: 0.65; - animation: chip-searching 0.9s ease-in-out infinite alternate; -} -.string-chip.searching .chip-note { - color: var(--text-secondary); -} -@keyframes chip-searching { - from { - opacity: 0.45; - } - to { - opacity: 0.8; - } -} - -.chip-num { - font-size: 0.6rem; - color: var(--text-faint); - line-height: 1; -} -.chip-note { - font-size: 0.85rem; - font-weight: 700; - color: var(--chip-note); - line-height: 1.3; -} -.chip-octave { - font-size: 0.58rem; - color: var(--chip-octave); - line-height: 1; -} - -.string-chip.tuned .chip-note { - color: var(--green); -} -.string-chip.tuned .chip-num { - color: var(--green-dark); -} -.string-chip.locked .chip-note { - color: var(--needle); -} -.string-chip.locked .chip-num { - color: var(--text-secondary); -} - -/* ── Floating card breakpoint ────────────────────────────────────────────── */ -@media (min-width: 640px) and (min-height: 640px) { - .string-chip { - min-width: 40px; - padding: 0.45rem 0.65rem; - } - .chip-num { - font-size: 0.68rem; - } - .chip-note { - font-size: 1rem; - } - .chip-octave { - font-size: 0.65rem; - } -} diff --git a/src/styles/TunerRing.css b/src/styles/TunerRing.css deleted file mode 100644 index 6176c06..0000000 --- a/src/styles/TunerRing.css +++ /dev/null @@ -1,59 +0,0 @@ -.ring-wrapper { - position: relative; - width: 190px; - height: 190px; - display: flex; - align-items: center; - justify-content: center; -} -.ring-svg { - position: absolute; - inset: 0; - width: 100%; - height: 100%; -} -.ring-track { - stroke: var(--surface-raised); -} -.ring-progress { - stroke: var(--green); -} - -.note-display { - position: relative; - z-index: 1; - display: flex; - align-items: baseline; - gap: 0.15rem; - color: var(--note-idle); - transition: color 0.2s; -} -.note-display.in-tune { - color: var(--green); -} -.note-display.off { - color: var(--red); -} - -.note-name { - font-size: 4rem; - font-weight: 700; - line-height: 1; -} -.note-octave { - font-size: 1.5rem; - font-weight: 300; -} - -@media (min-width: 640px) and (min-height: 640px) { - .ring-wrapper { - width: 230px; - height: 230px; - } - .note-name { - font-size: 5rem; - } - .note-octave { - font-size: 1.8rem; - } -} diff --git a/src/styles/TuningSelector.css b/src/styles/TuningSelector.css deleted file mode 100644 index afc9d1e..0000000 --- a/src/styles/TuningSelector.css +++ /dev/null @@ -1,235 +0,0 @@ -.selector-overlay { - position: fixed; - inset: 0; - background: rgba(0, 0, 0, 0.6); - display: flex; - align-items: flex-end; - z-index: 100; -} - -.selector-sheet { - width: 100%; - max-height: 82dvh; - background: var(--surface); - border-radius: 16px 16px 0 0; - display: flex; - flex-direction: column; - overflow: hidden; - padding-bottom: max(env(safe-area-inset-bottom), 0.5rem); -} - -.sheet-header { - display: flex; - align-items: center; - justify-content: space-between; - padding: 1rem 1.25rem 0.75rem; - border-bottom: 1px solid var(--border); - flex-shrink: 0; -} - -.sheet-title { - font-size: 1rem; - font-weight: 600; - letter-spacing: 0.05em; - color: var(--text-primary); -} - -.close-btn { - background: none; - border: none; - color: var(--text-muted); - font-size: 1.1rem; - cursor: pointer; - padding: 0.25rem; - line-height: 1; -} -.close-btn:hover { - color: var(--text-primary); -} - -/* ── Category tabs ─────────────────────────────────────────────────────────── */ -.category-tabs { - display: flex; - padding: 0.75rem 1rem 0; - gap: 0.5rem; - flex-shrink: 0; -} - -.cat-tab { - flex: 1; - padding: 0.5rem 0.25rem; - border-radius: 8px; - border: none; - background: transparent; - color: var(--text-muted); - font-size: 0.85rem; - font-weight: 500; - font-family: 'Elms Sans', system-ui, sans-serif; - cursor: pointer; - transition: - background 0.15s, - color 0.15s; -} -.cat-tab:hover { - background: var(--surface-raised); - color: var(--text-primary); -} -.cat-tab.active { - background: var(--accent-dim); - border: none; - color: var(--accent); - font-weight: 600; -} - -/* ── Search ────────────────────────────────────────────────────────────────── */ -.search-row { - display: flex; - align-items: center; - margin: 0.6rem 1rem 0.5rem; - background: var(--surface-low); - border: none; - border-radius: 10px; - padding: 0 0.75rem; - gap: 0.5rem; - flex-shrink: 0; -} - -.search-icon { - font-size: 0.85rem; - color: var(--text-muted); - flex-shrink: 0; -} - -.search-input { - flex: 1; - background: none; - border: none; - outline: none; - padding: 0.55rem 0; - font-size: 0.9rem; - font-family: 'Elms Sans', system-ui, sans-serif; - color: var(--text-primary); - user-select: text; - -webkit-user-select: text; -} -.search-input::placeholder { - color: var(--text-faint); -} -.search-input::-webkit-search-cancel-button { - display: none; -} - -.search-clear { - background: none; - border: none; - color: var(--text-muted); - font-size: 0.8rem; - cursor: pointer; - padding: 0; - line-height: 1; - flex-shrink: 0; -} -.search-clear:hover { - color: var(--text-primary); -} - -/* ── Tuning list ───────────────────────────────────────────────────────────── */ -.tuning-list { - overflow-y: auto; - padding: 0 1rem; - flex: 1; - display: grid; - grid-template-columns: 1fr; - gap: 0.5rem; - align-content: start; - padding-bottom: 0.75rem; -} - -@media (orientation: landscape) { - .tuning-list { - grid-template-columns: repeat(2, 1fr); - } -} - -.no-results { - grid-column: 1 / -1; - text-align: center; - color: var(--text-muted); - font-size: 0.9rem; - padding: 1.5rem 0; - margin: 0; -} - -.tuning-card { - background: transparent; - border: none; - border-radius: 10px; - padding: 0.6rem 0.75rem; - cursor: pointer; - text-align: left; - transition: background 0.15s; - width: 100%; -} -.tuning-card:hover { - background: var(--surface-low); -} -.tuning-card.selected { - background: var(--accent-dim); -} - -.card-top { - display: flex; - align-items: center; - gap: 0.4rem; - margin-bottom: 0.35rem; -} - -.card-name { - font-size: 0.85rem; - font-weight: 600; - color: var(--text-primary); - flex: 1; -} -.tuning-card.selected .card-name { - color: var(--accent); -} - -.card-strings { - font-size: 0.65rem; - color: var(--text-faint); - font-weight: 500; -} - -.badge-custom { - font-size: 0.6rem; - background: var(--surface-raised); - color: var(--text-secondary); - border-radius: 4px; - padding: 1px 4px; -} - -.delete-btn { - background: none; - border: none; - color: var(--red); - font-size: 0.75rem; - cursor: pointer; - padding: 0; - line-height: 1; -} - -.card-notes { - display: flex; - gap: 0.3rem; - flex-wrap: wrap; -} - -.string-note { - font-size: 1.05rem; - color: var(--chip-note); - font-family: 'Courier New', monospace; -} -.string-note sub { - font-size: 0.72rem; - color: var(--text-faint); -} diff --git a/src/tuner/engine.ts b/src/tuner/engine.ts new file mode 100644 index 0000000..a9c919b --- /dev/null +++ b/src/tuner/engine.ts @@ -0,0 +1,522 @@ +/** + * The tuning engine — a sequential string tuner, with no Vue and no audio APIs. + * + * Flow: + * 1. Start on string 0. Stay focused on it until confirmed in tune. + * 2. Once in tune, auto-advance to the next untuned string. + * 3. The user can pick any string to jump to it (resets its progress). + * 4. When all strings are confirmed tuned, report it (onAllTuned). + * + * No auto-string detection: the engine only ever listens for the locked string. + * It is fed one AudioFrame per tick (~60 fps) with the time of the tick, and keeps the values + * the UI shows in `display`, written at most every DISPLAY_INTERVAL_MS (~30 fps). + */ +import type { AudioFrame } from '../composables/useAudioCapture' +import type { TuningPreset } from '../data/tunings' +import { instrumentConfig, type InstrumentConfig } from './instruments' +import { centsBetween, foldTowardTarget, isHarmonicOf, median } from './pitch' +import type { SessionLog } from './sessionLog' + +/** Cents window considered "in tune" (±8¢ is comfortable for guitar) */ +export const ACCEPT_CENTS = 8 +/** Cents above ACCEPT_CENTS before we consider resetting stability (hysteresis) */ +const STABILITY_RESET_CENTS = 20 +/** How long (ms) pitch must remain outside before stability progress resets */ +const STABILITY_RESET_MS = 150 +/** Minimum ms between writes of the display values (~30fps) */ +const DISPLAY_INTERVAL_MS = 33 +/** EMA smoothing factor — 0.04 at 60fps ≈ 500ms settling time */ +const CENTS_EMA_ALPHA = 0.04 +/** RMS below which the SNR is too poor — apply tighter (decay) clarity gate */ +const LOW_RMS_THRESHOLD = 0.04 +/** Rolling median buffer size (22 × 16ms ≈ 350ms history) */ +const PITCH_BUFFER_SIZE = 22 +/** Max cents jump between EMA and incoming pitch before discarding as noise */ +const PITCH_CONTINUITY_CENTS = 500 +/** Wide hint window (±1 octave) — shows too-high/too-low even when heavily out of tune */ +const HINT_WINDOW_CENTS = 1200 +/** How long (ms) to hold the 'in-range' hint after pitch drifts slightly out */ +const HINT_GRACE_MS = 250 +/** How long (ms) to keep display alive after the last valid signal frame */ +export const SIGNAL_HOLD_MS = 500 +/** Logging interval (ms) — throttles log lines to ~2/s */ +const LOG_INTERVAL_MS = 500 + +export type TunerHint = 'too-high' | 'too-low' | 'in-range' | null + +/** What the UI shows */ +export interface TunerDisplay { + frequency: number | null + cents: number | null + hint: TunerHint + /** 0–1: progress toward confirming current string as in tune */ + stabilityProgress: number + /** Float cents for needle — holds last position on signal loss */ + needleCents: number | null + /** pitchy clarity (0–1) — drives needle opacity in the UI */ + signalClarity: number +} + +/** Ticks by outcome, for the session report */ +export interface TickCounters { + total: number + hasSignal: number + coarseHint: number + overtone: number + silence: number + continuityRejected: number +} + +export interface TunerEngine { + readonly display: Readonly + /** 0-based index into the tuning — the string currently being tuned */ + readonly lockedStringIndex: number + /** Indices of strings confirmed tuned (a new Set on every change) */ + readonly tunedStrings: ReadonlySet + readonly allTuned: boolean + readonly config: InstrumentConfig + readonly counters: Readonly + /** Analyse one frame heard at `now` (ms, performance.now()) */ + process(frame: AudioFrame, now: number): void + /** Jump to a string; if it was confirmed, un-mark it so it gets checked again */ + selectString(index: number): void + /** Use another tuning: its instrument's settings and frequency windows (state is kept) */ + setTuning(tuning: TuningPreset): void + /** Back to the first string, nothing tuned */ + reset(): void + resetCounters(): void + /** + * Blank the reading as the latch-and-fade does (the needle keeps its place). Only what is + * shown changes: the engine never reads `display`, so its analysis is not affected. + */ + clearDisplay(): void +} + +/** How a pitch that made it through the gates is taken in (see `acceptPitch`) */ +interface AcceptOptions { + /** Show this frame's pitch as the frequency instead of the median one */ + showFramePitch: boolean + /** Count and log the frames the continuity gate drops */ + reportRejects: boolean + /** Restart the stability timer when the pitch stays STABILITY_RESET_CENTS off */ + resetStabilityWhenOff: boolean + /** Appended to the confirmation log line */ + via: string +} + +/** A frame inside the ±15% window of the locked string */ +const DIRECT: AcceptOptions = { + showFramePitch: false, + reportRejects: true, + resetStabilityWhenOff: true, + via: '', +} + +/** + * A harmonic folded down into the window. It differs from DIRECT in three ways, kept as the + * engine always had them: the frequency shown is the folded frame's, a rejected jump is + * dropped silently, and staying off by more than STABILITY_RESET_CENTS does not restart the + * stability timer. + */ +const FOLDED_OVERTONE: AcceptOptions = { + showFramePitch: true, + reportRejects: false, + resetStabilityWhenOff: false, + via: ' (via overtone fold)', +} + +export function createTunerEngine( + initialTuning: TuningPreset, + { log, onAllTuned }: { log: SessionLog; onAllTuned: () => void }, +): TunerEngine { + let tuning = initialTuning + let cfg = instrumentConfig(tuning.category) + + const display: TunerDisplay = { + frequency: null, + cents: null, + hint: null, + stabilityProgress: 0, + needleCents: null, + signalClarity: 0, + } + let lockedStringIndex = 0 + let tunedStrings = new Set() + let allTuned = false + const counters: TickCounters = { + total: 0, + hasSignal: 0, + coarseHint: 0, + overtone: 0, + silence: 0, + continuityRejected: 0, + } + + // --- Per-string state (written every tick at ~60fps) --- + let stableStartTime: number | null = null + let smoothedCents: number | null = null + let advancing = false + let minFreq = 0 + let maxFreq = 0 + let hintMinFreq = 0 + let hintMaxFreq = 0 + /** True once the pitch has entered the ±15% acceptance window for the current string. + * Disables the wide coarse-hint path so it cannot flicker back mid-tune. */ + let hasEnteredFineWindow = false + let pitchHistory: number[] = [] + let outOfRangeStart: number | null = null + let inRangeGraceUntil = 0 + let lastGoodSignalTime = 0 + let lastDisplayTime = 0 + let lastLogTime = 0 + + // --- Frequency window (updated whenever the locked string or the tuning changes) --- + // Accepts only pitches within ±15% of the locked fundamental. + // ±15% is tight enough to reject adjacent open strings + // (e.g. B3 at 247Hz is 33% below E4 at 330Hz) while still + // covering a guitar that is severely out of tune. + function cacheFreqBounds() { + const idx = Math.min(lockedStringIndex, tuning.tuning.length - 1) + const lockedFreq = tuning.tuning[idx].frequency + minFreq = lockedFreq * 0.85 + maxFreq = lockedFreq * 1.15 + // ±1 octave — wide window for coarse hint when string is heavily out of tune + hintMinFreq = lockedFreq * 2 ** (-HINT_WINDOW_CENTS / 1200) + hintMaxFreq = lockedFreq * 2 ** (HINT_WINDOW_CENTS / 1200) + } + cacheFreqBounds() + + function lockString(index: number) { + lockedStringIndex = index + cacheFreqBounds() + } + + function resetStringProgress() { + stableStartTime = null + display.stabilityProgress = 0 + advancing = false + smoothedCents = null + hasEnteredFineWindow = false + pitchHistory = [] + outOfRangeStart = null + inRangeGraceUntil = 0 + lastGoodSignalTime = 0 + lastDisplayTime = 0 + display.frequency = null + display.cents = null + display.hint = null + display.needleCents = null + display.signalClarity = 0 + } + + function reset() { + lockString(0) + tunedStrings = new Set() + allTuned = false + resetStringProgress() + } + + function advanceToNextUntuned(fromIndex: number) { + const count = tuning.tuning.length + for (let offset = 1; offset <= count; offset++) { + const next = (fromIndex + offset) % count + if (!tunedStrings.has(next)) { + lockString(next) + resetStringProgress() + return + } + } + // All strings tuned. Keep advancing=true so no further tick can re-enter the + // confirmation block. + allTuned = true + onAllTuned() + } + + function selectString(index: number) { + if (tunedStrings.has(index)) { + const next = new Set(tunedStrings) + next.delete(index) + tunedStrings = next + } + lockString(index) + resetStringProgress() + } + + /** The hint while off the in-tune window: still 'in-range' during the grace period */ + function offHint(now: number, displayCents: number): TunerHint { + return now < inRangeGraceUntil ? 'in-range' : displayCents > 0 ? 'too-high' : 'too-low' + } + + /** + * Take in a pitch inside the fine window: median filter, continuity gate, EMA, display, + * hint and stability ring, and confirmation of the string once it has been in tune for + * cfg.stableMs. + */ + function acceptPitch( + pitch: number, + clarity: number, + now: number, + isDisplayFrame: boolean, + options: AcceptOptions, + ) { + hasEnteredFineWindow = true + lastGoodSignalTime = now + + // --- Median filter --- + // Rolling buffer of the last PITCH_BUFFER_SIZE pitches. + // Median is more robust than mean against occasional octave-error spikes. + pitchHistory.push(pitch) + if (pitchHistory.length > PITCH_BUFFER_SIZE) pitchHistory.shift() + const medianPitch = median(pitchHistory) + + // --- Octave-fold correction --- + // If pitchy latches onto an upper harmonic (e.g. 2nd harmonic of Low E), + // dividing by N=2..6 may bring it within 300c of the target. We prefer + // that folded value when it improves the match by >400c. + const lockedFreq = tuning.tuning[lockedStringIndex].frequency + const stablePitch = foldTowardTarget(medianPitch, lockedFreq) + + // --- Pitch continuity gate --- + // Reject frames where the smoothed cents would jump by more than + // PITCH_CONTINUITY_CENTS in a single tick (transient noise or string change). + const rawCents = centsBetween(stablePitch, lockedFreq) + if (smoothedCents !== null && Math.abs(rawCents - smoothedCents) > PITCH_CONTINUITY_CENTS) { + if (options.reportRejects) { + counters.continuityRejected++ + log.add( + ` CONTINUITY_REJECTED jump=${Math.abs(rawCents - smoothedCents).toFixed( + 0, + )}¢ (limit=${PITCH_CONTINUITY_CENTS}¢)`, + ) + } + return + } + + // --- EMA smoothing --- + // Exponential moving average over the raw-cents readings. + // alpha=0.04 at 60fps gives ~500ms settling time — heavy enough + // to prevent needle jitter without hiding genuine pitch drift. + smoothedCents = + smoothedCents === null + ? rawCents + : smoothedCents + CENTS_EMA_ALPHA * (rawCents - smoothedCents) + const displayCents = Math.round(smoothedCents) + + // --- Display write (~30fps) --- + // Engine state (smoothedCents, stableStartTime) is updated every tick regardless. + if (isDisplayFrame) { + lastDisplayTime = now + display.frequency = Math.round((options.showFramePitch ? pitch : stablePitch) * 10) / 10 + display.cents = displayCents + display.needleCents = smoothedCents + display.signalClarity = clarity + } + + // --- Hint + stability ring --- + // stableStartTime tracks when the pitch first entered the ACCEPT_CENTS + // window. cfg.stableMs varies by instrument (600ms violin – 1500ms bass). + // advanceToNextUntuned() is called exactly once per string via `advancing`. + if (Math.abs(displayCents) <= ACCEPT_CENTS) { + outOfRangeStart = null + if (stableStartTime === null) stableStartTime = now + const elapsed = now - stableStartTime + if (isDisplayFrame) { + display.hint = 'in-range' + inRangeGraceUntil = now + HINT_GRACE_MS + display.stabilityProgress = Math.min(1, elapsed / cfg.stableMs) + } + if (elapsed >= cfg.stableMs && !advancing) { + advancing = true + log.add( + `STRING_CONFIRMED str=${lockedStringIndex} after ${elapsed.toFixed(0)}ms${options.via}`, + ) + const completedIdx = lockedStringIndex + const next = new Set(tunedStrings) + next.add(completedIdx) + tunedStrings = next + advanceToNextUntuned(completedIdx) + } + } else { + if (isDisplayFrame) display.hint = offHint(now, displayCents) + if (!options.resetStabilityWhenOff) return + if (Math.abs(displayCents) > STABILITY_RESET_CENTS) { + if (outOfRangeStart === null) outOfRangeStart = now + if (now - outOfRangeStart >= STABILITY_RESET_MS) { + stableStartTime = null + outOfRangeStart = null + if (isDisplayFrame) display.stabilityProgress = 0 + } + } else { + outOfRangeStart = null + } + } + } + + function process({ pitch, clarity, rms }: AudioFrame, now: number) { + const isDisplayFrame = now - lastDisplayTime >= DISPLAY_INTERVAL_MS + const isLogFrame = now - lastLogTime >= LOG_INTERVAL_MS + const lockedFreq = tuning.tuning[lockedStringIndex].frequency + + // Dual clarity gate: tighter when RMS is low (decaying string has worse SNR). + // Both thresholds come from the instrument's settings so bass/guitar/ukulele/violin + // each use appropriate values for their sustain characteristics. + const clarityGate = rms < LOW_RMS_THRESHOLD ? cfg.decayClarityThreshold : cfg.clarityThreshold + // Frequency window rejects pitches outside ±15% of the locked fundamental, + // blocking harmonics of other strings that fall outside this narrow band. + const hasSignal = clarity > clarityGate && pitch >= minFreq && pitch <= maxFreq + + counters.total++ + if (isLogFrame) { + lastLogTime = now + const stringName = tuning.tuning[lockedStringIndex].note + log.add( + `t=${(now / 1000).toFixed(2)}s str=${stringName}(${lockedFreq.toFixed(1)}Hz)` + + ` pitch=${pitch.toFixed(1)}Hz clarity=${clarity.toFixed( + 3, + )} rms=${rms.toFixed(4)} gate=${clarityGate.toFixed(3)}` + + ` window=[${minFreq.toFixed(1)}-${maxFreq.toFixed(1)}]` + + ` hintWindow=[${hintMinFreq.toFixed(1)}-${hintMaxFreq.toFixed(1)}]` + + ` hasSignal=${hasSignal}` + + ` fineEntered=${hasEnteredFineWindow}` + + ` clarityOk=${clarity > clarityGate}` + + ` inFine=${pitch >= minFreq && pitch <= maxFreq}` + + ` inHint=${pitch >= hintMinFreq && pitch <= hintMaxFreq}`, + ) + } + + if (hasSignal) { + counters.hasSignal++ + acceptPitch(pitch, clarity, now, isDisplayFrame, DIRECT) + return + } + + // --- Overtone fold-and-route --- + // Pitchy sometimes returns a strong harmonic instead of the fundamental, + // especially on Low E/B at peak attack (rms high, 2× harmonic dominates). + // Fold the harmonic down to the fundamental and, if it lands in the fine window, + // take it in like a direct reading so it contributes to stability progress. + if (clarity > cfg.clarityThreshold && isHarmonicOf(pitch, lockedFreq)) { + counters.overtone++ + const foldedPitch = foldTowardTarget(pitch, lockedFreq) + if (foldedPitch >= minFreq && foldedPitch <= maxFreq) { + if (isLogFrame) + log.add( + ` OVERTONE_FOLDED pitch=${pitch.toFixed( + 1, + )}Hz → ${foldedPitch.toFixed(1)}Hz (in fine window)`, + ) + acceptPitch(foldedPitch, clarity, now, isDisplayFrame, FOLDED_OVERTONE) + } else { + // Folded pitch still outside fine window — just refresh the latch. + if (isLogFrame) + log.add( + ` OVERTONE_LATCH pitch=${pitch.toFixed(1)}Hz harmonic of ${lockedFreq.toFixed(1)}Hz`, + ) + lastGoodSignalTime = now + } + return + } + + // --- Coarse hint (heavily out of tune) --- + // Only active before the pitch has ever entered the ±15% fine-tuning window + // for this string. Once hasEnteredFineWindow is set, this path is disabled + // so it cannot flicker back on mid-tune if the pitch briefly dips outside + // the acceptance window. Resets when the string resets (selectString / advance). + // Suppress coarse hint if the pitch is a harmonic of an already-tuned string + // (sympathetic resonance from a recently confirmed string can produce a + // spurious too-high/too-low flash before the user plucks the next string). + const isSympathetic = [...tunedStrings].some((idx) => { + const f = tuning.tuning[idx].frequency + return isHarmonicOf(pitch, f) || isHarmonicOf(f, pitch) + }) + if ( + !hasEnteredFineWindow && + !isSympathetic && + clarity > cfg.clarityThreshold && + pitch >= hintMinFreq && + pitch <= hintMaxFreq + ) { + counters.coarseHint++ + lastGoodSignalTime = now + smoothedCents = null + pitchHistory = [] + stableStartTime = null + const rawCents = centsBetween(pitch, lockedFreq) + if (isLogFrame) + log.add( + ` COARSE_HINT pitch=${pitch.toFixed(1)}Hz cents=${ + rawCents > 0 ? '+' : '' + }${rawCents}¢ hint=${rawCents > 0 ? 'too-high' : 'too-low'}`, + ) + if (isDisplayFrame) { + lastDisplayTime = now + display.frequency = Math.round(pitch * 10) / 10 + display.cents = rawCents + display.needleCents = rawCents + display.hint = rawCents > 0 ? 'too-high' : 'too-low' + display.signalClarity = clarity + display.stabilityProgress = 0 + } + return + } + + // --- Latch-and-Fade --- + // Keep the display alive for SIGNAL_HOLD_MS after the last valid frame. + // This bridges the natural decay gap when a string fades to silence, + // preventing the needle from snapping to blank between plucks. + // needleCents is intentionally NOT cleared — needle holds its last position. + pitchHistory = [] + const held = now - lastGoodSignalTime < SIGNAL_HOLD_MS + if (!held) { + counters.silence++ + stableStartTime = null + outOfRangeStart = null + inRangeGraceUntil = 0 + if (isDisplayFrame) { + lastDisplayTime = now + display.frequency = null + display.cents = null + display.hint = null + display.stabilityProgress = 0 + display.signalClarity = 0 + } + } else if (isDisplayFrame && now < inRangeGraceUntil) { + display.hint = 'in-range' + } + } + + return { + display, + get lockedStringIndex() { + return lockedStringIndex + }, + get tunedStrings() { + return tunedStrings + }, + get allTuned() { + return allTuned + }, + get config() { + return cfg + }, + counters, + process, + selectString, + setTuning(next) { + tuning = next + cfg = instrumentConfig(next.category) + cacheFreqBounds() + }, + reset, + resetCounters() { + for (const key of Object.keys(counters) as (keyof TickCounters)[]) counters[key] = 0 + }, + clearDisplay() { + display.frequency = null + display.cents = null + display.hint = null + display.stabilityProgress = 0 + display.signalClarity = 0 + }, + } +} diff --git a/src/tuner/instruments.ts b/src/tuner/instruments.ts new file mode 100644 index 0000000..969c5a3 --- /dev/null +++ b/src/tuner/instruments.ts @@ -0,0 +1,58 @@ +import type { InstrumentCategory } from '../data/tunings' + +/** Per-instrument analysis configuration */ +export interface InstrumentConfig { + /** Primary FFT window size — larger values improve low-freq fundamental detection */ + primaryFftSize: number + /** How long (ms) pitch must stay inside ACCEPT_CENTS to confirm the string */ + stableMs: number + /** Minimum pitchy clarity to accept a pitch reading */ + clarityThreshold: number + /** Stricter clarity gate when the string RMS is decaying */ + decayClarityThreshold: number +} + +export const INSTRUMENT_CONFIGS: Record = { + // decayClarityThreshold MUST always be <= clarityThreshold: + // decaying strings produce noisier signals (lower RMS → worse SNR), + // so the clarity gate must be more permissive when the string is quiet, + // not stricter. Inverted values cause valid quiet-tail frames to be + // rejected, fragmenting the stability timer and requiring many plucks. + // + // bass: 8192 FFT resolves E1(41Hz) cleanly; long sustain warrants + // 1500ms hold. Low strings have heavy overtone content so + // decay threshold is relaxed to match guitar's tuned value. + // guitar: confirmed via session logs — 0.80 decay threshold accepts + // quiet-tail frames at 0.83-0.91 while rejecting noise at ≤0.76. + // ukulele: nylon strings, short sustain; quiet tail is brief but noisy. + // violin: bowed, no sharp attack; clarity drops fast after bow lift. + bass: { + primaryFftSize: 8192, + stableMs: 1500, + clarityThreshold: 0.93, + decayClarityThreshold: 0.82, + }, + guitar: { + primaryFftSize: 2048, + stableMs: 1100, + clarityThreshold: 0.92, + decayClarityThreshold: 0.8, + }, + ukulele: { + primaryFftSize: 2048, + stableMs: 800, + clarityThreshold: 0.85, + decayClarityThreshold: 0.75, + }, + violin: { + primaryFftSize: 2048, + stableMs: 600, + clarityThreshold: 0.8, + decayClarityThreshold: 0.7, + }, +} + +/** The configuration for `category`, guitar's for anything else (custom tunings, say). */ +export function instrumentConfig(category: string): InstrumentConfig { + return INSTRUMENT_CONFIGS[category as InstrumentCategory] ?? INSTRUMENT_CONFIGS.guitar +} diff --git a/src/tuner/pitch.test.ts b/src/tuner/pitch.test.ts new file mode 100644 index 0000000..1a531ce --- /dev/null +++ b/src/tuner/pitch.test.ts @@ -0,0 +1,68 @@ +import { describe, expect, it } from 'vitest' +import { centsBetween, foldTowardTarget, isHarmonicOf, median } from './pitch' + +const E2 = 82.4069 + +describe('centsBetween', () => { + it('is 0 for the same frequency, ±1200 for an octave, ±100 for a semitone', () => { + expect(centsBetween(E2, E2)).toBe(0) + expect(centsBetween(E2 * 2, E2)).toBe(1200) + expect(centsBetween(E2 / 2, E2)).toBe(-1200) + expect(centsBetween(E2 * 2 ** (1 / 12), E2)).toBe(100) + }) + + it('rounds to the nearest cent', () => { + expect(centsBetween(E2 * 2 ** (7.4 / 1200), E2)).toBe(7) + expect(centsBetween(E2 * 2 ** (-7.6 / 1200), E2)).toBe(-8) + }) +}) + +describe('isHarmonicOf', () => { + it('recognises the 2nd to 6th harmonics, within 8%', () => { + for (const n of [2, 3, 4, 5, 6]) expect(isHarmonicOf(E2 * n, E2)).toBe(true) + expect(isHarmonicOf(E2 * 3 * 1.02, E2)).toBe(true) + }) + + it('does not count the fundamental, the 7th harmonic or notes in between', () => { + expect(isHarmonicOf(E2, E2)).toBe(false) + expect(isHarmonicOf(E2 * 7, E2)).toBe(false) + expect(isHarmonicOf(E2 * 2.5, E2)).toBe(false) + }) +}) + +describe('median', () => { + it('is the middle value, the upper middle one for an even count', () => { + expect(median([3, 1, 2])).toBe(2) + expect(median([4, 1, 3, 2])).toBe(3) + }) + + it('ignores a single octave-error spike', () => { + expect(median([82, 82.4, 164.8, 82.3, 82.5])).toBe(82.4) + }) + + it('does not reorder its input', () => { + const input = [3, 1, 2] + median(input) + expect(input).toEqual([3, 1, 2]) + }) +}) + +describe('foldTowardTarget', () => { + it('brings a harmonic down to the fundamental', () => { + expect(foldTowardTarget(E2 * 2, E2)).toBeCloseTo(E2, 6) + expect(foldTowardTarget(E2 * 3, E2)).toBeCloseTo(E2, 6) + }) + + it('keeps a slightly sharp harmonic slightly sharp', () => { + const folded = foldTowardTarget(E2 * 2 * 2 ** (10 / 1200), E2) + expect(centsBetween(folded, E2)).toBe(10) + }) + + it('leaves a pitch near the target alone', () => { + expect(foldTowardTarget(E2 * 1.1, E2)).toBe(E2 * 1.1) + }) + + it('leaves a pitch that no division brings within 300 cents', () => { + expect(foldTowardTarget(E2 * 2.5, E2)).toBe(E2 * 2.5) + }) +}) diff --git a/src/tuner/pitch.ts b/src/tuner/pitch.ts new file mode 100644 index 0000000..fcc42fc --- /dev/null +++ b/src/tuner/pitch.ts @@ -0,0 +1,43 @@ +/** Pure pitch arithmetic used by the tuning engine. No state, no Vue. */ + +/** Cents from `targetFreq` to `freq`, rounded to the nearest cent. */ +export function centsBetween(freq: number, targetFreq: number): number { + return Math.round(1200 * Math.log2(freq / targetFreq)) +} + +/** + * Returns true if `pitch` is approximately an integer harmonic (2×–6×) of + * `fundamentalFreq`. Tolerance ±8% covers natural intonation variance. + */ +export function isHarmonicOf(pitch: number, fundamentalFreq: number): boolean { + for (let n = 2; n <= 6; n++) { + if (Math.abs(pitch / fundamentalFreq - n) < 0.08) return true + } + return false +} + +/** Median of `arr` (the upper one of the two middle values for an even length). */ +export function median(arr: number[]): number { + const s = [...arr].sort((a, b) => a - b) + return s[Math.floor(s.length / 2)] +} + +/** + * Fold `pitch` toward `targetFreq` by dividing by N = 2..6. + * If dividing brings it within 300¢ AND improves the match by >400¢, + * return the folded value. Corrects pitchy latching onto upper harmonics. + */ +export function foldTowardTarget(pitch: number, targetFreq: number): number { + const rawCents = Math.abs(centsBetween(pitch, targetFreq)) + let best = pitch + let bestCents = rawCents + for (let n = 2; n <= 6; n++) { + const folded = pitch / n + const fc = Math.abs(centsBetween(folded, targetFreq)) + if (fc < bestCents && rawCents - fc > 400 && fc < 300) { + bestCents = fc + best = folded + } + } + return best +} diff --git a/src/tuner/sessionLog.ts b/src/tuner/sessionLog.ts new file mode 100644 index 0000000..5d849cd --- /dev/null +++ b/src/tuner/sessionLog.ts @@ -0,0 +1,30 @@ +/** + * Session log: lines collected while tuning and printed to the console as one pasteable block + * when the session stops, for diagnosing detection problems. Development builds only: in + * production nothing is collected or printed. + */ +export interface SessionLog { + add(line: string): void + clear(): void + print(): void +} + +export function createSessionLog(enabled: boolean = import.meta.env.DEV): SessionLog { + let lines: string[] = [] + return { + add(line) { + if (enabled) lines.push(line) + }, + clear() { + lines = [] + }, + print() { + if (!enabled) return + console.log( + '\n===== TUNER SESSION LOG (paste to Copilot) =====\n' + + lines.join('\n') + + '\n================================================\n', + ) + }, + } +} diff --git a/tsconfig.node.json b/tsconfig.node.json index 6a12664..7cd22bc 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -20,5 +20,5 @@ "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true }, - "include": ["vite.config.ts"] + "include": ["vite.config.ts", "vitest.config.ts"] } diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..b771c0e --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,22 @@ +import { fileURLToPath } from 'node:url' +import { defineConfig, mergeConfig } from 'vitest/config' +import viteConfig from './vite.config' + +export default mergeConfig( + viteConfig, + defineConfig({ + resolve: { + alias: { + // The package says "type": "module" but its "main" is CommonJS, which Node refuses; + // Vite's browser build reads its "module" entry, so tests use that one too. + '@lineiconshq/free-icons': fileURLToPath( + new URL('./node_modules/@lineiconshq/free-icons/dist/index.esm.js', import.meta.url), + ), + }, + }, + test: { + // Let Vite load the icon packages (and the copy vue-lineicons carries) so the alias applies + server: { deps: { inline: [/@lineiconshq\//] } }, + }, + }), +)