Fix unfixable lints

0af4a3ebd7c879c503e86eeec096dbf6c9d0e59e

Cohee <18619528+Cohee1207@users.noreply.github.com>

28 files changed, +336 -135Ignore whitespace
.eslintrc.cjs+4 -0
@@ -3,6 +3,9 @@ module.exports = {
3 extends: [3 extends: [
4 'eslint:recommended',4 'eslint:recommended',
5 ],5 ],
6 plugins: [
7 'jsdoc',
8 ],
6 env: {9 env: {
7 es6: true,10 es6: true,
8 },11 },
@@ -78,6 +81,7 @@ module.exports = {
78 'public/scripts/extensions/tts/lib/**',81 'public/scripts/extensions/tts/lib/**',
79 ],82 ],
80 rules: {83 rules: {
84 'jsdoc/no-undefined-types': ['warn', { disableReporting: true, markVariablesAsUsed: true }],
81 'no-unused-vars': ['error', { args: 'none' }],85 'no-unused-vars': ['error', { args: 'none' }],
82 'no-control-regex': 'off',86 'no-control-regex': 'off',
83 'no-constant-condition': ['error', { checkLoops: false }],87 'no-constant-condition': ['error', { checkLoops: false }],
package-lock.json+234 -4
@@ -110,7 +110,8 @@
110 "@types/write-file-atomic": "^4.0.3",110 "@types/write-file-atomic": "^4.0.3",
111 "@types/yargs": "^17.0.33",111 "@types/yargs": "^17.0.33",
112 "@types/yauzl": "^2.10.3",112 "@types/yauzl": "^2.10.3",
113 "eslint": "^8.57.1"113 "eslint": "^8.57.1",
114 "eslint-plugin-jsdoc": "^50.6.8"
114 },115 },
115 "engines": {116 "engines": {
116 "node": ">= 18"117 "node": ">= 18"
@@ -147,6 +148,21 @@
147 "integrity": "sha512-KlmTftToTtmb6aLVdne4NluS+POWputPF5J8v25UN/EQS+K9vahWEIe1NPRSFqBQclObkqHaj7JOnFrmnSm5MA==",148 "integrity": "sha512-KlmTftToTtmb6aLVdne4NluS+POWputPF5J8v25UN/EQS+K9vahWEIe1NPRSFqBQclObkqHaj7JOnFrmnSm5MA==",
148 "license": "Apache-2.0"149 "license": "Apache-2.0"
149 },150 },
151 "node_modules/@es-joy/jsdoccomment": {
152 "version": "0.49.0",
153 "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.49.0.tgz",
154 "integrity": "sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q==",
155 "dev": true,
156 "license": "MIT",
157 "dependencies": {
158 "comment-parser": "1.4.1",
159 "esquery": "^1.6.0",
160 "jsdoc-type-pratt-parser": "~4.1.0"
161 },
162 "engines": {
163 "node": ">=16"
164 }
165 },
150 "node_modules/@eslint-community/eslint-utils": {166 "node_modules/@eslint-community/eslint-utils": {
151 "version": "4.4.0",167 "version": "4.4.0",
152 "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",168 "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -970,6 +986,19 @@
970 "node": ">=14"986 "node": ">=14"
971 }987 }
972 },988 },
989 "node_modules/@pkgr/core": {
990 "version": "0.1.1",
991 "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz",
992 "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==",
993 "dev": true,
994 "license": "MIT",
995 "engines": {
996 "node": "^12.20.0 || ^14.18.0 || >=16.0.0"
997 },
998 "funding": {
999 "url": "https://opencollective.com/unts"
1000 }
1001 },
973 "node_modules/@popperjs/core": {1002 "node_modules/@popperjs/core": {
974 "version": "2.11.8",1003 "version": "2.11.8",
975 "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",1004 "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
@@ -2099,6 +2128,16 @@
2099 "safe-buffer": "~5.2.0"2128 "safe-buffer": "~5.2.0"
2100 }2129 }
2101 },2130 },
2131 "node_modules/are-docs-informative": {
2132 "version": "0.0.2",
2133 "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz",
2134 "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==",
2135 "dev": true,
2136 "license": "MIT",
2137 "engines": {
2138 "node": ">=14"
2139 }
2140 },
2102 "node_modules/argparse": {2141 "node_modules/argparse": {
2103 "version": "2.0.1",2142 "version": "2.0.1",
2104 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",2143 "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -2614,6 +2653,16 @@
2614 "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",2653 "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
2615 "license": "MIT"2654 "license": "MIT"
2616 },2655 },
2656 "node_modules/comment-parser": {
2657 "version": "1.4.1",
2658 "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz",
2659 "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==",
2660 "dev": true,
2661 "license": "MIT",
2662 "engines": {
2663 "node": ">= 12.0.0"
2664 }
2665 },
2617 "node_modules/compress-commons": {2666 "node_modules/compress-commons": {
2618 "version": "6.0.2",2667 "version": "6.0.2",
2619 "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",2668 "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",
@@ -3560,6 +3609,101 @@
3560 "url": "https://opencollective.com/eslint"3609 "url": "https://opencollective.com/eslint"
3561 }3610 }
3562 },3611 },
3612 "node_modules/eslint-plugin-jsdoc": {
3613 "version": "50.6.8",
3614 "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.6.8.tgz",
3615 "integrity": "sha512-PPZVqhoXaalMQwDGzcQrJtPSPIPOYsSMtvkjYAdsIazOW20yhYtVX4+jLL+XznD4zYTXyZbPWPRKkNev4D4lyw==",
3616 "dev": true,
3617 "license": "BSD-3-Clause",
3618 "dependencies": {
3619 "@es-joy/jsdoccomment": "~0.49.0",
3620 "are-docs-informative": "^0.0.2",
3621 "comment-parser": "1.4.1",
3622 "debug": "^4.3.6",
3623 "escape-string-regexp": "^4.0.0",
3624 "espree": "^10.1.0",
3625 "esquery": "^1.6.0",
3626 "parse-imports": "^2.1.1",
3627 "semver": "^7.6.3",
3628 "spdx-expression-parse": "^4.0.0",
3629 "synckit": "^0.9.1"
3630 },
3631 "engines": {
3632 "node": ">=18"
3633 },
3634 "peerDependencies": {
3635 "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
3636 }
3637 },
3638 "node_modules/eslint-plugin-jsdoc/node_modules/debug": {
3639 "version": "4.4.0",
3640 "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
3641 "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
3642 "dev": true,
3643 "license": "MIT",
3644 "dependencies": {
3645 "ms": "^2.1.3"
3646 },
3647 "engines": {
3648 "node": ">=6.0"
3649 },
3650 "peerDependenciesMeta": {
3651 "supports-color": {
3652 "optional": true
3653 }
3654 }
3655 },
3656 "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": {
3657 "version": "4.0.0",
3658 "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
3659 "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
3660 "dev": true,
3661 "license": "MIT",
3662 "engines": {
3663 "node": ">=10"
3664 },
3665 "funding": {
3666 "url": "https://github.com/sponsors/sindresorhus"
3667 }
3668 },
3669 "node_modules/eslint-plugin-jsdoc/node_modules/eslint-visitor-keys": {
3670 "version": "4.2.0",
3671 "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz",
3672 "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==",
3673 "dev": true,
3674 "license": "Apache-2.0",
3675 "engines": {
3676 "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
3677 },
3678 "funding": {
3679 "url": "https://opencollective.com/eslint"
3680 }
3681 },
3682 "node_modules/eslint-plugin-jsdoc/node_modules/espree": {
3683 "version": "10.3.0",
3684 "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz",
3685 "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==",
3686 "dev": true,
3687 "license": "BSD-2-Clause",
3688 "dependencies": {
3689 "acorn": "^8.14.0",
3690 "acorn-jsx": "^5.3.2",
3691 "eslint-visitor-keys": "^4.2.0"
3692 },
3693 "engines": {
3694 "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
3695 },
3696 "funding": {
3697 "url": "https://opencollective.com/eslint"
3698 }
3699 },
3700 "node_modules/eslint-plugin-jsdoc/node_modules/ms": {
3701 "version": "2.1.3",
3702 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
3703 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
3704 "dev": true,
3705 "license": "MIT"
3706 },
3563 "node_modules/eslint-scope": {3707 "node_modules/eslint-scope": {
3564 "version": "7.2.2",3708 "version": "7.2.2",
3565 "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",3709 "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
@@ -3690,9 +3834,9 @@
3690 }3834 }
3691 },3835 },
3692 "node_modules/esquery": {3836 "node_modules/esquery": {
3693 "version": "1.5.0",3837 "version": "1.6.0",
3694 "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",3838 "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
3695 "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",3839 "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
3696 "dev": true,3840 "dev": true,
3697 "license": "BSD-3-Clause",3841 "license": "BSD-3-Clause",
3698 "dependencies": {3842 "dependencies": {
@@ -5015,6 +5159,16 @@
5015 "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",5159 "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
5016 "license": "MIT"5160 "license": "MIT"
5017 },5161 },
5162 "node_modules/jsdoc-type-pratt-parser": {
5163 "version": "4.1.0",
5164 "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.1.0.tgz",
5165 "integrity": "sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==",
5166 "dev": true,
5167 "license": "MIT",
5168 "engines": {
5169 "node": ">=12.0.0"
5170 }
5171 },
5018 "node_modules/json-buffer": {5172 "node_modules/json-buffer": {
5019 "version": "3.0.1",5173 "version": "3.0.1",
5020 "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",5174 "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
@@ -5891,6 +6045,20 @@
5891 "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==",6045 "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==",
5892 "license": "MIT"6046 "license": "MIT"
5893 },6047 },
6048 "node_modules/parse-imports": {
6049 "version": "2.2.1",
6050 "resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.2.1.tgz",
6051 "integrity": "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ==",
6052 "dev": true,
6053 "license": "Apache-2.0 AND MIT",
6054 "dependencies": {
6055 "es-module-lexer": "^1.5.3",
6056 "slashes": "^3.0.12"
6057 },
6058 "engines": {
6059 "node": ">= 18"
6060 }
6061 },
5894 "node_modules/parse5": {6062 "node_modules/parse5": {
5895 "version": "7.1.2",6063 "version": "7.1.2",
5896 "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",6064 "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
@@ -6600,6 +6768,19 @@
6600 "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==",6768 "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==",
6601 "license": "MIT"6769 "license": "MIT"
6602 },6770 },
6771 "node_modules/semver": {
6772 "version": "7.7.1",
6773 "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
6774 "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
6775 "dev": true,
6776 "license": "ISC",
6777 "bin": {
6778 "semver": "bin/semver.js"
6779 },
6780 "engines": {
6781 "node": ">=10"
6782 }
6783 },
6603 "node_modules/send": {6784 "node_modules/send": {
6604 "version": "0.19.0",6785 "version": "0.19.0",
6605 "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",6786 "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
@@ -6811,6 +6992,13 @@
6811 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",6992 "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
6812 "license": "MIT"6993 "license": "MIT"
6813 },6994 },
6995 "node_modules/slashes": {
6996 "version": "3.0.12",
6997 "resolved": "https://registry.npmjs.org/slashes/-/slashes-3.0.12.tgz",
6998 "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==",
6999 "dev": true,
7000 "license": "ISC"
7001 },
6814 "node_modules/sliced": {7002 "node_modules/sliced": {
6815 "version": "1.0.1",7003 "version": "1.0.1",
6816 "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",7004 "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
@@ -6903,6 +7091,31 @@
6903 "source-map": "^0.6.0"7091 "source-map": "^0.6.0"
6904 }7092 }
6905 },7093 },
7094 "node_modules/spdx-exceptions": {
7095 "version": "2.5.0",
7096 "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz",
7097 "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==",
7098 "dev": true,
7099 "license": "CC-BY-3.0"
7100 },
7101 "node_modules/spdx-expression-parse": {
7102 "version": "4.0.0",
7103 "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz",
7104 "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==",
7105 "dev": true,
7106 "license": "MIT",
7107 "dependencies": {
7108 "spdx-exceptions": "^2.1.0",
7109 "spdx-license-ids": "^3.0.0"
7110 }
7111 },
7112 "node_modules/spdx-license-ids": {
7113 "version": "3.0.21",
7114 "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz",
7115 "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==",
7116 "dev": true,
7117 "license": "CC0-1.0"
7118 },
6906 "node_modules/sprintf-js": {7119 "node_modules/sprintf-js": {
6907 "version": "1.1.3",7120 "version": "1.1.3",
6908 "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",7121 "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
@@ -7042,6 +7255,23 @@
7042 "node": ">=8"7255 "node": ">=8"
7043 }7256 }
7044 },7257 },
7258 "node_modules/synckit": {
7259 "version": "0.9.2",
7260 "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz",
7261 "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==",
7262 "dev": true,
7263 "license": "MIT",
7264 "dependencies": {
7265 "@pkgr/core": "^0.1.0",
7266 "tslib": "^2.6.2"
7267 },
7268 "engines": {
7269 "node": "^14.18.0 || >=16.0.0"
7270 },
7271 "funding": {
7272 "url": "https://opencollective.com/unts"
7273 }
7274 },
7045 "node_modules/tapable": {7275 "node_modules/tapable": {
7046 "version": "2.2.1",7276 "version": "2.2.1",
7047 "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",7277 "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
package.json+2 -1
@@ -140,6 +140,7 @@
140 "@types/write-file-atomic": "^4.0.3",140 "@types/write-file-atomic": "^4.0.3",
141 "@types/yargs": "^17.0.33",141 "@types/yargs": "^17.0.33",
142 "@types/yauzl": "^2.10.3",142 "@types/yauzl": "^2.10.3",
143 "eslint": "^8.57.1"143 "eslint": "^8.57.1",
144 "eslint-plugin-jsdoc": "^50.6.8"
144 }145 }
145}146}
public/scripts/autocomplete/AutoComplete.js+0 -2
@@ -3,10 +3,8 @@ import { debounce, escapeRegex } from '../utils.js';
3import { AutoCompleteOption } from './AutoCompleteOption.js';3import { AutoCompleteOption } from './AutoCompleteOption.js';
4import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';4import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
5import { BlankAutoCompleteOption } from './BlankAutoCompleteOption.js';5import { BlankAutoCompleteOption } from './BlankAutoCompleteOption.js';
6// eslint-disable-next-line no-unused-vars
7import { AutoCompleteNameResult } from './AutoCompleteNameResult.js';6import { AutoCompleteNameResult } from './AutoCompleteNameResult.js';
8import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';7import { AutoCompleteSecondaryNameResult } from './AutoCompleteSecondaryNameResult.js';
9import { Popup, getTopmostModalLayer } from '../popup.js';
108
11/**@readonly*/9/**@readonly*/
12/**@enum {Number}*/10/**@enum {Number}*/
public/scripts/autocomplete/AutoCompleteNameResultBase.js+0 -1
@@ -1,4 +1,3 @@
1import { SlashCommandNamedArgumentAutoCompleteOption } from '../slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js';
2import { AutoCompleteOption } from './AutoCompleteOption.js';1import { AutoCompleteOption } from './AutoCompleteOption.js';
32
43
public/scripts/autocomplete/AutoCompleteOption.js+10 -11
@@ -1,19 +1,18 @@
1import { SlashCommand } from '../slash-commands/SlashCommand.js';
2import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';1import { AutoCompleteFuzzyScore } from './AutoCompleteFuzzyScore.js';
32
43
54
6export class AutoCompleteOption {5export class AutoCompleteOption {
7 /**@type {string}*/ name;6 /** @type {string} */ name;
8 /**@type {string}*/ typeIcon;7 /** @type {string} */ typeIcon;
9 /**@type {string}*/ type;8 /** @type {string} */ type;
10 /**@type {number}*/ nameOffset = 0;9 /** @type {number} */ nameOffset = 0;
11 /**@type {AutoCompleteFuzzyScore}*/ score;10 /** @type {AutoCompleteFuzzyScore} */ score;
12 /**@type {string}*/ replacer;11 /** @type {string} */ replacer;
13 /**@type {HTMLElement}*/ dom;12 /** @type {HTMLElement} */ dom;
14 /**@type {(input:string)=>boolean}*/ matchProvider;13 /** @type {(input:string)=>boolean} */ matchProvider;
15 /**@type {(input:string)=>string}*/ valueProvider;14 /** @type {(input:string)=>string} */ valueProvider;
16 /**@type {boolean}*/ makeSelectable = false;15 /** @type {boolean} */ makeSelectable = false;
1716
1817
19 /**18 /**
public/scripts/extensions/quick-reply/api/QuickReplyApi.js+3 -6
@@ -1,21 +1,18 @@
1// eslint-disable-next-line no-unused-vars
2import { QuickReply } from '../src/QuickReply.js';1import { QuickReply } from '../src/QuickReply.js';
3import { QuickReplyContextLink } from '../src/QuickReplyContextLink.js';2import { QuickReplyContextLink } from '../src/QuickReplyContextLink.js';
4import { QuickReplySet } from '../src/QuickReplySet.js';3import { QuickReplySet } from '../src/QuickReplySet.js';
5// eslint-disable-next-line no-unused-vars
6import { QuickReplySettings } from '../src/QuickReplySettings.js';4import { QuickReplySettings } from '../src/QuickReplySettings.js';
7// eslint-disable-next-line no-unused-vars
8import { SettingsUi } from '../src/ui/SettingsUi.js';5import { SettingsUi } from '../src/ui/SettingsUi.js';
9import { onlyUnique } from '../../../utils.js';6import { onlyUnique } from '../../../utils.js';
107
11export class QuickReplyApi {8export class QuickReplyApi {
12 /**@type {QuickReplySettings}*/ settings;9 /** @type {QuickReplySettings} */ settings;
13 /**@type {SettingsUi}*/ settingsUi;10 /** @type {SettingsUi} */ settingsUi;
1411
1512
1613
1714
18 constructor(/**@type {QuickReplySettings}*/settings, /**@type {SettingsUi}*/settingsUi) {15 constructor(/** @type {QuickReplySettings} */settings, /** @type {SettingsUi} */settingsUi) {
19 this.settings = settings;16 this.settings = settings;
20 this.settingsUi = settingsUi;17 this.settingsUi = settingsUi;
21 }18 }
public/scripts/extensions/quick-reply/src/AutoExecuteHandler.js+4 -6
@@ -1,18 +1,16 @@
1import { warn } from '../index.js';1import { warn } from '../index.js';
2// eslint-disable-next-line no-unused-vars
3import { QuickReply } from './QuickReply.js';2import { QuickReply } from './QuickReply.js';
4// eslint-disable-next-line no-unused-vars
5import { QuickReplySettings } from './QuickReplySettings.js';3import { QuickReplySettings } from './QuickReplySettings.js';
64
7export class AutoExecuteHandler {5export class AutoExecuteHandler {
8 /**@type {QuickReplySettings}*/ settings;6 /** @type {QuickReplySettings} */ settings;
97
10 /**@type {Boolean[]}*/ preventAutoExecuteStack = [];8 /** @type {Boolean[]}*/ preventAutoExecuteStack = [];
119
1210
1311
1412
15 constructor(/**@type {QuickReplySettings}*/settings) {13 constructor(/** @type {QuickReplySettings} */settings) {
16 this.settings = settings;14 this.settings = settings;
17 }15 }
1816
@@ -24,7 +22,7 @@ export class AutoExecuteHandler {
2422
2523
2624
27 async performAutoExecute(/**@type {QuickReply[]}*/qrList) {25 async performAutoExecute(/** @type {QuickReply[]} */qrList) {
28 for (const qr of qrList) {26 for (const qr of qrList) {
29 this.preventAutoExecuteStack.push(qr.preventAutoExecute);27 this.preventAutoExecuteStack.push(qr.preventAutoExecute);
30 try {28 try {
public/scripts/extensions/quick-reply/src/QuickReply.js+1 -3
@@ -49,7 +49,7 @@ export class QuickReply {
49 /**@type {string}*/ automationId = '';49 /**@type {string}*/ automationId = '';
5050
51 /**@type {function}*/ onExecute;51 /**@type {function}*/ onExecute;
52 /**@type {(qr:QuickReply)=>AsyncGenerator<SlashCommandClosureResult|{closure:SlashCommandClosure, executor:SlashCommandExecutor|SlashCommandClosureResult}, SlashCommandClosureResult, boolean>}*/ onDebug;52 /** @type {(qr:QuickReply)=>AsyncGenerator<SlashCommandClosureResult|{closure:SlashCommandClosure, executor:SlashCommandExecutor|SlashCommandClosureResult}, SlashCommandClosureResult, boolean>} */ onDebug;
53 /**@type {function}*/ onDelete;53 /**@type {function}*/ onDelete;
54 /**@type {function}*/ onUpdate;54 /**@type {function}*/ onUpdate;
55 /**@type {function}*/ onInsertBefore;55 /**@type {function}*/ onInsertBefore;
@@ -635,7 +635,6 @@ export class QuickReply {
635 }, { passive:true });635 }, { passive:true });
636 const getLineStart = ()=>{636 const getLineStart = ()=>{
637 const start = message.selectionStart;637 const start = message.selectionStart;
638 const end = message.selectionEnd;
639 let lineStart;638 let lineStart;
640 if (start == 0 || message.value[start - 1] == '\n') {639 if (start == 0 || message.value[start - 1] == '\n') {
641 // cursor is already at beginning of line640 // cursor is already at beginning of line
@@ -701,7 +700,6 @@ export class QuickReply {
701 } else if (evt.key == 'Enter' && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !(ac.isReplaceable && ac.isActive)) {700 } else if (evt.key == 'Enter' && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !(ac.isReplaceable && ac.isActive)) {
702 // new line, keep indent701 // new line, keep indent
703 const start = message.selectionStart;702 const start = message.selectionStart;
704 const end = message.selectionEnd;
705 let lineStart = getLineStart();703 let lineStart = getLineStart();
706 const indent = /^([^\S\n]*)/.exec(message.value.slice(lineStart))[1] ?? '';704 const indent = /^([^\S\n]*)/.exec(message.value.slice(lineStart))[1] ?? '';
707 if (indent.length) {705 if (indent.length) {
public/scripts/extensions/quick-reply/src/SlashCommandHandler.js+3 -4
@@ -8,18 +8,17 @@ import { SlashCommandEnumValue, enumTypes } from '../../../slash-commands/SlashC
8import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';8import { SlashCommandParser } from '../../../slash-commands/SlashCommandParser.js';
9import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';9import { SlashCommandScope } from '../../../slash-commands/SlashCommandScope.js';
10import { isTrueBoolean } from '../../../utils.js';10import { isTrueBoolean } from '../../../utils.js';
11// eslint-disable-next-line no-unused-vars
12import { QuickReplyApi } from '../api/QuickReplyApi.js';11import { QuickReplyApi } from '../api/QuickReplyApi.js';
13import { QuickReply } from './QuickReply.js';12import { QuickReply } from './QuickReply.js';
14import { QuickReplySet } from './QuickReplySet.js';13import { QuickReplySet } from './QuickReplySet.js';
1514
16export class SlashCommandHandler {15export class SlashCommandHandler {
17 /**@type {QuickReplyApi}*/ api;16 /** @type {QuickReplyApi} */ api;
1817
1918
2019
2120
22 constructor(/**@type {QuickReplyApi}*/api) {21 constructor(/** @type {QuickReplyApi} */api) {
23 this.api = api;22 this.api = api;
24 }23 }
2524
@@ -27,7 +26,7 @@ export class SlashCommandHandler {
2726
2827
29 init() {28 init() {
30 function getExecutionIcons(/**@type {QuickReply} */ qr) {29 function getExecutionIcons(/** @type {QuickReply} */ qr) {
31 let icons = '';30 let icons = '';
32 if (qr.preventAutoExecute) icons += '🚫';31 if (qr.preventAutoExecute) icons += '🚫';
33 if (qr.isHidden) icons += '👁️';32 if (qr.isHidden) icons += '👁️';
public/scripts/extensions/quick-reply/src/ui/ButtonUi.js+1 -2
@@ -1,11 +1,10 @@
1import { animation_duration } from '../../../../../script.js';1import { animation_duration } from '../../../../../script.js';
2import { dragElement } from '../../../../RossAscends-mods.js';2import { dragElement } from '../../../../RossAscends-mods.js';
3import { loadMovingUIState } from '../../../../power-user.js';3import { loadMovingUIState } from '../../../../power-user.js';
4// eslint-disable-next-line no-unused-vars
5import { QuickReplySettings } from '../QuickReplySettings.js';4import { QuickReplySettings } from '../QuickReplySettings.js';
65
7export class ButtonUi {6export class ButtonUi {
8 /**@type {QuickReplySettings}*/ settings;7 /** @type {QuickReplySettings} */ settings;
98
10 /**@type {HTMLElement}*/ dom;9 /**@type {HTMLElement}*/ dom;
11 /**@type {HTMLElement}*/ popoutDom;10 /**@type {HTMLElement}*/ popoutDom;
public/scripts/extensions/quick-reply/src/ui/SettingsUi.js+3 -4
@@ -3,14 +3,13 @@ import { getSortableDelay } from '../../../../utils.js';
3import { log, warn } from '../../index.js';3import { log, warn } from '../../index.js';
4import { QuickReply } from '../QuickReply.js';4import { QuickReply } from '../QuickReply.js';
5import { QuickReplySet } from '../QuickReplySet.js';5import { QuickReplySet } from '../QuickReplySet.js';
6// eslint-disable-next-line no-unused-vars
7import { QuickReplySettings } from '../QuickReplySettings.js';6import { QuickReplySettings } from '../QuickReplySettings.js';
87
9export class SettingsUi {8export class SettingsUi {
10 /**@type {QuickReplySettings}*/ settings;9 /** @type {QuickReplySettings} */ settings;
1110
12 /**@type {HTMLElement}*/ template;11 /** @type {HTMLElement} */ template;
13 /**@type {HTMLElement}*/ dom;12 /** @type {HTMLElement} */ dom;
1413
15 /**@type {HTMLInputElement}*/ isEnabled;14 /**@type {HTMLInputElement}*/ isEnabled;
16 /**@type {HTMLInputElement}*/ isCombined;15 /**@type {HTMLInputElement}*/ isCombined;
public/scripts/extensions/quick-reply/src/ui/ctx/ContextMenu.js+0 -1
@@ -1,5 +1,4 @@
1import { QuickReply } from '../../QuickReply.js';1import { QuickReply } from '../../QuickReply.js';
2// eslint-disable-next-line no-unused-vars
3import { QuickReplySet } from '../../QuickReplySet.js';2import { QuickReplySet } from '../../QuickReplySet.js';
4import { MenuHeader } from './MenuHeader.js';3import { MenuHeader } from './MenuHeader.js';
5import { MenuItem } from './MenuItem.js';4import { MenuItem } from './MenuItem.js';
public/scripts/extensions/tts/gpt-sovits-v2.js+0 -2
@@ -183,8 +183,6 @@ class GptSovitsV2Provider {
183183
184 let prompt_text = replaceSpeaker(voiceId);184 let prompt_text = replaceSpeaker(voiceId);
185185
186 const streaming = this.settings.streaming;
187
188 const params = {186 const params = {
189 text: inputText,187 text: inputText,
190 prompt_text: prompt_text,188 prompt_text: prompt_text,
public/scripts/nai-settings.js+1 -0
@@ -795,6 +795,7 @@ export function parseNovelAILogprobs(data) {
795795
796 // Add the chosen token to `merged` if it's not already there. This can796 // Add the chosen token to `merged` if it's not already there. This can
797 // happen if the chosen token was not among the top 10 most likely ones.797 // happen if the chosen token was not among the top 10 most likely ones.
798 // eslint-disable-next-line no-unused-vars
798 const [[chosenId], [_, chosenAfter]] = data.chosen[0];799 const [[chosenId], [_, chosenAfter]] = data.chosen[0];
799 if (!merged.some(([id]) => id === chosenId)) {800 if (!merged.some(([id]) => id === chosenId)) {
800 merged.push([chosenId, chosenAfter]);801 merged.push([chosenId, chosenAfter]);
public/scripts/slash-commands/SlashCommand.js+4 -4
@@ -3,16 +3,16 @@ import { SlashCommandAbortController } from './SlashCommandAbortController.js';
3import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js';3import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandArgument.js';
4import { SlashCommandClosure } from './SlashCommandClosure.js';4import { SlashCommandClosure } from './SlashCommandClosure.js';
5import { SlashCommandDebugController } from './SlashCommandDebugController.js';5import { SlashCommandDebugController } from './SlashCommandDebugController.js';
6import { PARSER_FLAG } from './SlashCommandParser.js';
7import { SlashCommandScope } from './SlashCommandScope.js';6import { SlashCommandScope } from './SlashCommandScope.js';
87
98/**
109 * @typedef {import('./SlashCommandParser.js').ParserFlags} ParserFlags
10 */
1111
12/**12/**
13 * @typedef {{13 * @typedef {{
14 * _scope:SlashCommandScope,14 * _scope:SlashCommandScope,
15 * _parserFlags:{[id:PARSER_FLAG]:boolean},15 * _parserFlags:{ParserFlags},
16 * _abortController:SlashCommandAbortController,16 * _abortController:SlashCommandAbortController,
17 * _debugController:SlashCommandDebugController,17 * _debugController:SlashCommandDebugController,
18 * _hasUnnamedArgument:boolean,18 * _hasUnnamedArgument:boolean,
public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js+0 -3
@@ -1,9 +1,6 @@
1import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';1import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';
2import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';
3import { AutoCompleteSecondaryNameResult } from '../autocomplete/AutoCompleteSecondaryNameResult.js';2import { AutoCompleteSecondaryNameResult } from '../autocomplete/AutoCompleteSecondaryNameResult.js';
4import { SlashCommand } from './SlashCommand.js';3import { SlashCommand } from './SlashCommand.js';
5import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
6import { SlashCommandClosure } from './SlashCommandClosure.js';
7import { SlashCommandCommandAutoCompleteOption } from './SlashCommandCommandAutoCompleteOption.js';4import { SlashCommandCommandAutoCompleteOption } from './SlashCommandCommandAutoCompleteOption.js';
8import { SlashCommandEnumAutoCompleteOption } from './SlashCommandEnumAutoCompleteOption.js';5import { SlashCommandEnumAutoCompleteOption } from './SlashCommandEnumAutoCompleteOption.js';
9import { SlashCommandExecutor } from './SlashCommandExecutor.js';6import { SlashCommandExecutor } from './SlashCommandExecutor.js';
public/scripts/slash-commands/SlashCommandClosure.js+13 -16
@@ -2,7 +2,6 @@ import { substituteParams } from '../../script.js';
2import { delay, escapeRegex, uuidv4 } from '../utils.js';2import { delay, escapeRegex, uuidv4 } from '../utils.js';
3import { SlashCommand } from './SlashCommand.js';3import { SlashCommand } from './SlashCommand.js';
4import { SlashCommandAbortController } from './SlashCommandAbortController.js';4import { SlashCommandAbortController } from './SlashCommandAbortController.js';
5import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
6import { SlashCommandBreak } from './SlashCommandBreak.js';5import { SlashCommandBreak } from './SlashCommandBreak.js';
7import { SlashCommandBreakController } from './SlashCommandBreakController.js';6import { SlashCommandBreakController } from './SlashCommandBreakController.js';
8import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js';7import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js';
@@ -14,21 +13,19 @@ import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgument
14import { SlashCommandScope } from './SlashCommandScope.js';13import { SlashCommandScope } from './SlashCommandScope.js';
1514
16export class SlashCommandClosure {15export class SlashCommandClosure {
17 /**@type {SlashCommandScope}*/ scope;16 /** @type {SlashCommandScope} */ scope;
18 /**@type {boolean}*/ executeNow = false;17 /** @type {boolean} */ executeNow = false;
19 // @ts-ignore18 /** @type {SlashCommandNamedArgumentAssignment[]} */ argumentList = [];
20 /**@type {SlashCommandNamedArgumentAssignment[]}*/ argumentList = [];19 /** @type {SlashCommandNamedArgumentAssignment[]} */ providedArgumentList = [];
21 // @ts-ignore20 /** @type {SlashCommandExecutor[]} */ executorList = [];
22 /**@type {SlashCommandNamedArgumentAssignment[]}*/ providedArgumentList = [];21 /** @type {SlashCommandAbortController} */ abortController;
23 /**@type {SlashCommandExecutor[]}*/ executorList = [];22 /** @type {SlashCommandBreakController} */ breakController;
24 /**@type {SlashCommandAbortController}*/ abortController;23 /** @type {SlashCommandDebugController} */ debugController;
25 /**@type {SlashCommandBreakController}*/ breakController;24 /** @type {(done:number, total:number)=>void} */ onProgress;
26 /**@type {SlashCommandDebugController}*/ debugController;25 /** @type {string} */ rawText;
27 /**@type {(done:number, total:number)=>void}*/ onProgress;26 /** @type {string} */ fullText;
28 /**@type {string}*/ rawText;27 /** @type {string} */ parserContext;
29 /**@type {string}*/ fullText;28 /** @type {string} */ #source = uuidv4();
30 /**@type {string}*/ parserContext;
31 /**@type {string}*/ #source = uuidv4();
32 get source() { return this.#source; }29 get source() { return this.#source; }
33 set source(value) {30 set source(value) {
34 this.#source = value;31 this.#source = value;
public/scripts/slash-commands/SlashCommandDebugController.js+11 -11
@@ -2,20 +2,20 @@ import { SlashCommandClosure } from './SlashCommandClosure.js';
2import { SlashCommandExecutor } from './SlashCommandExecutor.js';2import { SlashCommandExecutor } from './SlashCommandExecutor.js';
33
4export class SlashCommandDebugController {4export class SlashCommandDebugController {
5 /**@type {SlashCommandClosure[]} */ stack = [];5 /** @type {SlashCommandClosure[]} */ stack = [];
6 /**@type {SlashCommandExecutor[]} */ cmdStack = [];6 /** @type {SlashCommandExecutor[]} */ cmdStack = [];
7 /**@type {boolean[]} */ stepStack = [];7 /** @type {boolean[]} */ stepStack = [];
8 /**@type {boolean} */ isStepping = false;8 /** @type {boolean} */ isStepping = false;
9 /**@type {boolean} */ isSteppingInto = false;9 /** @type {boolean} */ isSteppingInto = false;
10 /**@type {boolean} */ isSteppingOut = false;10 /** @type {boolean} */ isSteppingOut = false;
1111
12 /**@type {object} */ namedArguments;12 /** @type {object} */ namedArguments;
13 /**@type {string|SlashCommandClosure|(string|SlashCommandClosure)[]} */ unnamedArguments;13 /** @type {string|SlashCommandClosure|(string|SlashCommandClosure)[]} */ unnamedArguments;
1414
15 /**@type {Promise<boolean>} */ continuePromise;15 /** @type {Promise<boolean>} */ continuePromise;
16 /**@type {(boolean)=>void} */ continueResolver;16 /** @type {(boolean)=>void} */ continueResolver;
1717
18 /**@type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;18 /** @type {(closure:SlashCommandClosure, executor:SlashCommandExecutor)=>Promise<boolean>} */ onBreakPoint;
1919
2020
2121
public/scripts/slash-commands/SlashCommandEnumValue.js+0 -4
@@ -1,7 +1,3 @@
1import { SlashCommandExecutor } from './SlashCommandExecutor.js';
2import { SlashCommandScope } from './SlashCommandScope.js';
3
4
5/**1/**
6 * @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType2 * @typedef {'enum' | 'command' | 'namedArgument' | 'variable' | 'qr' | 'macro' | 'number' | 'name'} EnumType
7 */3 */
public/scripts/slash-commands/SlashCommandExecutor.js+4 -9
@@ -1,11 +1,7 @@
1// eslint-disable-next-line no-unused-vars
2import { uuidv4 } from '../utils.js';1import { uuidv4 } from '../utils.js';
3import { SlashCommand } from './SlashCommand.js';2import { SlashCommand } from './SlashCommand.js';
4// eslint-disable-next-line no-unused-vars
5import { SlashCommandClosure } from './SlashCommandClosure.js';3import { SlashCommandClosure } from './SlashCommandClosure.js';
6import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';4import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
7// eslint-disable-next-line no-unused-vars
8import { PARSER_FLAG } from './SlashCommandParser.js';
9import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';5import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';
106
11export class SlashCommandExecutor {7export class SlashCommandExecutor {
@@ -28,11 +24,10 @@ export class SlashCommandExecutor {
28 arg.value.source = value;24 arg.value.source = value;
29 }25 }
30 }26 }
31 /**@type {SlashCommand}*/ command;27 /** @type {SlashCommand} */ command;
32 // @ts-ignore28 /** @type {SlashCommandNamedArgumentAssignment[]} */ namedArgumentList = [];
33 /**@type {SlashCommandNamedArgumentAssignment[]}*/ namedArgumentList = [];29 /** @type {SlashCommandUnnamedArgumentAssignment[]} */ unnamedArgumentList = [];
34 /**@type {SlashCommandUnnamedArgumentAssignment[]}*/ unnamedArgumentList = [];30 /** @type {import('./SlashCommandParser.js').ParserFlags} */ parserFlags;
35 /**@type {{[id:PARSER_FLAG]:boolean}} */ parserFlags;
3631
37 get commandCount() {32 get commandCount() {
38 return 133 return 1
public/scripts/slash-commands/SlashCommandNamedArgumentAssignment.js+4 -4
@@ -1,10 +1,10 @@
1import { SlashCommandClosure } from './SlashCommandClosure.js';1import { SlashCommandClosure } from './SlashCommandClosure.js';
22
3export class SlashCommandNamedArgumentAssignment {3export class SlashCommandNamedArgumentAssignment {
4 /**@type {number}*/ start;4 /** @type {number} */ start;
5 /**@type {number}*/ end;5 /** @type {number} */ end;
6 /**@type {string}*/ name;6 /** @type {string} */ name;
7 /**@type {string|SlashCommandClosure}*/ value;7 /** @type {string|SlashCommandClosure} */ value;
88
99
10 constructor() {10 constructor() {
public/scripts/slash-commands/SlashCommandNamedArgumentAutoCompleteOption.js+2 -3
@@ -1,11 +1,10 @@
1import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';1import { AutoCompleteOption } from '../autocomplete/AutoCompleteOption.js';
2import { SlashCommand } from './SlashCommand.js';2import { SlashCommand } from './SlashCommand.js';
3import { SlashCommandNamedArgument } from './SlashCommandArgument.js';3import { SlashCommandNamedArgument } from './SlashCommandArgument.js';
4import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
54
6export class SlashCommandNamedArgumentAutoCompleteOption extends AutoCompleteOption {5export class SlashCommandNamedArgumentAutoCompleteOption extends AutoCompleteOption {
7 /**@type {SlashCommandNamedArgument}*/ arg;6 /** @type {SlashCommandNamedArgument} */ arg;
8 /**@type {SlashCommand}*/ cmd;7 /** @type {SlashCommand} */ cmd;
98
10 /**9 /**
11 * @param {SlashCommandNamedArgument} arg10 * @param {SlashCommandNamedArgument} arg
public/scripts/slash-commands/SlashCommandParser.js+21 -22
@@ -8,11 +8,9 @@ import { SlashCommandExecutor } from './SlashCommandExecutor.js';
8import { SlashCommandParserError } from './SlashCommandParserError.js';8import { SlashCommandParserError } from './SlashCommandParserError.js';
9import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';9import { AutoCompleteNameResult } from '../autocomplete/AutoCompleteNameResult.js';
10import { SlashCommandQuickReplyAutoCompleteOption } from './SlashCommandQuickReplyAutoCompleteOption.js';10import { SlashCommandQuickReplyAutoCompleteOption } from './SlashCommandQuickReplyAutoCompleteOption.js';
11// eslint-disable-next-line no-unused-vars
12import { SlashCommandScope } from './SlashCommandScope.js';11import { SlashCommandScope } from './SlashCommandScope.js';
13import { SlashCommandVariableAutoCompleteOption } from './SlashCommandVariableAutoCompleteOption.js';12import { SlashCommandVariableAutoCompleteOption } from './SlashCommandVariableAutoCompleteOption.js';
14import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';13import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
15// eslint-disable-next-line no-unused-vars
16import { SlashCommandAbortController } from './SlashCommandAbortController.js';14import { SlashCommandAbortController } from './SlashCommandAbortController.js';
17import { SlashCommandAutoCompleteNameResult } from './SlashCommandAutoCompleteNameResult.js';15import { SlashCommandAutoCompleteNameResult } from './SlashCommandAutoCompleteNameResult.js';
18import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';16import { SlashCommandUnnamedArgumentAssignment } from './SlashCommandUnnamedArgumentAssignment.js';
@@ -28,16 +26,18 @@ import { t } from '../i18n.js';
28/** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */26/** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */
29/** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */27/** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */
3028
31/**@readonly*/29/**
32/**@enum {Number}*/30 * @enum {Number}
31 * @readonly
32 * @typedef {{[id:PARSER_FLAG]:boolean}} ParserFlags
33 */
33export const PARSER_FLAG = {34export const PARSER_FLAG = {
34 'STRICT_ESCAPING': 1,35 'STRICT_ESCAPING': 1,
35 'REPLACE_GETVAR': 2,36 'REPLACE_GETVAR': 2,
36};37};
3738
38export class SlashCommandParser {39export class SlashCommandParser {
39 // @ts-ignore40 /** @type {Object.<string, SlashCommand>} */ static commands = {};
40 /**@type {Object.<string, SlashCommand>}*/ static commands = {};
4141
42 /**42 /**
43 * @deprecated Use SlashCommandParser.addCommandObject() instead.43 * @deprecated Use SlashCommandParser.addCommandObject() instead.
@@ -101,26 +101,25 @@ export class SlashCommandParser {
101 get commands() {101 get commands() {
102 return SlashCommandParser.commands;102 return SlashCommandParser.commands;
103 }103 }
104 // @ts-ignore104 /** @type {Object.<string, string>} */ helpStrings = {};
105 /**@type {Object.<string, string>}*/ helpStrings = {};105 /** @type {boolean} */ verifyCommandNames = true;
106 /**@type {boolean}*/ verifyCommandNames = true;106 /** @type {string} */ text;
107 /**@type {string}*/ text;107 /** @type {number} */ index;
108 /**@type {number}*/ index;108 /** @type {SlashCommandAbortController} */ abortController;
109 /**@type {SlashCommandAbortController}*/ abortController;109 /** @type {SlashCommandDebugController} */ debugController;
110 /**@type {SlashCommandDebugController}*/ debugController;110 /** @type {SlashCommandScope} */ scope;
111 /**@type {SlashCommandScope}*/ scope;111 /** @type {SlashCommandClosure} */ closure;
112 /**@type {SlashCommandClosure}*/ closure;
113112
114 /**@type {Object.<PARSER_FLAG,boolean>}*/ flags = {};113 /** @type {Object.<PARSER_FLAG,boolean>} */ flags = {};
115114
116 /**@type {boolean}*/ jumpedEscapeSequence = false;115 /** @type {boolean} */ jumpedEscapeSequence = false;
117116
118 /**@type {{start:number, end:number}[]}*/ closureIndex;117 /** @type {{start:number, end:number}[]} */ closureIndex;
119 /**@type {{start:number, end:number, name:string}[]}*/ macroIndex;118 /** @type {{start:number, end:number, name:string}[]} */ macroIndex;
120 /**@type {SlashCommandExecutor[]}*/ commandIndex;119 /** @type {SlashCommandExecutor[]} */ commandIndex;
121 /**@type {SlashCommandScope[]}*/ scopeIndex;120 /** @type {SlashCommandScope[]} */ scopeIndex;
122121
123 /**@type {string}*/ parserContext;122 /** @type {string} */ parserContext;
124123
125 get userIndex() { return this.index; }124 get userIndex() { return this.index; }
126125
public/scripts/slash-commands/SlashCommandScope.js+6 -6
@@ -2,21 +2,21 @@ import { SlashCommandClosure } from './SlashCommandClosure.js';
2import { convertValueType } from '../utils.js';2import { convertValueType } from '../utils.js';
33
4export class SlashCommandScope {4export class SlashCommandScope {
5 /**@type {string[]}*/ variableNames = [];5 /** @type {string[]} */ variableNames = [];
6 get allVariableNames() {6 get allVariableNames() {
7 const names = [...this.variableNames, ...(this.parent?.allVariableNames ?? [])];7 const names = [...this.variableNames, ...(this.parent?.allVariableNames ?? [])];
8 return names.filter((it,idx)=>idx == names.indexOf(it));8 return names.filter((it,idx)=>idx == names.indexOf(it));
9 }9 }
10 // @ts-ignore10 // @ts-ignore
11 /**@type {object.<string, string|SlashCommandClosure>}*/ variables = {};11 /** @type {object.<string, string|SlashCommandClosure>} */ variables = {};
12 // @ts-ignore12 // @ts-ignore
13 /**@type {object.<string, string|SlashCommandClosure>}*/ macros = {};13 /** @type {object.<string, string|SlashCommandClosure>} */ macros = {};
14 /**@type {{key:string, value:string|SlashCommandClosure}[]} */14 /** @type {{key:string, value:string|SlashCommandClosure}[]} */
15 get macroList() {15 get macroList() {
16 return [...Object.keys(this.macros).map(key=>({ key, value:this.macros[key] })), ...(this.parent?.macroList ?? [])];16 return [...Object.keys(this.macros).map(key=>({ key, value:this.macros[key] })), ...(this.parent?.macroList ?? [])];
17 }17 }
18 /**@type {SlashCommandScope}*/ parent;18 /** @type {SlashCommandScope} */ parent;
19 /**@type {string}*/ #pipe;19 /** @type {string} */ #pipe;
20 get pipe() {20 get pipe() {
21 return this.#pipe ?? this.parent?.pipe;21 return this.#pipe ?? this.parent?.pipe;
22 }22 }
public/scripts/slash-commands/SlashCommandUnnamedArgumentAssignment.js+3 -3
@@ -1,9 +1,9 @@
1import { SlashCommandClosure } from './SlashCommandClosure.js';1import { SlashCommandClosure } from './SlashCommandClosure.js';
22
3export class SlashCommandUnnamedArgumentAssignment {3export class SlashCommandUnnamedArgumentAssignment {
4 /**@type {number}*/ start;4 /** @type {number} */ start;
5 /**@type {number}*/ end;5 /** @type {number} */ end;
6 /**@type {string|SlashCommandClosure}*/ value;6 /** @type {string|SlashCommandClosure} */ value;
77
88
9 constructor() {9 constructor() {
public/scripts/tags.js+0 -1
@@ -13,7 +13,6 @@ import {
13 DEFAULT_PRINT_TIMEOUT,13 DEFAULT_PRINT_TIMEOUT,
14 printCharacters,14 printCharacters,
15} from '../script.js';15} from '../script.js';
16// eslint-disable-next-line no-unused-vars
17import { FILTER_TYPES, FILTER_STATES, DEFAULT_FILTER_STATE, isFilterState, FilterHelper } from './filters.js';16import { FILTER_TYPES, FILTER_STATES, DEFAULT_FILTER_STATE, isFilterState, FilterHelper } from './filters.js';
1817
19import { groupCandidatesFilter, groups, selected_group } from './group-chats.js';18import { groupCandidatesFilter, groups, selected_group } from './group-chats.js';
public/scripts/variables.js+2 -2
@@ -9,7 +9,7 @@ import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
9import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';9import { SlashCommandClosureResult } from './slash-commands/SlashCommandClosureResult.js';
10import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';10import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
11import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';11import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
12import { PARSER_FLAG, SlashCommandParser } from './slash-commands/SlashCommandParser.js';12import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
13import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';13import { slashCommandReturnHelper } from './slash-commands/SlashCommandReturnHelper.js';
14import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';14import { SlashCommandScope } from './slash-commands/SlashCommandScope.js';
15import { isFalseBoolean, convertValueType, isTrueBoolean } from './utils.js';15import { isFalseBoolean, convertValueType, isTrueBoolean } from './utils.js';
@@ -583,7 +583,7 @@ export function evalBoolean(rule, a, b) {
583 * Executes a slash command from a string (may be enclosed in quotes) and returns the result.583 * Executes a slash command from a string (may be enclosed in quotes) and returns the result.
584 * @param {string} command Command to execute. May contain escaped macro and batch separators.584 * @param {string} command Command to execute. May contain escaped macro and batch separators.
585 * @param {SlashCommandScope} [scope] The scope to use.585 * @param {SlashCommandScope} [scope] The scope to use.
586 * @param {{[id:PARSER_FLAG]:boolean}} [parserFlags] The parser flags to use.586 * @param {import('./slash-commands/SlashCommandParser.js').ParserFlags} [parserFlags] The parser flags to use.
587 * @param {SlashCommandAbortController} [abortController] The abort controller to use.587 * @param {SlashCommandAbortController} [abortController] The abort controller to use.
588 * @returns {Promise<SlashCommandClosureResult>} Closure execution result588 * @returns {Promise<SlashCommandClosureResult>} Closure execution result
589 */589 */