From 9abf238189ce96593f3484fe4bb6fa723b219823 Mon Sep 17 00:00:00 2001 From: Connor Cameron Date: Thu, 10 Aug 2023 13:23:32 -0600 Subject: [PATCH 01/11] update linting with new codebase. prettier of ts files. #149 --- .eslintrc.json | 3 +- .github/workflows/eslint-prettier-on-pr.yml | 22 + .husky/pre-commit | 4 + .lintstagedrc | 3 + .prettierrc.json | 3 +- package-lock.json | 877 +++++++++++++++++- package.json | 12 +- .../lis-cancel-promise-controller.ts | 47 +- src/lis-gene-search-element.ts | 269 +++--- src/lis-linkout-element.ts | 49 +- src/lis-publication-search-element.ts | 146 +-- src/lis-qtl-search-element.ts | 151 +-- src/lis-trait-search-element.ts | 123 ++- 13 files changed, 1300 insertions(+), 409 deletions(-) create mode 100644 .github/workflows/eslint-prettier-on-pr.yml create mode 100755 .husky/pre-commit create mode 100644 .lintstagedrc diff --git a/.eslintrc.json b/.eslintrc.json index 4fd1dc0..cb030ad 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,8 @@ "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "prettier" ], "parser": "@typescript-eslint/parser", "parserOptions": { diff --git a/.github/workflows/eslint-prettier-on-pr.yml b/.github/workflows/eslint-prettier-on-pr.yml new file mode 100644 index 0000000..80037f3 --- /dev/null +++ b/.github/workflows/eslint-prettier-on-pr.yml @@ -0,0 +1,22 @@ +# workflow to enforce style and linting on PR +name: eslint-prettier +on: + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Setup npm environment to run tests + - uses: actions/setup-node@v3 + with: + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npx lint-staged + #- run: npx eslint-config-prettier ./**/*.ts + #- run: npx prettier --write ./**/*.ts + #- run: npx prettier --check ./**/*.ts + #- run: npx eslint ./**/*.ts diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..d24fdfc --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged diff --git a/.lintstagedrc b/.lintstagedrc new file mode 100644 index 0000000..3fbfad1 --- /dev/null +++ b/.lintstagedrc @@ -0,0 +1,3 @@ +{ + "*.ts": ["eslint-config-prettier", "prettier --write", "prettier --check"], +} diff --git a/.prettierrc.json b/.prettierrc.json index d271d1f..aeb070d 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,5 +3,6 @@ "tabWidth": 2, "singleQuote": true, "bracketSpacing": false, - "arrowParens": "always" + "arrowParens": "always", + "trailingComma": "all" } diff --git a/package-lock.json b/package-lock.json index 2e2f6a0..2a4ac8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,9 @@ "@web/test-runner-playwright": "^0.10.1", "@webcomponents/webcomponentsjs": "^2.8.0", "eslint": "^8.45.0", + "eslint-config-prettier": "^8.10.0", + "husky": "^8.0.0", + "lint-staged": "^13.2.3", "lit-analyzer": "^1.2.1", "prettier": "^3.0.0", "rimraf": "^5.0.1", @@ -3294,6 +3297,19 @@ "node": ">= 14" } }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -4141,6 +4157,15 @@ "node": ">=0.10.0" } }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -4168,6 +4193,112 @@ "@colors/colors": "1.5.0" } }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -4306,6 +4437,12 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, "node_modules/command-line-args": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", @@ -4354,6 +4491,15 @@ "node": ">=12.17" } }, + "node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -4846,6 +4992,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", + "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-scope": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.1.tgz", @@ -5070,6 +5228,68 @@ "node": ">= 0.6" } }, + "node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -5919,6 +6139,30 @@ "node": ">= 14" } }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -5985,6 +6229,15 @@ "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", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/inflation": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", @@ -6595,6 +6848,164 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "dependencies": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "dependencies": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/listr2/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/listr2/node_modules/slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/lit": { "version": "2.7.6", "resolved": "https://registry.npmjs.org/lit/-/lit-2.7.6.tgz", @@ -7001,6 +7412,12 @@ "node": ">= 0.6" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -7281,13 +7698,40 @@ "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/object-copy": { @@ -7376,9 +7820,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -7514,6 +7958,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -7689,6 +8148,18 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/playwright": { "version": "1.36.2", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.36.2.tgz", @@ -8242,6 +8713,12 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "node_modules/rimraf": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", @@ -8318,6 +8795,15 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8958,6 +9444,15 @@ "queue-tick": "^1.0.1" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -9012,6 +9507,18 @@ "node": ">=8" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -10043,6 +10550,15 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "17.7.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", @@ -12504,6 +13020,16 @@ "debug": "^4.3.4" } }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -13105,6 +13631,12 @@ } } }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -13124,6 +13656,72 @@ "string-width": "^4.2.0" } }, + "cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "requires": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true + }, + "ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true + }, + "slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "requires": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + } + }, + "string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "requires": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + } + }, + "strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "requires": { + "ansi-regex": "^6.0.1" + } + } + } + }, "cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -13232,6 +13830,12 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, + "colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, "command-line-args": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", @@ -13270,6 +13874,12 @@ } } }, + "commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -13731,6 +14341,13 @@ } } }, + "eslint-config-prettier": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", + "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "dev": true, + "requires": {} + }, "eslint-scope": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.1.tgz", @@ -13806,6 +14423,46 @@ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "dev": true }, + "execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "dependencies": { + "is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true + }, + "mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true + }, + "onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "requires": { + "mimic-fn": "^4.0.0" + } + } + } + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -14460,6 +15117,18 @@ "debug": "4" } }, + "human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true + }, + "husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -14497,6 +15166,12 @@ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, "inflation": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", @@ -14969,6 +15644,115 @@ } } }, + "lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true + }, + "lint-staged": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.2.3.tgz", + "integrity": "sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg==", + "dev": true, + "requires": { + "chalk": "5.2.0", + "cli-truncate": "^3.1.0", + "commander": "^10.0.0", + "debug": "^4.3.4", + "execa": "^7.0.0", + "lilconfig": "2.1.0", + "listr2": "^5.0.7", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-inspect": "^1.12.3", + "pidtree": "^0.6.0", + "string-argv": "^0.3.1", + "yaml": "^2.2.2" + }, + "dependencies": { + "chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true + } + } + }, + "listr2": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.8.tgz", + "integrity": "sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA==", + "dev": true, + "requires": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.19", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.8.0", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "cli-truncate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "requires": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "slice-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, "lit": { "version": "2.7.6", "resolved": "https://registry.npmjs.org/lit/-/lit-2.7.6.tgz", @@ -15307,6 +16091,12 @@ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", "dev": true }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -15531,6 +16321,23 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "requires": { + "path-key": "^4.0.0" + }, + "dependencies": { + "path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true + } + } + }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -15600,9 +16407,9 @@ } }, "object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", "dev": true }, "object-visit": { @@ -15699,6 +16506,15 @@ "p-limit": "^3.0.2" } }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -15831,6 +16647,12 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true + }, "playwright": { "version": "1.36.2", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.36.2.tgz", @@ -16242,6 +17064,12 @@ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "rimraf": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.1.tgz", @@ -16282,6 +17110,15 @@ "queue-microtask": "^1.2.2" } }, + "rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -16799,6 +17636,12 @@ "queue-tick": "^1.0.1" } }, + "string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -16839,6 +17682,12 @@ "ansi-regex": "^5.0.1" } }, + "strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -17614,6 +18463,12 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "yaml": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", + "dev": true + }, "yargs": { "version": "17.7.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", diff --git a/package.json b/package.json index fe669c7..194c86c 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,10 @@ "build:clean": "rimraf lib", "build:watch": "tsc --watch", "clean": "npm run bundle:clean & npm run build:clean & npm run test:clean", - "lint": "npm run lint:lit-analyzer && npm run lint:eslint", + "lint": "npm run lint:eslint", "lint:eslint": "eslint 'src/**/*.ts'", - "lint:lit-analyzer": "lit-analyzer", - "format": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --ignore-path ./.eslintignore --write", + "lint:lit-analyzer": "lit-analyzer 'src/**/*.ts'", + "format": "prettier 'src/**/*.ts' --write", "docs": "npm run docs:clean && npm run docs:gen", "docs:clean": "rimraf docs", "docs:gen": "npx typedoc --options typedoc.json", @@ -42,7 +42,8 @@ "test:prod:watch": "MODE=prod wtr --watch", "bundle": "rollup -c rollup.config.js", "bundle:clean": "rimraf dist", - "bundle:watch": "rollup -c -w" + "bundle:watch": "rollup -c -w", + "prepare": "husky install" }, "keywords": [ "typescript", @@ -68,6 +69,9 @@ "@web/test-runner-playwright": "^0.10.1", "@webcomponents/webcomponentsjs": "^2.8.0", "eslint": "^8.45.0", + "eslint-config-prettier": "^8.10.0", + "husky": "^8.0.0", + "lint-staged": "^13.2.3", "lit-analyzer": "^1.2.1", "prettier": "^3.0.0", "rimraf": "^5.0.1", diff --git a/src/controllers/lis-cancel-promise-controller.ts b/src/controllers/lis-cancel-promise-controller.ts index c7a5de1..eb48202 100644 --- a/src/controllers/lis-cancel-promise-controller.ts +++ b/src/controllers/lis-cancel-promise-controller.ts @@ -1,9 +1,11 @@ import {ReactiveController, ReactiveControllerHost} from 'lit'; - // defines internal state as an object to avoid race conditions -type CancelState = {abortSignal: AbortSignal; wrapCount: number; promise?: Promise}; - +type CancelState = { + abortSignal: AbortSignal; + wrapCount: number; + promise?: Promise; +}; /** * A controller that allows Promises to be cancelled. @@ -13,24 +15,20 @@ type CancelState = {abortSignal: AbortSignal; wrapCount: number; promise?: Promi * used if multiple signals are desired. */ export class LisCancelPromiseController implements ReactiveController { - /** @ignore */ host: ReactiveControllerHost; /** @ignore */ - // @ts-ignore private _abortController: AbortController; /** * The abort signal that will cause the wrapped promises to cancel. This * signal can be used externally. */ - // @ts-ignore abortSignal: AbortSignal; /** @ignore */ // wrap state with promise to avoid race conditions - // @ts-ignore private _cancelState: CancelState; /** @ignore */ @@ -97,7 +95,9 @@ export class LisCancelPromiseController implements ReactiveController { /** @ignore */ private _addEventListener(): void { - this.abortSignal.addEventListener('abort', this._aborted.bind(this), {once: true}); + this.abortSignal.addEventListener('abort', this._aborted.bind(this), { + once: true, + }); } /** @ignore */ @@ -109,15 +109,18 @@ export class LisCancelPromiseController implements ReactiveController { // add the abort event listener this._addEventListener(); // intialize the cancel state - let cancelState: CancelState = {abortSignal: this.abortSignal, wrapCount: 0}; + let cancelState: CancelState = { + abortSignal: this.abortSignal, + wrapCount: 0, + }; cancelState.promise = new Promise((_, reject) => { - // cancel the promise when the abort signal emits - cancelState.abortSignal.addEventListener( - 'abort', - (event: Event) => reject(event), - {once: true}, - ); - }) + // cancel the promise when the abort signal emits + cancelState.abortSignal.addEventListener( + 'abort', + (event: Event) => reject(event), + {once: true}, + ); + }) // the default error handler .catch((error: Error) => { // only throw an error if a Promise downstream can catch it @@ -136,13 +139,11 @@ export class LisCancelPromiseController implements ReactiveController { // redraw the host this.host.requestUpdate(); // wait for the redraw to complete in case any listeners rely on state from the template - this.host.updateComplete - .then(() => { - // call each listener - this._listeners.forEach((listener) => { - listener(event); - }); + this.host.updateComplete.then(() => { + // call each listener + this._listeners.forEach((listener) => { + listener(event); }); + }); } - } diff --git a/src/lis-gene-search-element.ts b/src/lis-gene-search-element.ts index 534879f..039c4c1 100644 --- a/src/lis-gene-search-element.ts +++ b/src/lis-gene-search-element.ts @@ -3,29 +3,26 @@ import {customElement, property, state} from 'lit/decorators.js'; import {live} from 'lit/directives/live.js'; import {Ref, createRef, ref} from 'lit/directives/ref.js'; - import {LisCancelPromiseController} from './controllers'; import {LisLoadingElement} from './core'; import {LisPaginatedSearchMixin, PaginatedSearchOptions} from './mixins'; - /** * The data used to construct the search form in the * {@link LisGeneSearchElement | `LisGeneSearchElement`} template. */ export type GeneSearchFormData = { genuses: { - genus: string, + genus: string; species: { - species: string, + species: string; strains: { - strain: string, - }[], - }[], + strain: string; + }[]; + }[]; }[]; }; - /** * Optional parameters that may be given to a form data function. The * {@link !AbortSignal | `AbortSignal`} instance will emit if a new function is provided @@ -34,14 +31,13 @@ export type GeneSearchFormData = { */ export type GeneFormDataOptions = {abortSignal?: AbortSignal}; - /** * The type signature of a function that may be used to load the data used to construct * the search form in the {@link LisGeneSearchElement | `LisGeneSearchElement`} template. */ -export type GeneFormDataFunction = - (options: GeneFormDataOptions) => Promise; - +export type GeneFormDataFunction = ( + options: GeneFormDataOptions, +) => Promise; /** * The data that will be passed to the search function by the @@ -55,7 +51,6 @@ export type GeneSearchData = { description: string; }; - /** * A single result of a gene search performed by the * {@link LisGeneSearchElement | `LisGeneSearchElement`} class. @@ -71,7 +66,6 @@ export type GeneSearchResult = { locations: string[]; }; - /** * The signature of the function the * {@link LisGeneSearchElement | `LisGeneSearchElement`} class requires for @@ -87,20 +81,18 @@ export type GeneSearchResult = { * {@link !Array | `Array`} of {@link GeneSearchResult | `GeneSearchResult`} * objects. */ -export type GeneSearchFunction = - ( - searchData: { - genus: string, - species: string, - strain: string, - identifier: string, - description: string, - family: string, - }, - page: number, - options: PaginatedSearchOptions - ) => Promise>; - +export type GeneSearchFunction = ( + searchData: { + genus: string; + species: string; + strain: string; + identifier: string; + description: string; + family: string; + }, + page: number, + options: PaginatedSearchOptions, +) => Promise>; /** * @htmlElement `` @@ -121,7 +113,7 @@ export type GeneSearchFunction = * - **family:** The gene family identifier provided in the search form. * - **page:** What page of results to load. * - * @example + * @example * {@link !HTMLElement | `HTMLElement`} properties can only be set via * JavaScript. This means the {@link searchFunction | `searchFunction`} property * must be set on a `` tag's instance of the @@ -143,7 +135,7 @@ export type GeneSearchFunction = * * ``` * - * @example + * @example * Data must be provided for the genus, species, and strain selectors in the search form. * This can be done by setting the form's {@link formData | `formData`} * attribute/property directly or by setting the @@ -168,9 +160,10 @@ export type GeneSearchFunction = * ``` */ @customElement('lis-gene-search-element') -export class LisGeneSearchElement extends -LisPaginatedSearchMixin(LitElement)() { - +export class LisGeneSearchElement extends LisPaginatedSearchMixin(LitElement)< + GeneSearchData, + GeneSearchResult +>() { /** @ignore */ // used by Lit to style the Shadow DOM // not necessary but exclusion breaks TypeDoc @@ -182,7 +175,7 @@ LisPaginatedSearchMixin(LitElement)() { * @attribute */ @property() - formData: GeneSearchFormData = {genuses: []} + formData: GeneSearchFormData = {genuses: []}; /** * An optional property that can be used to load the form data via an external function. @@ -191,8 +184,8 @@ LisPaginatedSearchMixin(LitElement)() { * @attribute */ @property({type: Function, attribute: false}) - formDataFunction: GeneFormDataFunction = - () => Promise.reject(new Error('No form data function provided')); + formDataFunction: GeneFormDataFunction = () => + Promise.reject(new Error('No form data function provided')); // the selected index of the genus select element @state() @@ -207,7 +200,9 @@ LisPaginatedSearchMixin(LitElement)() { private selectedStrain: number = 0; // a controller that allows in-flight form data requests to be cancelled - protected formDataCancelPromiseController = new LisCancelPromiseController(this); + protected formDataCancelPromiseController = new LisCancelPromiseController( + this, + ); // bind to the loading element in the template private _formLoadingRef: Ref = createRef(); @@ -216,35 +211,35 @@ LisPaginatedSearchMixin(LitElement)() { super(); // configure query string parameters this.requiredQueryStringParams = [ - ['genus'], - ['genus', 'species'], - ['genus', 'species', 'strain'], - ['identifier'], - ['description'], - ['family'], - ]; + ['genus'], + ['genus', 'species'], + ['genus', 'species', 'strain'], + ['identifier'], + ['description'], + ['family'], + ]; this.resultAttributes = [ - "name", - "identifier", - "locations", - "description", - "geneFamilyAssignments", - "genus", - "species", - "strain", + 'name', + 'identifier', + 'locations', + 'description', + 'geneFamilyAssignments', + 'genus', + 'species', + 'strain', ]; this.tableHeader = { - name: "Name", - identifier: "Identifier", - description: "Description", - genus: "Genus", - species: "Species", - strain: "Strain", - geneFamilyAssignments: "Gene Family Assignments", - locations: "Locations", + name: 'Name', + identifier: 'Identifier', + description: 'Description', + genus: 'Genus', + species: 'Species', + strain: 'Strain', + geneFamilyAssignments: 'Gene Family Assignments', + locations: 'Locations', }; this.tableColumnClasses = { - description: "uk-table-expand", + description: 'uk-table-expand', }; // initialize the form data with querystring parameters so a search can be performed // before the actual form data is loaded @@ -254,15 +249,10 @@ LisPaginatedSearchMixin(LitElement)() { formData.genuses.push({genus, species: []}); const species = this.queryStringController.getParameter('species'); if (species) { - formData - .genuses[0] - .species.push({species, strains: []}); + formData.genuses[0].species.push({species, strains: []}); const strain = this.queryStringController.getParameter('strain'); if (strain) { - formData - .genuses[0] - .species[0] - .strains.push({strain}); + formData.genuses[0].species[0].strains.push({strain}); } } } @@ -291,23 +281,24 @@ LisPaginatedSearchMixin(LitElement)() { this._formLoadingRef.value?.loading(); // make the form data function cancellable this.formDataCancelPromiseController.cancel(); - const options = {abortSignal: this.formDataCancelPromiseController.abortSignal}; + const options = { + abortSignal: this.formDataCancelPromiseController.abortSignal, + }; const formDataPromise = this.formDataFunction(options); // call the cancellable function - this.formDataCancelPromiseController.wrapPromise(formDataPromise) - .then( - (formData) => { - this._formLoadingRef.value?.success(); - this.formData = formData; - }, - (error: Error) => { - // do nothing if the request was aborted - if ((error as any).type !== 'abort') { - this._formLoadingRef.value?.failure(); - throw error; - } - }, - ); + this.formDataCancelPromiseController.wrapPromise(formDataPromise).then( + (formData) => { + this._formLoadingRef.value?.success(); + this.formData = formData; + }, + (error: Error) => { + // do nothing if the request was aborted + if ((error as any).type !== 'abort') { + this._formLoadingRef.value?.failure(); + throw error; + } + }, + ); } // sets the selected indexes based on querystring parameters @@ -315,33 +306,27 @@ LisPaginatedSearchMixin(LitElement)() { const genus = this.queryStringController.getParameter('genus'); if (genus) { this.selectedGenus = - this.formData - .genuses - .map(({genus}) => genus) - .indexOf(genus)+1; + this.formData.genuses.map(({genus}) => genus).indexOf(genus) + 1; } else { this.selectedGenus = 0; } const species = this.queryStringController.getParameter('species'); if (this.selectedGenus && species) { this.selectedSpecies = - this.formData - .genuses[this.selectedGenus-1] - .species - .map(({species}) => species) - .indexOf(species)+1; + this.formData.genuses[this.selectedGenus - 1].species + .map(({species}) => species) + .indexOf(species) + 1; } else { this.selectedSpecies = 0; } const strain = this.queryStringController.getParameter('strain'); if (this.selectedSpecies && strain) { this.selectedStrain = - this.formData - .genuses[this.selectedGenus-1] - .species[this.selectedSpecies-1] - .strains - .map(({strain}) => strain) - .indexOf(strain)+1; + this.formData.genuses[this.selectedGenus - 1].species[ + this.selectedSpecies - 1 + ].strains + .map(({strain}) => strain) + .indexOf(strain) + 1; } else { this.selectedStrain = 0; } @@ -357,14 +342,16 @@ LisPaginatedSearchMixin(LitElement)() { // renders the genus selector private _renderGenusSelector() { - const options = - this.formData.genuses.map(({genus}) => { - return html``; - }); + const options = this.formData.genuses.map(({genus}) => { + return html``; + }); return html` - @@ -382,15 +369,19 @@ LisPaginatedSearchMixin(LitElement)() { private _renderSpeciesSelector() { let options = [html``]; if (this.selectedGenus) { - options = - this.formData.genuses[this.selectedGenus-1].species.map(({species}) => { + options = this.formData.genuses[this.selectedGenus - 1].species.map( + ({species}) => { return html``; - }); + }, + ); } return html` - @@ -407,28 +398,28 @@ LisPaginatedSearchMixin(LitElement)() { private _renderStrainSelector() { let options = [html``]; if (this.selectedSpecies) { - options = - this.formData - .genuses[this.selectedGenus-1] - .species[this.selectedSpecies-1] - .strains.map(({strain}) => { - return html``; - }); + options = this.formData.genuses[this.selectedGenus - 1].species[ + this.selectedSpecies - 1 + ].strains.map(({strain}) => { + return html``; + }); } return html` - - ` + `; } /** @ignore */ // used by LisPaginatedSearchMixin to draw the search form part of template override renderForm() { - // render the form's selectors const genusSelector = this._renderGenusSelector(); const speciesSelector = this._renderSpeciesSelector(); @@ -439,7 +430,9 @@ LisPaginatedSearchMixin(LitElement)() {
Gene Search - +
@@ -457,34 +450,48 @@ LisPaginatedSearchMixin(LitElement)() {
- + e.g. Glyma.13G357700
- - e.g. protein disulfide isomerase-like protein + + e.g. protein disulfide isomerase-like protein
- + e.g. L_HZ6G4Z
- +
`; } - } - declare global { interface HTMLElementTagNameMap { 'lis-gene-search-element': LisGeneSearchElement; diff --git a/src/lis-linkout-element.ts b/src/lis-linkout-element.ts index bb7da15..a1486e6 100644 --- a/src/lis-linkout-element.ts +++ b/src/lis-linkout-element.ts @@ -5,7 +5,6 @@ import {Ref, createRef, ref} from 'lit/directives/ref.js'; import {LisCancelPromiseController} from './controllers'; import {LisLoadingElement, LisSimpleTableElement} from './core'; - /** * A single result of a linkout performed by the * {@link LisLinkoutElement | `LisLinkoutElement`} class. @@ -15,7 +14,6 @@ export type LinkoutResult = { text: string; }; - /** * The type of object the {@link LisLinkoutElement | `LisLinkoutElement`} expects back * from the linkout function. @@ -24,7 +22,6 @@ export type LinkoutResults = { results: LinkoutResult[]; }; - /** * Optional parameters that may be given to the linkout function. The * {@link !AbortSignal | `AbortSignal`} instance will emit if a linkout is performed @@ -33,7 +30,6 @@ export type LinkoutResults = { */ export type LinkoutOptions = {abortSignal?: AbortSignal}; - /** * The signature of the function of the * {@link LisLinkoutElement | `LisLinkoutElement`} class required for @@ -48,16 +44,16 @@ export type LinkoutOptions = {abortSignal?: AbortSignal}; * @returns A {@link !Promise | `Promise`} that resolves to a * {@link LinkoutResults | `LinkoutResults`} object. */ -export type LinkoutFunction = - (linkoutData: LinkoutData, options: LinkoutOptions) => - Promise; - +export type LinkoutFunction = ( + linkoutData: LinkoutData, + options: LinkoutOptions, +) => Promise; /** * @htmlElement `` * * A Web Component that provides an interface for performing linkout queries against an - * a linkout service. + * a linkout service. * The returned links are displayed in a table. * * @example @@ -87,7 +83,6 @@ export type LinkoutFunction = */ @customElement('lis-linkout-element') export class LisLinkoutElement extends LitElement { - // a controller that allows in-flight linkouts to be cancelled protected cancelPromiseController = new LisCancelPromiseController(this); @@ -123,8 +118,8 @@ export class LisLinkoutElement extends LitElement { // the linkout callback function; not an attribute because functions can't be // parsed from attributes @property({type: Function, attribute: false}) - linkoutFunction: LinkoutFunction = - () => Promise.reject(new Error('No linkout function provided')); + linkoutFunction: LinkoutFunction = () => + Promise.reject(new Error('No linkout function provided')); // bind to the table element in the template @query('lis-simple-table-element') @@ -147,17 +142,16 @@ export class LisLinkoutElement extends LitElement { this.cancelPromiseController.cancel(); const options = {abortSignal: this.cancelPromiseController.abortSignal}; const linkoutPromise = this.linkoutFunction(data, options); - this.cancelPromiseController.wrapPromise(linkoutPromise) - .then( - (results: LinkoutResults) => this._linkoutSuccess(results), - (error: Error) => { - // do nothing if the request was aborted - if ((error as any).type !== 'abort') { - this._loadingRef.value?.failure(); - throw error; - } - }, - ); + this.cancelPromiseController.wrapPromise(linkoutPromise).then( + (results: LinkoutResults) => this._linkoutSuccess(results), + (error: Error) => { + // do nothing if the request was aborted + if ((error as any).type !== 'abort') { + this._loadingRef.value?.failure(); + throw error; + } + }, + ); } /** @ignore */ @@ -181,10 +175,9 @@ export class LisLinkoutElement extends LitElement { /** @ignore */ // used by Lit to draw the template override render() { - // compute table parts - const dataAttributes = ['linkout'] - const header = {'linkout': 'Linkouts'}; + const dataAttributes = ['linkout']; + const header = {linkout: 'Linkouts'}; // draw the table return html` @@ -193,14 +186,14 @@ export class LisLinkoutElement extends LitElement { + .header=${header} + > `; } } - declare global { interface HTMLElementTagNameMap { 'lis-linkout-element': LisLinkoutElement; diff --git a/src/lis-publication-search-element.ts b/src/lis-publication-search-element.ts index ee1fec2..fb3de3d 100644 --- a/src/lis-publication-search-element.ts +++ b/src/lis-publication-search-element.ts @@ -3,31 +3,28 @@ import {customElement} from 'lit/decorators.js'; import {LisPaginatedSearchMixin, PaginatedSearchOptions} from './mixins'; - /** * The data that will be passed to the search function by the * {@link LisPublicationSearchElement | `LisPublicationSearchElement`} class when a search is * performed. */ export type PublicationSearchData = { - query: string; + query: string; }; - /** * A single result of a Publication search performed by the * {@link LisPublicationSearchElement | `LisPublicationSearchElement`} class. */ export type PublicationSearchResult = { - year: number; - title: string; - journal: string; - firstAuthor: string; - doi: string; - pubMedId: string; + year: number; + title: string; + journal: string; + firstAuthor: string; + doi: string; + pubMedId: string; }; - /** * The signature of the function the * {@link LisPublicationSearchElement | `LisPublicationSearchElement`} class requires for @@ -44,9 +41,11 @@ export type PublicationSearchResult = { * {@link !Array | `Array`} of {@link PublicationSearchResult | `PublicationSearchResult`} * objects. */ -export type PublicationSearchFunction = - (query: string, page: number, options: PaginatedSearchOptions) => Promise>; - +export type PublicationSearchFunction = ( + query: string, + page: number, + options: PaginatedSearchOptions, +) => Promise>; /** * @htmlElement `` @@ -63,7 +62,7 @@ export type PublicationSearchFunction = * - **query:** The text in the query field of the search form. * - **page:** What page of results is loaded. * - * @example + * @example * {@link !HTMLElement | `HTMLElement`} properties can only be set via * JavaScript. This means the {@link searchFunction | `searchFunction`} property * must be set on a `` tag's instance of the @@ -85,7 +84,7 @@ export type PublicationSearchFunction = * * ``` * - * @example + * @example * The {@link LisPublicationSearchElement | `LisPublicationSearchElement`} class inherits the * {@link resultAttributes | `resultAttributes`} and * {@link tableHeader | `tableHeader`} properties from @@ -114,66 +113,69 @@ export type PublicationSearchFunction = * ``` */ @customElement('lis-publication-search-element') -export class LisPublicationSearchElement extends -LisPaginatedSearchMixin(LitElement)() { +export class LisPublicationSearchElement extends LisPaginatedSearchMixin( + LitElement, +)() { + /** @ignore */ + // used by Lit to style the Shadow DOM + // not necessary but exclusion breaks TypeDoc + static override styles = css``; - /** @ignore */ - // used by Lit to style the Shadow DOM - // not necessary but exclusion breaks TypeDoc - static override styles = css``; - - constructor() { - super(); - // configure query string parameters - this.requiredQueryStringParams = [['query']]; - // configure results table - this.resultAttributes = [ - 'year', - 'title', - 'journal', - 'firstAuthor', - 'doi', - 'pubMedId' - ]; - this.tableHeader = { - 'year': 'Year', - 'title': 'Title', - 'journal': 'Journal', - 'firstAuthor': 'First Author', - 'doi': 'DOI', - 'pubMedId': 'PubMed' - }; - } - - /** @ignore */ - // used by LisPaginatedSearchMixin to draw the template - override renderForm() { - return html` -
-
-Publication title search (e.g. expression) -
- -
-
- -
-
-
-`; - } + constructor() { + super(); + // configure query string parameters + this.requiredQueryStringParams = [['query']]; + // configure results table + this.resultAttributes = [ + 'year', + 'title', + 'journal', + 'firstAuthor', + 'doi', + 'pubMedId', + ]; + this.tableHeader = { + year: 'Year', + title: 'Title', + journal: 'Journal', + firstAuthor: 'First Author', + doi: 'DOI', + pubMedId: 'PubMed', + }; + } + /** @ignore */ + // used by LisPaginatedSearchMixin to draw the template + override renderForm() { + return html` +
+
+ + Publication title search (e.g. expression) + +
+ +
+
+ +
+
+
+ `; + } } - declare global { - interface HTMLElementTagNameMap { - 'lis-publication-search-element': LisPublicationSearchElement; - } + interface HTMLElementTagNameMap { + 'lis-publication-search-element': LisPublicationSearchElement; + } } diff --git a/src/lis-qtl-search-element.ts b/src/lis-qtl-search-element.ts index 25b615d..240ee10 100644 --- a/src/lis-qtl-search-element.ts +++ b/src/lis-qtl-search-element.ts @@ -3,32 +3,29 @@ import {customElement} from 'lit/decorators.js'; import {LisPaginatedSearchMixin, PaginatedSearchOptions} from './mixins'; - /** * The data that will be passed to the search function by the * {@link LisQTLSearchElement | `LisQTLSearchElement`} class when a search is * performed. */ export type QTLSearchData = { - query: string; + query: string; }; - /** * A single result of a QTL search performed by the * {@link LisQTLSearchElement | `LisQTLSearchElement`} class. */ export type QTLSearchResult = { - trait_name: string; - identifier: string; - linkageGroup_geneticMap_identifier: string; - linkageGroup_identifier: string; - start: number; - end: number; - markerNames: string; + trait_name: string; + identifier: string; + linkageGroup_geneticMap_identifier: string; + linkageGroup_identifier: string; + start: number; + end: number; + markerNames: string; }; - /** * The signature of the function the * {@link LisQTLSearchElement | `LisQTLSearchElement`} class requires for @@ -45,9 +42,11 @@ export type QTLSearchResult = { * {@link !Array | `Array`} of {@link QTLSearchResult | `QTLSearchResult`} * objects. */ -export type QTLSearchFunction = - (query: string, page: number, options: PaginatedSearchOptions) => Promise>; - +export type QTLSearchFunction = ( + query: string, + page: number, + options: PaginatedSearchOptions, +) => Promise>; /** * @htmlElement `` @@ -64,7 +63,7 @@ export type QTLSearchFunction = * - **query:** The text in the query field of the search form. * - **page:** What page of results is loaded. * - * @example + * @example * {@link !HTMLElement | `HTMLElement`} properties can only be set via * JavaScript. This means the {@link searchFunction | `searchFunction`} property * must be set on a `` tag's instance of the @@ -86,7 +85,7 @@ export type QTLSearchFunction = * * ``` * - * @example + * @example * The {@link LisQTLSearchElement | `LisQTLSearchElement`} class inherits the * {@link resultAttributes | `resultAttributes`} and * {@link tableHeader | `tableHeader`} properties from @@ -115,68 +114,70 @@ export type QTLSearchFunction = * ``` */ @customElement('lis-qtl-search-element') -export class LisQTLSearchElement extends -LisPaginatedSearchMixin(LitElement)() { +export class LisQTLSearchElement extends LisPaginatedSearchMixin(LitElement)< + QTLSearchData, + QTLSearchResult +>() { + /** @ignore */ + // used by Lit to style the Shadow DOM + // not necessary but exclusion breaks TypeDoc + static override styles = css``; - /** @ignore */ - // used by Lit to style the Shadow DOM - // not necessary but exclusion breaks TypeDoc - static override styles = css``; - - constructor() { - super(); - // configure query string parameters - this.requiredQueryStringParams = [['query']]; - // configure results table - this.resultAttributes = [ - 'trait_name', - 'identifier', - 'linkageGroup_geneticMap_identifier', - 'linkageGroup_identifier', - 'start', - 'end', - 'markerNames' - ]; - this.tableHeader = { - 'trait_name': 'Trait', - 'identifier': 'QTL', - 'linkageGroup_geneticMap_identifier': 'Genetic Map', - 'linkageGroup_identifier': 'Linkage Group', - 'start': 'Start', - 'end': 'End', - 'markerNames': 'Markers' - }; - } - - /** @ignore */ - // used by LisPaginatedSearchMixin to draw the template - override renderForm() { - return html` -
-
-QTL trait name search (e.g. flower) -
- -
-
- -
-
-
-`; - } + constructor() { + super(); + // configure query string parameters + this.requiredQueryStringParams = [['query']]; + // configure results table + this.resultAttributes = [ + 'trait_name', + 'identifier', + 'linkageGroup_geneticMap_identifier', + 'linkageGroup_identifier', + 'start', + 'end', + 'markerNames', + ]; + this.tableHeader = { + trait_name: 'Trait', + identifier: 'QTL', + linkageGroup_geneticMap_identifier: 'Genetic Map', + linkageGroup_identifier: 'Linkage Group', + start: 'Start', + end: 'End', + markerNames: 'Markers', + }; + } + /** @ignore */ + // used by LisPaginatedSearchMixin to draw the template + override renderForm() { + return html` +
+
+ QTL trait name search (e.g. flower) +
+ +
+
+ +
+
+
+ `; + } } - declare global { - interface HTMLElementTagNameMap { - 'lis-qtl-search-element': LisQTLSearchElement; - } + interface HTMLElementTagNameMap { + 'lis-qtl-search-element': LisQTLSearchElement; + } } diff --git a/src/lis-trait-search-element.ts b/src/lis-trait-search-element.ts index 77321a9..2db557a 100644 --- a/src/lis-trait-search-element.ts +++ b/src/lis-trait-search-element.ts @@ -3,28 +3,25 @@ import {customElement} from 'lit/decorators.js'; import {LisPaginatedSearchMixin, PaginatedSearchOptions} from './mixins'; - /** * The data that will be passed to the search function by the * {@link LisTraitSearchElement | `LisTraitSearchElement`} class when a * search is performed. */ export type TraitSearchData = { - query: string; + query: string; }; - /** * A single result of a trait search performed by the * {@link LisTraitSearchElement | `LisTraitSearchElement`} class. */ export type TraitSearchResult = { - identifier: string; - name: string; - description: string; + identifier: string; + name: string; + description: string; }; - /** * The signature of the function the * {@link LisTraitSearchElement | `LisTraitSearchElement`} class requires for @@ -41,9 +38,11 @@ export type TraitSearchResult = { * {@link !Array | `Array`} of {@link TraitSearchResult | `TraitSearchResult`} * objects. */ -export type TraitSearchFunction = - (query: string, page: number, options: PaginatedSearchOptions) => Promise>; - +export type TraitSearchFunction = ( + query: string, + page: number, + options: PaginatedSearchOptions, +) => Promise>; /** * @htmlElement `` @@ -60,7 +59,7 @@ export type TraitSearchFunction = * - **query:** The text in the query field of the search form. * - **page:** What page of results is loaded. * - * @example + * @example * {@link !HTMLElement | `HTMLElement`} properties can only be set via * JavaScript. This means the {@link searchFunction | `searchFunction`} property * must be set on a `` tag's instance of the @@ -82,7 +81,7 @@ export type TraitSearchFunction = * * ``` * - * @example + * @example * The {@link LisTraitSearchElement | `LisTraitSearchElement`} class inherits the * {@link resultAttributes | `resultAttributes`} and * {@link tableHeader | `tableHeader`} properties from @@ -112,60 +111,58 @@ export type TraitSearchFunction = * ``` */ @customElement('lis-trait-search-element') -export class LisTraitSearchElement extends -LisPaginatedSearchMixin(LitElement)() { +export class LisTraitSearchElement extends LisPaginatedSearchMixin(LitElement)< + TraitSearchData, + TraitSearchResult +>() { + /** @ignore */ + // used by Lit to style the Shadow DOM + // not necessary but exclusion breaks TypeDoc + static override styles = css``; - /** @ignore */ - // used by Lit to style the Shadow DOM - // not necessary but exclusion breaks TypeDoc - static override styles = css``; - - constructor() { - super(); - // configure query string parameters - this.requiredQueryStringParams = [['query']]; - // configure results table - this.resultAttributes = [ - 'name', - 'identifier', - 'description' - ]; - this.tableHeader = { - name: 'Name', - identifier: 'Identifier', - description: 'Description' - }; - } - - /** @ignore */ - // used by LisPaginatedSearchMixin to draw the template - override renderForm() { - return html` -
-
-Trait name search (e.g. flower) -
- -
-
- -
-
-
-`; - } + constructor() { + super(); + // configure query string parameters + this.requiredQueryStringParams = [['query']]; + // configure results table + this.resultAttributes = ['name', 'identifier', 'description']; + this.tableHeader = { + name: 'Name', + identifier: 'Identifier', + description: 'Description', + }; + } + /** @ignore */ + // used by LisPaginatedSearchMixin to draw the template + override renderForm() { + return html` +
+
+ Trait name search (e.g. flower) +
+ +
+
+ +
+
+
+ `; + } } - declare global { - interface HTMLElementTagNameMap { - 'lis-trait-search-element': LisTraitSearchElement; - } + interface HTMLElementTagNameMap { + 'lis-trait-search-element': LisTraitSearchElement; + } } From 3749bd6505558899f7a887ff5666a951562e01ac Mon Sep 17 00:00:00 2001 From: Alan Cleary Date: Fri, 11 Aug 2023 13:07:09 -0600 Subject: [PATCH 02/11] Fixed eslint errors. The code was updated whenever possible. However, in some cases the linter is being ignored becaused the code is canonical TypeScript that happens to conflict with the linter. The functionality of the code did not change. --- .../lis-cancel-promise-controller.ts | 6 ++-- src/controllers/lis-slot-controller.ts | 2 +- src/lis-gene-search-element.ts | 28 +++++++++++-------- src/lis-linkout-element.ts | 4 +-- src/mixins/lis-paginated-search-mixin.ts | 6 ++-- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/controllers/lis-cancel-promise-controller.ts b/src/controllers/lis-cancel-promise-controller.ts index c7a5de1..3632491 100644 --- a/src/controllers/lis-cancel-promise-controller.ts +++ b/src/controllers/lis-cancel-promise-controller.ts @@ -18,6 +18,7 @@ export class LisCancelPromiseController implements ReactiveController { host: ReactiveControllerHost; /** @ignore */ + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore private _abortController: AbortController; @@ -25,11 +26,13 @@ export class LisCancelPromiseController implements ReactiveController { * The abort signal that will cause the wrapped promises to cancel. This * signal can be used externally. */ + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore abortSignal: AbortSignal; /** @ignore */ // wrap state with promise to avoid race conditions + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore private _cancelState: CancelState; @@ -73,7 +76,6 @@ export class LisCancelPromiseController implements ReactiveController { wrapPromise(promise: Promise): Promise { // create a Promise race that will reject when the abort signal emits const cancelState = this._cancelState; - // @ts-ignore cancelState.wrapCount += 1; return Promise.race([promise, cancelState.promise]) as Promise; } @@ -109,7 +111,7 @@ export class LisCancelPromiseController implements ReactiveController { // add the abort event listener this._addEventListener(); // intialize the cancel state - let cancelState: CancelState = {abortSignal: this.abortSignal, wrapCount: 0}; + const cancelState: CancelState = {abortSignal: this.abortSignal, wrapCount: 0}; cancelState.promise = new Promise((_, reject) => { // cancel the promise when the abort signal emits cancelState.abortSignal.addEventListener( diff --git a/src/controllers/lis-slot-controller.ts b/src/controllers/lis-slot-controller.ts index 058a963..7c800c7 100644 --- a/src/controllers/lis-slot-controller.ts +++ b/src/controllers/lis-slot-controller.ts @@ -111,7 +111,7 @@ export class LisSlotController implements ReactiveController { try { //ref.value.assign(...slotChildren); // renders via Shadow DOM ref.value.replaceChildren(...slotChildren); // fakes Shadow DOM by moving children - } catch(error) { } + } catch(error) { /* no-op */ } } }); } diff --git a/src/lis-gene-search-element.ts b/src/lis-gene-search-element.ts index 534879f..c63b4b5 100644 --- a/src/lis-gene-search-element.ts +++ b/src/lis-gene-search-element.ts @@ -274,7 +274,7 @@ LisPaginatedSearchMixin(LitElement)() { } // called after every component update, e.g. when a property changes - override updated(changedProperties: Map) { + override updated(changedProperties: Map) { // call the formDataFunction every time its value changes if (changedProperties.has('formDataFunction')) { this._getFormData(); @@ -300,9 +300,10 @@ LisPaginatedSearchMixin(LitElement)() { this._formLoadingRef.value?.success(); this.formData = formData; }, - (error: Error) => { + (error: Error|Event) => { // do nothing if the request was aborted - if ((error as any).type !== 'abort') { + //if ((error as unknown).type !== 'abort') { + if (!(error instanceof Event && error.type === 'abort')) { this._formLoadingRef.value?.failure(); throw error; } @@ -349,10 +350,11 @@ LisPaginatedSearchMixin(LitElement)() { // called when a genus is selected private _selectGenus(event: Event) { - // @ts-ignore - this.selectedGenus = event.target.selectedIndex; - this.selectedSpecies = 0; - this.selectedStrain = 0; + if (event.target != null) { + this.selectedGenus = (event.target as HTMLSelectElement).selectedIndex; + this.selectedSpecies = 0; + this.selectedStrain = 0; + } } // renders the genus selector @@ -373,9 +375,10 @@ LisPaginatedSearchMixin(LitElement)() { // called when a species is selected private _selectSpecies(event: Event) { - // @ts-ignore - this.selectedSpecies = event.target.selectedIndex; - this.selectedStrain = 0; + if (event.target != null) { + this.selectedSpecies = (event.target as HTMLSelectElement).selectedIndex; + this.selectedStrain = 0; + } } // renders the species selector @@ -399,8 +402,9 @@ LisPaginatedSearchMixin(LitElement)() { // called when an strain is selected private _selectStrain(event: Event) { - // @ts-ignore - this.selectedStrain = event.target.selectedIndex; + if (event.target != null) { + this.selectedStrain = (event.target as HTMLSelectElement).selectedIndex; + } } // renders the strain selector diff --git a/src/lis-linkout-element.ts b/src/lis-linkout-element.ts index bb7da15..f633805 100644 --- a/src/lis-linkout-element.ts +++ b/src/lis-linkout-element.ts @@ -150,9 +150,9 @@ export class LisLinkoutElement extends LitElement { this.cancelPromiseController.wrapPromise(linkoutPromise) .then( (results: LinkoutResults) => this._linkoutSuccess(results), - (error: Error) => { + (error: Error|Event) => { // do nothing if the request was aborted - if ((error as any).type !== 'abort') { + if (!(error instanceof Event && error.type === 'abort')) { this._loadingRef.value?.failure(); throw error; } diff --git a/src/mixins/lis-paginated-search-mixin.ts b/src/mixins/lis-paginated-search-mixin.ts index 18720ea..23d6de0 100644 --- a/src/mixins/lis-paginated-search-mixin.ts +++ b/src/mixins/lis-paginated-search-mixin.ts @@ -25,6 +25,7 @@ import {StringObjectModel} from '../models'; * @param args - The arguments that will be passed to the super class * constructor. */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any export type Constructor = new (...args: Params) => T; @@ -402,6 +403,7 @@ class LisPaginatedSearchElement extends superClass { // constructor // ///////////////// + // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(...rest: any[]) { super(...rest); // submit the form after the DOM is finished loading @@ -521,9 +523,9 @@ class LisPaginatedSearchElement extends superClass { this.cancelPromiseController.wrapPromise(searchPromise) .then( (results: PaginatedSearchResults) => this._searchSuccess(results), - (error: Error) => { + (error: Error|Event) => { // do nothing if the request was aborted - if ((error as any).type !== 'abort') { + if (!(error instanceof Event && error.type === 'abort')) { this._loadingRef.value?.failure(); throw error; } From 89d00227e1b69e2e64c5c3239e359f9d9b701d3a Mon Sep 17 00:00:00 2001 From: Connor Cameron Date: Mon, 14 Aug 2023 12:09:42 -0600 Subject: [PATCH 03/11] full format of ts files using prettier write. #149. --- .../lis-dom-content-loaded-controller.ts | 24 ++++++------ .../lis-query-string-parameters-controller.ts | 22 +++++------ src/core/lis-alert-element.ts | 8 +--- src/core/lis-form-wrapper-element.ts | 13 +++---- src/core/lis-loading-element.ts | 17 +++++---- src/core/lis-modal-element.ts | 34 +++++++++-------- src/core/lis-pagination-element.ts | 33 +++++++++------- src/core/lis-simple-table-element.ts | 38 ++++++++++++------- 8 files changed, 100 insertions(+), 89 deletions(-) diff --git a/src/controllers/lis-dom-content-loaded-controller.ts b/src/controllers/lis-dom-content-loaded-controller.ts index d34bce6..e8c2b1e 100644 --- a/src/controllers/lis-dom-content-loaded-controller.ts +++ b/src/controllers/lis-dom-content-loaded-controller.ts @@ -1,13 +1,11 @@ import {ReactiveController, ReactiveControllerHost} from 'lit'; - /** * A controller that allows components to subsribe to the * {@link !DOMContentLoaded | `DOMContentLoaded`} event in a manner that * triggers changes in the component's template when the event occurs. */ export class LisDomContentLoadedController implements ReactiveController { - /** @ignore */ host: ReactiveControllerHost; @@ -23,12 +21,18 @@ export class LisDomContentLoadedController implements ReactiveController { /** @ignore */ hostConnected() { - document.addEventListener('DOMContentLoaded', this._contentLoaded.bind(this)); + document.addEventListener( + 'DOMContentLoaded', + this._contentLoaded.bind(this), + ); } /** @ignore */ hostDisconnected() { - document.removeEventListener('DOMContentLoaded', this._contentLoaded.bind(this)); + document.removeEventListener( + 'DOMContentLoaded', + this._contentLoaded.bind(this), + ); } /** @@ -48,13 +52,11 @@ export class LisDomContentLoadedController implements ReactiveController { // redraw the host this.host.requestUpdate(); // wait for the redraw to complete in case any listeners rely on state from the template - this.host.updateComplete - .then(() => { - // call each listener - this._listeners.forEach((listener) => { - listener(event); - }); + this.host.updateComplete.then(() => { + // call each listener + this._listeners.forEach((listener) => { + listener(event); }); + }); } - } diff --git a/src/controllers/lis-query-string-parameters-controller.ts b/src/controllers/lis-query-string-parameters-controller.ts index 71ed112..b1a6f0a 100644 --- a/src/controllers/lis-query-string-parameters-controller.ts +++ b/src/controllers/lis-query-string-parameters-controller.ts @@ -1,13 +1,11 @@ import {ReactiveController, ReactiveControllerHost} from 'lit'; - /** * A controller that allows components to interact with URL query string * parameters in a manner that triggers changes in the component's template when * parameter values change. */ export class LisQueryStringParametersController implements ReactiveController { - /** @ignore */ host: ReactiveControllerHost; @@ -65,7 +63,8 @@ export class LisQueryStringParametersController implements ReactiveController { return; } // push the new params onto the browser's history stack - const queryString = '?' + + const queryString = + '?' + Object.entries(parameters) .map(([key, value]) => `${key}=${value}`) .join('&'); @@ -98,8 +97,9 @@ export class LisQueryStringParametersController implements ReactiveController { // determines if any of the given parameters have different values than the URL parameters private _differentValues(parameters: Object): boolean { const params = new URLSearchParams(window.location.search); - return Object.entries(parameters) - .some(([key, value]) => value.toString() !== params.get(key)); + return Object.entries(parameters).some( + ([key, value]) => value.toString() !== params.get(key), + ); } /** @ignore */ @@ -112,13 +112,11 @@ export class LisQueryStringParametersController implements ReactiveController { // redraw the host this.host.requestUpdate(); // wait for the redraw to complete in case any listeners rely on state from the template - this.host.updateComplete - .then(() => { - // call each listener - this._listeners.forEach((listener) => { - listener(event); - }); + this.host.updateComplete.then(() => { + // call each listener + this._listeners.forEach((listener) => { + listener(event); }); + }); } - } diff --git a/src/core/lis-alert-element.ts b/src/core/lis-alert-element.ts index 934bac9..7a5c2fe 100644 --- a/src/core/lis-alert-element.ts +++ b/src/core/lis-alert-element.ts @@ -6,7 +6,6 @@ import {unsafeHTML} from 'lit/directives/unsafe-html.js'; import {LisSlotController} from '../controllers'; import {AlertModifierModel} from '../models'; - /** * @htmlElement `` * @@ -64,7 +63,6 @@ import {AlertModifierModel} from '../models'; */ @customElement('lis-alert-element') export class LisAlertElement extends LitElement { - /** @ignore */ // used by Lit to style the Shadow DOM // not necessary but exclusion breaks TypeDoc @@ -104,14 +102,14 @@ export class LisAlertElement extends LitElement { * @attribute */ @property({type: String}) - type: AlertModifierModel|'' = ''; + type: AlertModifierModel | '' = ''; constructor() { super(); this.slotController = new LisSlotController(this, this.defaultSlotRef); } - public updateAlert(content: string, type: AlertModifierModel|'') { + public updateAlert(content: string, type: AlertModifierModel | '') { this.content = content; this.type = type; } @@ -162,10 +160,8 @@ export class LisAlertElement extends LitElement { `; } - } - declare global { interface HTMLElementTagNameMap { 'lis-alert-element': LisAlertElement; diff --git a/src/core/lis-form-wrapper-element.ts b/src/core/lis-form-wrapper-element.ts index dccc91f..8a76ba5 100644 --- a/src/core/lis-form-wrapper-element.ts +++ b/src/core/lis-form-wrapper-element.ts @@ -1,14 +1,13 @@ import {LitElement, css, html} from 'lit'; import {customElement, queryAssignedElements} from 'lit/decorators.js'; - /** * @htmlElement `` * * A Web Component that provides boilerplate functionality for the form it wraps, * i.e. the form in its slot. * - * @example + * @example * As the name suggests, the component should enclose a form. For example: * ```html * @@ -47,7 +46,6 @@ import {customElement, queryAssignedElements} from 'lit/decorators.js'; */ @customElement('lis-form-wrapper-element') export class LisFormWrapperElement extends LitElement { - /** @ignore */ // used by Lit to style the Shadow DOM // not necessary but exclusion breaks TypeDoc @@ -78,11 +76,12 @@ export class LisFormWrapperElement extends LitElement { // only submit the first form const formElement = this._forms[0]; // get the form's submit element - const submitElement: HTMLElement | null = formElement.querySelector('[type="submit"]'); + const submitElement: HTMLElement | null = + formElement.querySelector('[type="submit"]'); // use the element to submit the form if it exists if (submitElement !== null) { formElement.requestSubmit(submitElement); - // otherwise, use the form as the submit element + // otherwise, use the form as the submit element } else { formElement.requestSubmit(); } @@ -100,7 +99,7 @@ export class LisFormWrapperElement extends LitElement { const options = { detail: {data}, bubbles: true, - composed: true + composed: true, }; this.dispatchEvent(new CustomEvent('submit', options)); } @@ -110,10 +109,8 @@ export class LisFormWrapperElement extends LitElement { override render() { return html``; } - } - declare global { interface HTMLElementTagNameMap { 'lis-form-wrapper-element': LisFormWrapperElement; diff --git a/src/core/lis-loading-element.ts b/src/core/lis-loading-element.ts index fff84b8..32f67a0 100644 --- a/src/core/lis-loading-element.ts +++ b/src/core/lis-loading-element.ts @@ -4,7 +4,6 @@ import {Ref, createRef, ref} from 'lit/directives/ref.js'; import {LisAlertElement} from './lis-alert-element.js'; - /** * @htmlElement `` * @@ -66,7 +65,6 @@ import {LisAlertElement} from './lis-alert-element.js'; */ @customElement('lis-loading-element') export class LisLoadingElement extends LitElement { - /** @ignore */ // used by Lit to style the Shadow DOM // not necessary but exclusion breaks TypeDoc @@ -88,7 +86,7 @@ export class LisLoadingElement extends LitElement { // The current state of the element, i.e. what UI elements should be visible. @state() - state: 'loading'|'loaded'|'message' = 'loaded'; + state: 'loading' | 'loaded' | 'message' = 'loaded'; // bind to the alert element in the template private _alertRef: Ref = createRef(); @@ -117,17 +115,20 @@ export class LisLoadingElement extends LitElement { // used by Lit to draw the template override render() { return html` -
+
- + `; } - } - declare global { interface HTMLElementTagNameMap { 'lis-loading-element': LisLoadingElement; diff --git a/src/core/lis-modal-element.ts b/src/core/lis-modal-element.ts index 507d55c..2496ef5 100644 --- a/src/core/lis-modal-element.ts +++ b/src/core/lis-modal-element.ts @@ -5,7 +5,6 @@ import {unsafeHTML} from 'lit/directives/unsafe-html.js'; import {LisSlotController} from '../controllers'; - /** * @htmlElement `` * @@ -42,14 +41,14 @@ import {LisSlotController} from '../controllers'; * for more information. * * ```html - * * * * - * + * *