From 5e363db135793a33bccb478cf7cd6ea2d0b81649 Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Thu, 9 May 2024 03:41:28 +0200 Subject: [PATCH 1/6] chore: upgrade packages --- .../flatpak/modules/yarn-deps-sources.json | 360 ++++++----- package.json | 18 +- src/polyfills/fetch.ts | 2 +- yarn.lock | 588 +++++++++--------- 4 files changed, 470 insertions(+), 498 deletions(-) diff --git a/build-aux/flatpak/modules/yarn-deps-sources.json b/build-aux/flatpak/modules/yarn-deps-sources.json index 87f6eeb0..839c87d9 100644 --- a/build-aux/flatpak/modules/yarn-deps-sources.json +++ b/build-aux/flatpak/modules/yarn-deps-sources.json @@ -1,210 +1,203 @@ [ { "type": "archive", - "url": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz", + "url": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.1.tgz", "strip-components": 1, - "sha512": "d9ecee85d899c3cbee1dfd472927f84c893cd276936cff40b7bb0ea9999d570bef332ba80e2641e3d61928bb0b39f288afbefe238d1d5a91d5798e491e920422", - "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-arm@0.20.0", + "sha512": "b511e7c56267bcd9c3a4d567b320e1af50c841951f0979474820e885b5c5aa683d5b890a47b83c2e60379337306eec5b44c29e8adf2569d9c269b5397f6b6b68", + "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-arm@0.21.1", "only-arches": [ "arm" ] }, { "type": "archive", - "url": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz", + "url": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.1.tgz", "strip-components": 1, - "sha512": "b93b726003f9bdeaa2db3f5be86af4354a0dbfd17facecc8f2d383e6329c0af4549fb4fad016fee3634304258d84c8e4433234aaac179101a8d52638d46e769f", - "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-arm64@0.20.0", + "sha512": "1bae5dd3c6281f4d132fb5e0e0b68bde02d5db56e9a00850fabdf5354bb4d77601eca2b47f25c8b74e556ec26da6a87feb05b1a0b2593af407627a1d46b9db51", + "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-arm64@0.21.1", "only-arches": [ "aarch64" ] }, { "type": "archive", - "url": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz", + "url": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.1.tgz", "strip-components": 1, - "sha512": "73cf30c2d7ecf2d4df7cf6a827e4909f7cbe94ab604f3ca3903f0d82cc82b429ada080bc4432fb3eb254d396a7fdef55b8091ee9e26a1a4a0c8492b5458eb3e3", - "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-ia32@0.20.0", + "sha512": "b6dff9e0ba8d340a82cfef90871a2a07df97a9db1a64eb450ffb2b1211d8c0177765439ea6647511ea2df1b4be43b06212fcbdbef29bb691dffabeaaf2117950", + "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-ia32@0.21.1", "only-arches": [ "i386" ] }, { "type": "archive", - "url": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz", + "url": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.1.tgz", "strip-components": 1, - "sha512": "1fd12ee8c1ac7befb6d385d9718b2c7b5c851e645711681a764d8de7c3bfc5de743fd12f14c2c94d02e0fa5078135705db184b654e65b925ad1936f497d51e4a", - "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-x64@0.20.0", + "sha512": "75ae3fd66049c3080991b8f87cc1fb48e5eadb36a9813a342ca5d7d55519d03c6bf9ef0dd166d2f349d2679fb37f796fa5ff2ac6b91976a90ea857e6e7b817c0", + "dest": "flatpak-node/cache/esbuild/.package/@esbuild/linux-x64@0.21.1", "only-arches": [ "x86_64" ] }, { "type": "file", - "url": "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf", - "sha512": "d588ecd92bccf137e5111fce0f770e8e15963996f9f00dadef0a44d92f577c161388897e5c58501b66e3cb83eed48f8402508d533443603745c056142af5dc20", - "dest-filename": "@aashutoshrathi-word-wrap-1.2.6.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.1.tgz#044268dc9ca4dc67f8d4aad8f51cfb894bfd7114", + "sha512": "3bbca9a708a9917be710f8f39125c9464da0e1b4bcb14c7da7da171eaf4c53f53b971533655b271593034e679e5fd6df431ac572f39a725fc43603a1d163fda4", + "dest-filename": "@esbuild-aix-ppc64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz#509621cca4e67caf0d18561a0c56f8b70237472f", - "sha512": "7c614311cb4d87409c4b0b2244fc626aa5f43f9aeaf80a84d124616066783d7e3a2e0d45351ea80b126085ff18818d16404810ba1de512b5051382b12de4669b", - "dest-filename": "@esbuild-aix-ppc64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.1.tgz#8247c5aef933a212bca261290f6e43a9dca07cc5", + "sha512": "861de32968a47674ed1c28250c07953b73b287c31a1fcc5951a58c8820af27dfdcdcdb4fa99abe08008e9464f185d772a57865fbc078e5279c79805f07f7bc3b", + "dest-filename": "@esbuild-android-arm-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.0.tgz#1397a2c54c476c4799f9b9073550ede496c94ba5", - "sha512": "ddb3007c89ef0722c77c9c183c9465a5379a400ef99fc0bf40aa446a24b81eb156162265348d2fceaff30a306b84061c3f254f1bb128f5d32b7105eeaa6364e6", - "dest-filename": "@esbuild-android-arm-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.1.tgz#76aacd934449e541f05b66d5ec8cbff96ec2ae81", + "sha512": "8d785c72ae9eb3ea27c3bc7c331a059e6f36d26cfbb066bd275e242c00dc966884507e1fca3f858d1eadd0cf77460b6523f6b01d686d1745a07e1aa07fd80364", + "dest-filename": "@esbuild-android-arm64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz#109a6fdc4a2783fc26193d2687827045d8fef5ab", - "sha512": "695a6733895444d929d03dea3e8033486f765574ad626a153ce817bde014a10056452b90cede75caf4a3bb6f49e801cf9b06350631f8f6e476f68c9f1f5adaf1", - "dest-filename": "@esbuild-android-arm64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.1.tgz#80cbfa35412299edefbc4ab78064f0b66e448008", + "sha512": "34f39bb65061e23407134d6025eb9ca8485da03ff8c9ada8c12212f256584b9f1a474c7ba19a3d941da5545c604c03526b93060817a842dafec80f6828218fbc", + "dest-filename": "@esbuild-android-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.0.tgz#2b615abefb50dc0a70ac313971102f4ce2fdb3ca", - "sha512": "b8aef0027951be39023f387c8c9f907a3172acff0e6cab91e5c048b1067ea9b32e9f047cb1b77c92b98c6f14cb4ab0e188f65a258290014e58de23037193e1c9", - "dest-filename": "@esbuild-android-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.1.tgz#154167fb9e54017dac4b343f8e5e25c9d9324036", + "sha512": "04b4fb4c3ceab1595046625f3bf162af32a5ce60e9056c260949728207f3530835700c55c5e0383ba6f55e43089e5c4849d7cf00eba757dcd78ef879c7df477a", + "dest-filename": "@esbuild-darwin-arm64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz#5c122ed799eb0c35b9d571097f77254964c276a2", - "sha512": "02311c8af18094fb3750070979d31af6a620f5e49f53a1671872634fcb37e3a1d22a4adc5a561ecc613c55a3b6c4a7efbe5664800872be5d3a3893b188c80e61", - "dest-filename": "@esbuild-darwin-arm64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.1.tgz#db971502c9fa204906b89e489810c902bf6d9afb", + "sha512": "0f7877c01426792fefa7ddcee01f925ac5c1f07bd10f033285336105df3231b879c0dff6a4f5915b9a3f84cdc42a093d6dd29df79f7894c1a84c24e282540645", + "dest-filename": "@esbuild-darwin-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz#9561d277002ba8caf1524f209de2b22e93d170c1", - "sha512": "6ec8133e8c980e73eff044741ea9c98205cae91c85cb83c7e2bb6c21dd15ec47daf74bb6f8489fc72b44f69667b03804c60900472db8594406bfd8ab55b4ef23", - "dest-filename": "@esbuild-darwin-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.1.tgz#f0f3bc20c23af999bd696099a324dceb66d77761", + "sha512": "fee55daaaa4d2972314fa4f24bfa122b85c4e3158eaa9e9f878079b60030a3393259dca5717f96e18176bfa48ab0be30090e61d5b9da48d8d63d71bfda1a7c01", + "dest-filename": "@esbuild-freebsd-arm64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz#84178986a3138e8500d17cc380044868176dd821", - "sha512": "910ee361d94a4b7df99a919b316e6d11edc8ad0148a24f6bf3810cdcf5c1f2a04524f49ce9da567ebb6c0bfcb5a72af3f36c5f5089f966b9d21d042c77a8de6d", - "dest-filename": "@esbuild-freebsd-arm64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.1.tgz#d36af9085edb34244b41e5a57640e6b4452cbec2", + "sha512": "a5a02428dd67d63262b70f9d028476ed3742cf1465d45384213c77876d3547a3685d4a23a4cce030b7645d5802bda0920aac1891e18ba1ef5454d443292bd083", + "dest-filename": "@esbuild-freebsd-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz#3f9ce53344af2f08d178551cd475629147324a83", - "sha512": "b86f01d1649ea4c46c04d5570107077fdf8aa3f4ebf97aa62bb3ed7a5f475669f292ea57752e09ee8bd2414222d2d4062277616ea58b6882ffa8efdc5a15cac9", - "dest-filename": "@esbuild-freebsd-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.1.tgz#d6f7c5873479dd97148bef3e3a7f09d486642883", + "sha512": "b511e7c56267bcd9c3a4d567b320e1af50c841951f0979474820e885b5c5aa683d5b890a47b83c2e60379337306eec5b44c29e8adf2569d9c269b5397f6b6b68", + "dest-filename": "@esbuild-linux-arm-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz#6b586a488e02e9b073a75a957f2952b3b6e87b4c", - "sha512": "d9ecee85d899c3cbee1dfd472927f84c893cd276936cff40b7bb0ea9999d570bef332ba80e2641e3d61928bb0b39f288afbefe238d1d5a91d5798e491e920422", - "dest-filename": "@esbuild-linux-arm-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.1.tgz#9d2ad42eea33b2a9571f13e7ecc39ee9d3ff0c6d", + "sha512": "1bae5dd3c6281f4d132fb5e0e0b68bde02d5db56e9a00850fabdf5354bb4d77601eca2b47f25c8b74e556ec26da6a87feb05b1a0b2593af407627a1d46b9db51", + "dest-filename": "@esbuild-linux-arm64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz#24efa685515689df4ecbc13031fa0a9dda910a11", - "sha512": "b93b726003f9bdeaa2db3f5be86af4354a0dbfd17facecc8f2d383e6329c0af4549fb4fad016fee3634304258d84c8e4433234aaac179101a8d52638d46e769f", - "dest-filename": "@esbuild-linux-arm64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.1.tgz#8f2aef34a31c8d16dbce0b8679021f4881f38efe", + "sha512": "b6dff9e0ba8d340a82cfef90871a2a07df97a9db1a64eb450ffb2b1211d8c0177765439ea6647511ea2df1b4be43b06212fcbdbef29bb691dffabeaaf2117950", + "dest-filename": "@esbuild-linux-ia32-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz#84ce7864f762708dcebc1b123898a397dea13624", - "sha512": "73cf30c2d7ecf2d4df7cf6a827e4909f7cbe94ab604f3ca3903f0d82cc82b429ada080bc4432fb3eb254d396a7fdef55b8091ee9e26a1a4a0c8492b5458eb3e3", - "dest-filename": "@esbuild-linux-ia32-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.1.tgz#44461ea2388efbafa6cf12b2bc1407a5388da066", + "sha512": "32135a94aeabd27643d2af15cd404fc21787cd73ebf70ae89ea999adec0b7cfeee8bd16fd6d74f9a0e9eec0f259a0d338900b38920c7c61ddcc91b7860c8469d", + "dest-filename": "@esbuild-linux-loong64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz#1922f571f4cae1958e3ad29439c563f7d4fd9037", - "sha512": "951dabaffd76f3feacbe782756d6ba24de20c525e57bfc991192f7a385d9e9eb0eaa1c91e30b0ac9fbbaa9700bd384b84b90a019f1be1986678c57786221b703", - "dest-filename": "@esbuild-linux-loong64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.1.tgz#754d533a4fef4b0790d82bfe1e82d6876f18370e", + "sha512": "60229563b65e9f9af0655fa765ccce84598769e231478667de3726347e772db805e88291c26acccb0a83ae0e12892340a4479f9006cf488ccddfd142f15b313e", + "dest-filename": "@esbuild-linux-mips64el-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz#7ca1bd9df3f874d18dbf46af009aebdb881188fe", - "sha512": "f52c9c73ed6e52c0e72427a50dfe9936a8194282b5989bc5b6a7f6314cf8ba34f11a1bc25b0fb872161f0cb3dea4c12f54bf4f0f09fa1eb5da779c8eacdcc8b1", - "dest-filename": "@esbuild-linux-mips64el-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.1.tgz#2aafcfe2826c7d5d2e3c41eb8934e6368a7cada5", + "sha512": "6f0edb710fb6ef420ecc357899cb0a0270ed005a8a3b48d5bf722045277c88cd1a7372fc6a6bc2aee8d156dd5a8c14c97290da161217fa508d44ab5ea0348b8a", + "dest-filename": "@esbuild-linux-ppc64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz#8f95baf05f9486343bceeb683703875d698708a4", - "sha512": "0a859269a01739977e0a36d44dd5c8244fedececfee20f740375410872db7ee739c94414fe71432cecd0b0dd1c77181777dee5616fe9b08201763cd02304c11b", - "dest-filename": "@esbuild-linux-ppc64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.1.tgz#481ceaf5939d14fb25da62a385b5e6c2096a3370", + "sha512": "01198344d91c3863a6d40a94052c115437c3783f6119845f92e74fd90768a27073d6e7165677c13dfcbb1f824f235e1e62d66bb9149ccc9c72bbb49160354e72", + "dest-filename": "@esbuild-linux-riscv64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz#ca63b921d5fe315e28610deb0c195e79b1a262ca", - "sha512": "9a56f5860fde611254a6ff21ff1fb84a182834b2fcc2067ae1252bdba2b08254d89f00168e4851d86a6829fb436cf3829e8740f6de18fdbebc1f827d5e698fcc", - "dest-filename": "@esbuild-linux-riscv64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.1.tgz#e25b97005e4c82540d1bc7af88e333fb55142570", + "sha512": "a3bdd371434cba84d9961c0576c82bf127d0b66315e7cb1b82aea042af46d715226271cc4e625bc2aeb9473331f3d9748b26baf654786f1060b568a23b20d064", + "dest-filename": "@esbuild-linux-s390x-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz#cb3d069f47dc202f785c997175f2307531371ef8", - "sha512": "7e07fdb9b6f9df14a7381ab2bd6118eae9013519759955f5b2b3cdbb4e81ea636c34adb425f1fac55ea3102ceb43af7f54c8932ef1cc89c411fcf8133a0a8951", - "dest-filename": "@esbuild-linux-s390x-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.1.tgz#a05a61d0a0cbb03baa6db12cd8164c1e5265ffb2", + "sha512": "75ae3fd66049c3080991b8f87cc1fb48e5eadb36a9813a342ca5d7d55519d03c6bf9ef0dd166d2f349d2679fb37f796fa5ff2ac6b91976a90ea857e6e7b817c0", + "dest-filename": "@esbuild-linux-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz#ac617e0dc14e9758d3d7efd70288c14122557dc7", - "sha512": "1fd12ee8c1ac7befb6d385d9718b2c7b5c851e645711681a764d8de7c3bfc5de743fd12f14c2c94d02e0fa5078135705db184b654e65b925ad1936f497d51e4a", - "dest-filename": "@esbuild-linux-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.1.tgz#e298f854e8999563f2e4668bd542678c46be4b53", + "sha512": "08f5acd074c57b9c284c937978a3ef82b694a111eb0adce560802ff70042f850326a005269ff94759ae3c18c931a7c0f1a44e157838223b5e26d93a73ef38d57", + "dest-filename": "@esbuild-netbsd-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz#6cc778567f1513da6e08060e0aeb41f82eb0f53c", - "sha512": "9424faef9ad3375bfc168f911ab1392a34a77d8d31f4e83844deedee556b377bcc4a3cb7e3ffb79dad2aed121f583023d1ed2b0a1d0e2fe3fcf25bb746ddb531", - "dest-filename": "@esbuild-netbsd-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.1.tgz#640d34de1e3c6bc3ff64e0379aae00ede3608f14", + "sha512": "c718539b942dccd2dcdb847484491c1fecc2c7fa38f40b1d159d02cb9cd277fe6d3a3e17da0dffd80241eb6e4da1a754b9ce00f01dd37a72c9a1875660e6027b", + "dest-filename": "@esbuild-openbsd-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz#76848bcf76b4372574fb4d06cd0ed1fb29ec0fbe", - "sha512": "1caa14197cff4ce557290fbaecd871c87bfe6834997f8e10a562dadc8d652ef0301aaf31d64d13f9ed871d246fc5685f26b17169aaab7b5f98cb343df4a8b1a0", - "dest-filename": "@esbuild-openbsd-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.1.tgz#f53cb1cdcbf05b3320e147ddb85ec2b1cf2b6cfc", + "sha512": "09689b5ecce95b2b35a5899bafd522280917eb1f92c70f075adc357511122b574b5b97c527aacc0d5c34a3c31b69dbacbd5431d5af31b8ec671d74fde351e9d4", + "dest-filename": "@esbuild-sunos-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz#ea4cd0639bf294ad51bc08ffbb2dac297e9b4706", - "sha512": "183c00aa01d09b5995a0fa691aca2ae162704f7be19f3ff637ad82ce1bc0a450f5789c93ae8a1bdf414fa4e65a6cdf858028e11be020719c8e3c8911f1d7c3ee", - "dest-filename": "@esbuild-sunos-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.1.tgz#df4f44f9b4fec9598c0ec2c34fec9c568c8ab85d", + "sha512": "8dbe41e24fb1932b466c6512e13f99f3d71027d0c9e25a33191495fa185f9823e97c9dfcf343b7d50d6cacf0a29a6f95e9409b9e282a0f5d048033608ef8dead", + "dest-filename": "@esbuild-win32-arm64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz#a5c171e4a7f7e4e8be0e9947a65812c1535a7cf0", - "sha512": "d2f62c3fc682e13bcc94e418a33a24b226b18e5bd4710ada73e9ae0ea8f5171cba8e1f65f42649ce3ef39a1f0919f895e3d7182d3a2b14bc60ef9f77a4695dc1", - "dest-filename": "@esbuild-win32-arm64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.1.tgz#a57edbd9905db9f957327ae0facfbf406a80a4e4", + "sha512": "3e0c85be32615ea1e7d6ec4f872375c19e9d22898a8e22d4421d4b8c5be3895d499a7919fe830fadf78401983947fd5fb73e0b65666bd3691e7cd210e5229111", + "dest-filename": "@esbuild-win32-ia32-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz#f8ac5650c412d33ea62d7551e0caf82da52b7f85", - "sha512": "a7df2ee2b2207e1e20769574d08aa49c10f9a42f382c2b9bfb86b730efb38eabd4e4c55739cde1a91d94813da32369e1de1f2cf4443198eb15237b72cefd6216", - "dest-filename": "@esbuild-win32-ia32-0.20.0.tgz", - "dest": "flatpak-node/yarn-mirror" - }, - { - "type": "file", - "url": "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz#2efddf82828aac85e64cef62482af61c29561bee", - "sha512": "3602677acbb546d5a286d4ed5c614c53961213a272c873ccc42c0164aedaebff1ddf51ae4a8f65d12b3bc35270e509ca51ac06e9411e86cf3cde47177f97d8c2", - "dest-filename": "@esbuild-win32-x64-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.1.tgz#eb86553d90e86a8c174b96650fdb4c60f2de16a7", + "sha512": "5bd36db516504797a1022a871839ef7c36869903a6e858b8bd295c7bc9a333be71fff5cab95001ca8865117e8dd7bc999d55f1405ba1e1f0d1ba73fc71ae9b7c", + "dest-filename": "@esbuild-win32-x64-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -230,9 +223,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b", - "sha512": "80cb157a5f43edfd872e40666bd55bb736517a146881545f6ebfbe7f4ea72f6be708608d973383fbf314a2ffc5e29f26cb2007b291215686e08e95fae2ae66e8", - "dest-filename": "@eslint-js-8.56.0.tgz", + "url": "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f", + "sha512": "62cfb78364da5bb8000ce2733edf37489b420e13239dd703305550fd38fd880d417c9cc5283f660145d3dce7a7a6e3c76c8e8ffe6c840b1449ae87d4b03c7fe6", + "dest-filename": "@eslint-js-8.57.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -251,9 +244,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917", - "sha512": "e84c224a3c1660fee94dc906e88e5ec8500d8cf8663e3517f4944b5127cd3c2ec55fbccaf60c9901f50468408be802d3a465f90239c1ab70bd5e65563e2b4da7", - "dest-filename": "@humanwhocodes-object-schema-2.0.2.tgz", + "url": "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3", + "sha512": "f77cd874c112fdcd43ebdc9988a0c18f4576e2fa8dcc1fe4a05dba28f69a8007dddcfff8814961dc3cace688002be1318bd432ce50fcc7fd3c66def020a70370", + "dest-filename": "@humanwhocodes-object-schema-2.0.3.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -307,72 +300,72 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8", - "sha512": "3af9486102bdb4d9de0e54b454de782cb779ba23c204ea7b812e59d1fd668e825806bb52b73826241c4e356dd4e8e66a76d37364f9a7f414bfed623b04515c15", - "dest-filename": "@types-lodash-4.14.202.tgz", + "url": "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.1.tgz#0fabfcf2f2127ef73b119d98452bd317c4a17eb8", + "sha512": "5fedaa6b3192de3c4b008cf92435c3ce09401772a98a376117195ffd5d7e844b0e51cf879d68bcd4bfeebff12f1ae57dd1663eee63c614250319f402dc68fde5", + "dest-filename": "@types-lodash-4.17.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339", - "sha512": "767d65f0b68c79afc88c3a0735df49e76b816c89c1efde820df7d2e95748c6fa9808f486d15d03cc7a7be86a5a5a796183cf2e6323db5c20c8a306bceb26dde4", - "dest-filename": "@types-semver-7.5.6.tgz", + "url": "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e", + "sha512": "23c114872ae07cbadc4e4cd5dd34ac1b2975b52b8fac40f3af4c9de66f74520371424c835d42e4ddbe8c950a930a966936d59ed4ad21cdc9676644dc2c17b651", + "dest-filename": "@types-semver-7.5.8.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz#bb0676af940bc23bf299ca58dbdc6589c2548c2e", - "sha512": "ae8412714185aee5a877d084ca85792a5098aee6c2fdfbc6f3fd735ee4f45937315fcec69cc3269e4b0cc1283df65a35c622ab073c3689cb093cc030d4eb4ac6", - "dest-filename": "@typescript-eslint-eslint-plugin-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz#c78e309fe967cb4de05b85cdc876fb95f8e01b6f", + "sha512": "8054d3f9ecc99a4c2eb543e6074b243a3dc6649b651069e5b2c7a6b38023915c1e50f1a3ee3470c2a8341e183bfbe90f189a8ab53631f91d3916dc30dfbd9a22", + "dest-filename": "@typescript-eslint-eslint-plugin-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.19.1.tgz#68a87bb21afaf0b1689e9cdce0e6e75bc91ada78", - "sha512": "5847d7db6ce2021ea9444f639db9242c6a7fe11853a5f7ebd992b96c9d7c33c9887c0f00fa4f7b53d67269708425196630787b47d3096565e9febef70f320d55", - "dest-filename": "@typescript-eslint-parser-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.8.0.tgz#1e1db30c8ab832caffee5f37e677dbcb9357ddc8", + "sha512": "2a0290972d69bf497896d71fb4fe7db906428b81d462cc022db4ea559109bbbb8b5fc0932f2b30a8c2ea2cdfb6405cf88c2a6da96555e1207bbddc5c1f6fb491", + "dest-filename": "@typescript-eslint-parser-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz#2f527ee30703a6169a52b31d42a1103d80acd51b", - "sha512": "e0275762329febfe9a28d312972fc13f888248ea6f326aad0f346da85cb201a7b7cf9924a848ca9dd479bc31cbf2b4ae3082163fcbb8330e15c4bcb1656e83e7", - "dest-filename": "@typescript-eslint-scope-manager-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz#bb19096d11ec6b87fb6640d921df19b813e02047", + "sha512": "be21266752e6c2c19c9ebf39808abe142608ee73bdd0355b137eff965e75863bfd686f9864c6f85831367f25a9511e0efd4ae1191a585cafd76a37064e4d81f2", + "dest-filename": "@typescript-eslint-scope-manager-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz#6a130e3afe605a4898e043fa9f72e96309b54935", - "sha512": "d2f77295ddde71fc49b9d7438c0094be501e60dac73ffa43790936a56051d8449e133421839d83179dc06c8f50081918136de582484b0993641e7da11175d822", - "dest-filename": "@typescript-eslint-type-utils-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz#9de166f182a6e4d1c5da76e94880e91831e3e26f", + "sha512": "1fbd11dc079f403429cfd986bf5dd4862d76d4534c87e584691a9c5d35f4f58103932db5926e1d575657248a7c4235dce1969591755da21bd60f36e76c70d2f8", + "dest-filename": "@typescript-eslint-type-utils-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.19.1.tgz#2d4c9d492a63ede15e7ba7d129bdf7714b77f771", - "sha512": "ebe6e4e8512d061bdf62fa47b038002f7ba8e017ef9d39e881ee4baeb0a3d9e24df20dc825d2d30f807f8cadd0eafa38425fc7a22a7d23c681e9f17ee917c3aa", - "dest-filename": "@typescript-eslint-types-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.8.0.tgz#1fd2577b3ad883b769546e2d1ef379f929a7091d", + "sha512": "c1fd29789f991a5707fb6652db76896cebfeced8de78ff2e43d1a0c0c24654bc7f363f4226dd7b1968165a84a6a1154a017d97fbb7f3127023c5dbcada0a822f", + "dest-filename": "@typescript-eslint-types-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz#796d88d88882f12e85bb33d6d82d39e1aea54ed1", - "sha512": "685740c6e873045456872f87db49d8bb5f7e2a6fa015fc0d3b84c4ab2b3390c7200436108e63c9eb57ab1f1b93d844895e1961aceec8e44148959faa191f2854", - "dest-filename": "@typescript-eslint-typescript-estree-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz#b028a9226860b66e623c1ee55cc2464b95d2987c", + "sha512": "e697d408ec0ae728cf68940dcb8e29ae30b0b6bf7cd5d3bc428f49f4fc185d9d0ca2c8006df10c074d3c749e6c368dfefc137acad04fb92bd7520f5202a07476", + "dest-filename": "@typescript-eslint-typescript-estree-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.19.1.tgz#df93497f9cfddde2bcc2a591da80536e68acd151", - "sha512": "26f8df119b8fe56a0cab087d48f00f0d21d283d1411c71a18cfba0491c6ee6331f8ef069ab9fec1930fef4cf5a439b21ea227c018fca93fa1461510c00fc22ef", - "dest-filename": "@typescript-eslint-utils-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.8.0.tgz#57a79f9c0c0740ead2f622e444cfaeeb9fd047cd", + "sha512": "2f4c85a8e09f955a97c626725eb0ebf349676a141f48e7dcf442c0019ef9b2a89caa9da2dfa9046591ae532987345a183aac514f4e6ea7beb46f8886b25d369d", + "dest-filename": "@typescript-eslint-utils-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz#2164073ed4fc34a5ff3b5e25bb5a442100454c4c", - "sha512": "82476d20efb148efd2988d16ebc0c1838bb5284966214a37bd7ce01f218fb3a731801d2c6b74e5a6d440004d21518d6133a15c0ca12feda2308931a6efa7177d", - "dest-filename": "@typescript-eslint-visitor-keys-6.19.1.tgz", + "url": "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz#7285aab991da8bee411a42edbd5db760d22fdd91", + "sha512": "ab8fe089b4cd050340d251b26100a65914b90f5e67f2b5e1e108cadca57e3013e54d81e97c1513dc3dcf68f47f1de36223d5ba47b16f96470684dc80a0ff9c68", + "dest-filename": "@typescript-eslint-visitor-keys-7.8.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -496,9 +489,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/core-js/-/core-js-3.35.1.tgz#9c28f8b7ccee482796f8590cc8d15739eaaf980c", - "sha512": "22076c6f137232c92b4c5c5af65587c8cc00254e605ce3cffb5c8ef8ae7d779d152d50080c06ecee022fef4e4acc02cca1d7cadd9ad26533cda42d0f420219bb", - "dest-filename": "core-js-3.35.1.tgz", + "url": "https://registry.yarnpkg.com/core-js/-/core-js-3.37.0.tgz#d8dde58e91d156b2547c19d8a4efd5c7f6c426bb", + "sha512": "7eee6f1debd0f191b8a20f8b5ee83cba552d5718ce70462f89f26becbe417eaf463b3b55aac29df7fe7d8549366526c2ad2dc1a94af7129698188633abb83752", + "dest-filename": "core-js-3.37.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -538,9 +531,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.0.tgz#a7170b63447286cd2ff1f01579f09970e6965da4", - "sha512": "ea2c04dd8d9155808c1358cba41aaaecb4162b7316eaf8d5d9b672ea0b7f5abaa463e584ef84a9c9cd13840398a4cb484ef9e35f4f42ac2eb29bb03f9bd99e6c", - "dest-filename": "esbuild-0.20.0.tgz", + "url": "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.1.tgz#3d6f199f6ec849158278c6632f438463bab88c38", + "sha512": "18fab1f855fb99daae942790e13b06650ddd8c1264c7993bcc11adaadf72715956360f25949e113bd9f6bdc8aef01376cc012cea53db3e5d1ab19b0087ba16ce", + "dest-filename": "esbuild-0.21.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -566,9 +559,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/eslint/-/eslint-8.56.0.tgz#4957ce8da409dc0809f99ab07a1b94832ab74b15", - "sha512": "1a8d7dc4ce93f69b823969ed89ed7f3fdf7b697c45b0e8b7ec9207456239d781dce999da1c6298f71161ad4eb9453e82701133668186d5ee8dabe0d3d3866d65", - "dest-filename": "eslint-8.56.0.tgz", + "url": "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668", + "sha512": "759ebe99ec6769321b481656828bb9d54e8e9b322160cd9570d76d893b48eea3cd666df9024a6bd1feafb70df0d4a9a7e4f628fad6557e1d775ab8694baa0ba9", + "dest-filename": "eslint-8.57.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -643,9 +636,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/fastq/-/fastq-1.17.0.tgz#ca5e1a90b5e68f97fc8b61330d5819b82f5fab03", - "sha512": "cc6ca0b628d4313ee39e4de1dba9149acdc19120e9e087c82a39a7a88dadbf1ea7b817e217552a3b16e72dfcddbfe6a9072fb9de86889ac2ad330ff161b5bed7", - "dest-filename": "fastq-1.17.0.tgz", + "url": "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47", + "sha512": "b11543de55952175a0e81cbaf1937bbe1a3d6b5a5070dfd604568002c0c31739498efa06c743fccfb575b7bda0ac525f261bb760f641baedb97fb29ac368cdd7", + "dest-filename": "fastq-1.17.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -678,9 +671,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf", - "sha512": "dfacb10e7e47ece1594256b4fe314999b20a4dd6404079e009e746c62326a4d7c464cd2c744793f967332d0ae32ba0fba366a2c8b6039e4c3447724ad10bf545", - "dest-filename": "flatted-3.2.9.tgz", + "url": "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a", + "sha512": "5fc72a30b2e27bb2ac3540d277378df0560af6b12de03b7aeceb06fc33469d84d20c11b8b850091419d47a257ecc2540bf0172e7a22333db07e758d568484dc7", + "dest-filename": "flatted-3.3.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -741,16 +734,16 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.2.tgz#9115a76eee3ce8fbf95b6e3c6bf82d936785b44a", - "sha512": "1161937e74ea00ed8bfe3e47660a0cff7cfcd8bee779cb09d293bd4e9d17d708a5dcf0cbae4ca94c146054ed84c5e84412f53271e8d90f716e45a5e965973793", - "dest-filename": "headers-polyfill-4.0.2.tgz", + "url": "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07", + "sha512": "21270b6de3e992f3bce3ab08c0eb4e4c38eeb5131675774999774cbe4ea00811f114ef1df9028e41e772652c454d31584529a58124c3b57aaaab8a5c7a70572d", + "dest-filename": "headers-polyfill-4.0.3.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78", - "sha512": "83b766a6c872fa00fb9a1f3c382f4dc121932a87379322c0650454d66b79dc0c3fbe7bdf5e76c2f85ffb17b42861529b57e28dbc9c7cc00adec0acb5bd732d96", - "dest-filename": "ignore-5.3.0.tgz", + "url": "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef", + "sha512": "e45cadcff22b68c8eaa707dddf891edbc3d354c8d98c91b630f9f9b7b384e1e50250d7fc0406bb6f95944bdfd0bebea6c0e412ecc93abddb0c9e8e617be4fc5f", + "dest-filename": "ignore-5.3.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -893,13 +886,6 @@ "dest-filename": "lodash.merge-4.6.2.tgz", "dest": "flatpak-node/yarn-mirror" }, - { - "type": "file", - "url": "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94", - "sha512": "268e9d274e029928eece7c09492de951e5a677f1f47df4e59175e0c198be7aad540a6a90c0287e78bb183980b063df758b615a878875044302c78a938466ec88", - "dest-filename": "lru-cache-6.0.0.tgz", - "dest": "flatpak-node/yarn-mirror" - }, { "type": "file", "url": "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae", @@ -923,9 +909,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825", - "sha512": "44789a73d9af691c34c770184600c2d42c403fb1d370daeb102780f186097969e9a3ed90e427a0b598daa2d5935b10c6dd4786035728134e621f598f8d3ff69a", - "dest-filename": "minimatch-9.0.3.tgz", + "url": "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51", + "sha512": "2aa5a1f957217f170c3510098e3dad9ec48974d6c7b1582790185336b5bb023568e8ebcbb71c3ccdf4fda0bc35252a21945cc9f230a84e06a85ef27e907b7a7f", + "dest-filename": "minimatch-9.0.4.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -958,9 +944,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64", - "sha512": "2630a8ca9a7e8ca9f5b6d105131c617ad08a789b7dce102002f7b91571e2c53bc50d6ff968492d5fd6ee7c128b45131d53b6cdb692df706bbde01ddc7442608e", - "dest-filename": "optionator-0.9.3.tgz", + "url": "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734", + "sha512": "e88a50ee6294c5171934b20e6d1d21cfb971b1aa5248860d649c173c6785d264d5a862852178f50d070ca13db64b744e70bc98febcf43d669667d6b25a669df6", + "dest-filename": "optionator-0.9.4.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1007,9 +993,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.1.tgz#d54934d6798eb9e5ef14e7af7962c945906918e5", - "sha512": "24bca1ef14f5922cda12f71a5ce43039cdbf621c3a2993af3dfd52f38d355322e4f3a094efd2cddef97bced5c69bfa59f988e8c80278af1987c1b9015c95fecb", - "dest-filename": "path-to-regexp-6.2.1.tgz", + "url": "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.2.tgz#324377a83e5049cbecadc5554d6a63a9a4866b36", + "sha512": "1905f749232892781bdfafb085da515c4fb77fd57c533c80a2b958bce1b1f3bb9f1877a13539f9942c6b2ad2f2678625ff010a9cd9ebf7c6733b0c03655e6883", + "dest-filename": "path-to-regexp-6.2.2.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1077,9 +1063,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e", - "sha512": "d5b09211257a3effa2db51efa71a770f1fa9483f2520fb7cb958d1af1014b7f9dbb3061cfad2ba6366ed8942e3778f9f9ead793d7fa7a900c2ece7eded693070", - "dest-filename": "semver-7.5.4.tgz", + "url": "https://registry.yarnpkg.com/semver/-/semver-7.6.1.tgz#60bfe090bf907a25aa8119a72b9f90ef7ca281b2", + "sha512": "7ffbdb06cbbe7ce898b7e966c19574ad5c0949c978e87a699ce03566f22e05628e4e5965a722776df55ac7bebf3ab8421f7f1dcb1a03200f0aeee07deb721880", + "dest-filename": "semver-7.6.1.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1140,9 +1126,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331", - "sha512": "c0d31eaad333e4db70a53fd46466396a54fe56829d4ac38e3ff92a1c57145b53ff551847db0278f3e0cdd96c1496235b43defa113c032f421f776555be0a27be", - "dest-filename": "ts-api-utils-1.0.3.tgz", + "url": "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1", + "sha512": "510308a3ba5bf1646898a475ffe30554b4eba08bc356d317dcae8e522afcca72f2cc1f097ab8a89edd9b4c0b6634f6b57a402037b60f0f27fa57eca0add53e79", + "dest-filename": "ts-api-utils-1.3.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1161,9 +1147,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37", - "sha512": "a5759cadac4cd2ec404beb4dd001bf045d93caa9873b4d78674ef452c27ea45bd8b914aaf0a1fc0e65a99db5ded2910f0c75d957715c01b2648a3279a0d1275b", - "dest-filename": "typescript-5.3.3.tgz", + "url": "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611", + "sha512": "bdc23852946083cd68211505c11d164881cab75d6727b48056560d22ef90a6a7b25cffa0a50272fd9e3e174686c5213832ac23c97bd6fd3ce090b031d80187c1", + "dest-filename": "typescript-5.4.5.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1175,9 +1161,9 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz#32e26522e05128203a7de59519be3c648004343b", - "sha512": "de9446bb1445e60a6e65cd16f84a704119820fb811a9c0ce32debcf0a99d943020032681d5794dd33ab69e37c3366e385d5748a2e13ba59e86cdb7721f8eee21", - "dest-filename": "web-streams-polyfill-3.3.2.tgz", + "url": "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0.tgz#74cedf168339ee6e709532f76c49313a8c7acdac", + "sha512": "d332571d1018123336b547d9d8389238701ad9ac35b62b279e1537b9f0f9ed1f2279f2fe0dc749c91051c89a46f8d52298381b4c8fe51fe8001353c0bd5dc283", + "dest-filename": "web-streams-polyfill-4.0.0.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1189,16 +1175,16 @@ }, { "type": "file", - "url": "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", - "sha512": "9784a9fc346c7a8afdc0be84bd5dbe4ee427eb774c90f8d9feca7d5e48214c46d5f4a94f4b5c54b19deeeff2103b8c31b5c141e1b82940f45c477402bdeccf71", - "dest-filename": "wrappy-1.0.2.tgz", + "url": "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34", + "sha512": "04ddb607979a30c23d50cb63ac677983978260fa423c3532d052576d8b1a4f9cd8c6314e7244b9dd2403137a56915a16a475d56f706b61c10de13c1ae7907970", + "dest-filename": "word-wrap-1.2.5.tgz", "dest": "flatpak-node/yarn-mirror" }, { "type": "file", - "url": "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72", - "sha512": "df074689d672ab93c1d3ce172c44b94e9392440df08d7025216321ba6da445cbffe354a7d9e990d1dc9c416e2e6572de8f02af83a12cbdb76554bf8560472dec", - "dest-filename": "yallist-4.0.0.tgz", + "url": "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", + "sha512": "9784a9fc346c7a8afdc0be84bd5dbe4ee427eb774c90f8d9feca7d5e48214c46d5f4a94f4b5c54b19deeeff2103b8c31b5c141e1b82940f45c477402bdeccf71", + "dest-filename": "wrappy-1.0.2.tgz", "dest": "flatpak-node/yarn-mirror" }, { @@ -1230,8 +1216,8 @@ "type": "shell", "commands": [ "mkdir -p \"bin/@esbuild\"", - "cp \".package/@esbuild/linux-arm64@0.20.0/bin/esbuild\" \"bin/@esbuild/linux-arm64@0.20.0\"", - "ln -sf \"linux-arm64@0.20.0\" \"bin/esbuild-current\"" + "cp \".package/@esbuild/linux-arm64@0.21.1/bin/esbuild\" \"bin/@esbuild/linux-arm64@0.21.1\"", + "ln -sf \"linux-arm64@0.21.1\" \"bin/esbuild-current\"" ], "dest": "flatpak-node/cache/esbuild", "only-arches": [ @@ -1242,8 +1228,8 @@ "type": "shell", "commands": [ "mkdir -p \"bin/@esbuild\"", - "cp \".package/@esbuild/linux-arm@0.20.0/bin/esbuild\" \"bin/@esbuild/linux-arm@0.20.0\"", - "ln -sf \"linux-arm@0.20.0\" \"bin/esbuild-current\"" + "cp \".package/@esbuild/linux-arm@0.21.1/bin/esbuild\" \"bin/@esbuild/linux-arm@0.21.1\"", + "ln -sf \"linux-arm@0.21.1\" \"bin/esbuild-current\"" ], "dest": "flatpak-node/cache/esbuild", "only-arches": [ @@ -1254,8 +1240,8 @@ "type": "shell", "commands": [ "mkdir -p \"bin/@esbuild\"", - "cp \".package/@esbuild/linux-ia32@0.20.0/bin/esbuild\" \"bin/@esbuild/linux-ia32@0.20.0\"", - "ln -sf \"linux-ia32@0.20.0\" \"bin/esbuild-current\"" + "cp \".package/@esbuild/linux-ia32@0.21.1/bin/esbuild\" \"bin/@esbuild/linux-ia32@0.21.1\"", + "ln -sf \"linux-ia32@0.21.1\" \"bin/esbuild-current\"" ], "dest": "flatpak-node/cache/esbuild", "only-arches": [ @@ -1266,8 +1252,8 @@ "type": "shell", "commands": [ "mkdir -p \"bin/@esbuild\"", - "cp \".package/@esbuild/linux-x64@0.20.0/bin/esbuild\" \"bin/@esbuild/linux-x64@0.20.0\"", - "ln -sf \"linux-x64@0.20.0\" \"bin/esbuild-current\"" + "cp \".package/@esbuild/linux-x64@0.21.1/bin/esbuild\" \"bin/@esbuild/linux-x64@0.21.1\"", + "ln -sf \"linux-x64@0.21.1\" \"bin/esbuild-current\"" ], "dest": "flatpak-node/cache/esbuild", "only-arches": [ diff --git a/package.json b/package.json index 521cf328..e019cb51 100644 --- a/package.json +++ b/package.json @@ -11,20 +11,20 @@ "@lemaik/qrcode-svg": "^1.2.0", "libmuse": "^0.0.97", "lodash-es": "^4.17.21", - "path-to-regexp": "^6.2.1", - "typescript": "^5.3.3", - "web-streams-polyfill": "^3.2.1" + "path-to-regexp": "^6.2.2", + "typescript": "^5.4.5", + "web-streams-polyfill": "^4.0.0" }, "devDependencies": { "@types/core-js": "^2.5.8", "@types/lodash-es": "^4.17.12", - "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", - "core-js": "^3.35.1", - "esbuild": "^0.20.0", - "eslint": "^8.56.0", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", + "core-js": "^3.37.0", + "esbuild": "^0.21.1", + "eslint": "^8.57.0", "event-target-polyfill": "^0.0.4", - "headers-polyfill": "^4.0.2", + "headers-polyfill": "^4.0.3", "minimist": "^1.2.8" }, "scripts": { diff --git a/src/polyfills/fetch.ts b/src/polyfills/fetch.ts index 19aaef96..554a3366 100644 --- a/src/polyfills/fetch.ts +++ b/src/polyfills/fetch.ts @@ -3,7 +3,7 @@ import GLib from "gi://GLib"; import Gio from "gi://Gio"; // streams polyfill -import "web-streams-polyfill"; +import "web-streams-polyfill/polyfill/es5"; import "./abortcontroller.js"; import "./customevent.js"; diff --git a/yarn.lock b/yarn.lock index 7f0aef7b..a2f8562b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,125 +2,120 @@ # yarn lockfile v1 -"@aashutoshrathi/word-wrap@^1.2.3": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" - integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== - -"@esbuild/aix-ppc64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz#509621cca4e67caf0d18561a0c56f8b70237472f" - integrity sha512-fGFDEctNh0CcSwsiRPxiaqX0P5rq+AqE0SRhYGZ4PX46Lg1FNR6oCxJghf8YgY0WQEgQuh3lErUFE4KxLeRmmw== - -"@esbuild/android-arm64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz#109a6fdc4a2783fc26193d2687827045d8fef5ab" - integrity sha512-aVpnM4lURNkp0D3qPoAzSG92VXStYmoVPOgXveAUoQBWRSuQzt51yvSju29J6AHPmwY1BjH49uR29oyfH1ra8Q== - -"@esbuild/android-arm@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.0.tgz#1397a2c54c476c4799f9b9073550ede496c94ba5" - integrity sha512-3bMAfInvByLHfJwYPJRlpTeaQA75n8C/QKpEaiS4HrFWFiJlNI0vzq/zCjBrhAYcPyVPG7Eo9dMrcQXuqmNk5g== - -"@esbuild/android-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.0.tgz#2b615abefb50dc0a70ac313971102f4ce2fdb3ca" - integrity sha512-uK7wAnlRvjkCPzh8jJ+QejFyrP8ObKuR5cBIsQZ+qbMunwR8sbd8krmMbxTLSrDhiPZaJYKQAU5Y3iMDcZPhyQ== - -"@esbuild/darwin-arm64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz#5c122ed799eb0c35b9d571097f77254964c276a2" - integrity sha512-AjEcivGAlPs3UAcJedMa9qYg9eSfU6FnGHJjT8s346HSKkrcWlYezGE8VaO2xKfvvlZkgAhyvl06OJOxiMgOYQ== - -"@esbuild/darwin-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz#9561d277002ba8caf1524f209de2b22e93d170c1" - integrity sha512-bsgTPoyYDnPv8ER0HqnJggXK6RyFy4PH4rtsId0V7Efa90u2+EifxytE9pZnsDgExgkARy24WUQGv9irVbTvIw== - -"@esbuild/freebsd-arm64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz#84178986a3138e8500d17cc380044868176dd821" - integrity sha512-kQ7jYdlKS335mpGbMW5tEe3IrQFIok9r84EM3PXB8qBFJPSc6dpWfrtsC/y1pyrz82xfUIn5ZrnSHQQsd6jebQ== - -"@esbuild/freebsd-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz#3f9ce53344af2f08d178551cd475629147324a83" - integrity sha512-uG8B0WSepMRsBNVXAQcHf9+Ko/Tr+XqmK7Ptel9HVmnykupXdS4J7ovSQUIi0tQGIndhbqWLaIL/qO/cWhXKyQ== - -"@esbuild/linux-arm64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz#24efa685515689df4ecbc13031fa0a9dda910a11" - integrity sha512-uTtyYAP5veqi2z9b6Gr0NUoNv9F/rOzI8tOD5jKcCvRUn7T60Bb+42NDBCWNhMjkQzI0qqwXkQGo1SY41G52nw== - -"@esbuild/linux-arm@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz#6b586a488e02e9b073a75a957f2952b3b6e87b4c" - integrity sha512-2ezuhdiZw8vuHf1HKSf4TIk80naTbP9At7sOqZmdVwvvMyuoDiZB49YZKLsLOfKIr77+I40dWpHVeY5JHpIEIg== - -"@esbuild/linux-ia32@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz#84ce7864f762708dcebc1b123898a397dea13624" - integrity sha512-c88wwtfs8tTffPaoJ+SQn3y+lKtgTzyjkD8NgsyCtCmtoIC8RDL7PrJU05an/e9VuAke6eJqGkoMhJK1RY6z4w== - -"@esbuild/linux-loong64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz#1922f571f4cae1958e3ad29439c563f7d4fd9037" - integrity sha512-lR2rr/128/6svngnVta6JN4gxSXle/yZEZL3o4XZ6esOqhyR4wsKyfu6qXAL04S4S5CgGfG+GYZnjFd4YiG3Aw== - -"@esbuild/linux-mips64el@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz#7ca1bd9df3f874d18dbf46af009aebdb881188fe" - integrity sha512-9Sycc+1uUsDnJCelDf6ZNqgZQoK1mJvFtqf2MUz4ujTxGhvCWw+4chYfDLPepMEvVL9PDwn6HrXad5yOrNzIsQ== - -"@esbuild/linux-ppc64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz#8f95baf05f9486343bceeb683703875d698708a4" - integrity sha512-CoWSaaAXOZd+CjbUTdXIJE/t7Oz+4g90A3VBCHLbfuc5yUQU/nFDLOzQsN0cdxgXd97lYW/psIIBdjzQIwTBGw== - -"@esbuild/linux-riscv64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz#ca63b921d5fe315e28610deb0c195e79b1a262ca" - integrity sha512-mlb1hg/eYRJUpv8h/x+4ShgoNLL8wgZ64SUr26KwglTYnwAWjkhR2GpoKftDbPOCnodA9t4Y/b68H4J9XmmPzA== - -"@esbuild/linux-s390x@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz#cb3d069f47dc202f785c997175f2307531371ef8" - integrity sha512-fgf9ubb53xSnOBqyvWEY6ukBNRl1mVX1srPNu06B6mNsNK20JfH6xV6jECzrQ69/VMiTLvHMicQR/PgTOgqJUQ== - -"@esbuild/linux-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz#ac617e0dc14e9758d3d7efd70288c14122557dc7" - integrity sha512-H9Eu6MGse++204XZcYsse1yFHmRXEWgadk2N58O/xd50P9EvFMLJTQLg+lB4E1cF2xhLZU5luSWtGTb0l9UeSg== - -"@esbuild/netbsd-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz#6cc778567f1513da6e08060e0aeb41f82eb0f53c" - integrity sha512-lCT675rTN1v8Fo+RGrE5KjSnfY0x9Og4RN7t7lVrN3vMSjy34/+3na0q7RIfWDAj0e0rCh0OL+P88lu3Rt21MQ== - -"@esbuild/openbsd-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz#76848bcf76b4372574fb4d06cd0ed1fb29ec0fbe" - integrity sha512-HKoUGXz/TOVXKQ+67NhxyHv+aDSZf44QpWLa3I1lLvAwGq8x1k0T+e2HHSRvxWhfJrFxaaqre1+YyzQ99KixoA== - -"@esbuild/sunos-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz#ea4cd0639bf294ad51bc08ffbb2dac297e9b4706" - integrity sha512-GDwAqgHQm1mVoPppGsoq4WJwT3vhnz/2N62CzhvApFD1eJyTroob30FPpOZabN+FgCjhG+AgcZyOPIkR8dfD7g== - -"@esbuild/win32-arm64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz#a5c171e4a7f7e4e8be0e9947a65812c1535a7cf0" - integrity sha512-0vYsP8aC4TvMlOQYozoksiaxjlvUcQrac+muDqj1Fxy6jh9l9CZJzj7zmh8JGfiV49cYLTorFLxg7593pGldwQ== - -"@esbuild/win32-ia32@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz#f8ac5650c412d33ea62d7551e0caf82da52b7f85" - integrity sha512-p98u4rIgfh4gdpV00IqknBD5pC84LCub+4a3MO+zjqvU5MVXOc3hqR2UgT2jI2nh3h8s9EQxmOsVI3tyzv1iFg== - -"@esbuild/win32-x64@0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz#2efddf82828aac85e64cef62482af61c29561bee" - integrity sha512-NgJnesu1RtWihtTtXGFMU5YSE6JyyHPMxCwBZK7a6/8d31GuSo9l0Ss7w1Jw5QnKUawG6UEehs883kcXf5fYwg== +"@esbuild/aix-ppc64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.1.tgz#044268dc9ca4dc67f8d4aad8f51cfb894bfd7114" + integrity sha512-O7yppwipkXvnEPjzkSXJRk2g4bS8sUx9p9oXHq9MU/U7lxUzZVsnFZMDTmeeX9bfQxrFcvOacl/ENgOh0WP9pA== + +"@esbuild/android-arm64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.1.tgz#76aacd934449e541f05b66d5ec8cbff96ec2ae81" + integrity sha512-jXhccq6es+onw7x8MxoFnm820mz7sGa9J14kLADclmiEUH4fyj+FjR6t0M93RgtlI/awHWhtF0Wgfhqgf9gDZA== + +"@esbuild/android-arm@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.1.tgz#8247c5aef933a212bca261290f6e43a9dca07cc5" + integrity sha512-hh3jKWikdnTtHCglDAeVO3Oyh8MaH8xZUaWMiCCvJ9/c3NtPqZq+CACOlGTxhddypXhl+8B45SeceYBfB/e8Ow== + +"@esbuild/android-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.1.tgz#80cbfa35412299edefbc4ab78064f0b66e448008" + integrity sha512-NPObtlBh4jQHE01gJeucqEhdoD/4ya2owSIS8lZYS58aR0x7oZo9lB2lVFxgTANSa5MGCBeoQtr+yA9oKCGPvA== + +"@esbuild/darwin-arm64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.1.tgz#154167fb9e54017dac4b343f8e5e25c9d9324036" + integrity sha512-BLT7TDzqsVlQRmJfO/FirzKlzmDpBWwmCUlyggfzUwg1cAxVxeA4O6b1XkMInlxISdfPAOunV9zXjvh5x99Heg== + +"@esbuild/darwin-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.1.tgz#db971502c9fa204906b89e489810c902bf6d9afb" + integrity sha512-D3h3wBQmeS/vp93O4B+SWsXB8HvRDwMyhTNhBd8yMbh5wN/2pPWRW5o/hM3EKgk9bdKd9594lMGoTCTiglQGRQ== + +"@esbuild/freebsd-arm64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.1.tgz#f0f3bc20c23af999bd696099a324dceb66d77761" + integrity sha512-/uVdqqpNKXIxT6TyS/oSK4XE4xWOqp6fh4B5tgAwozkyWdylcX+W4YF2v6SKsL4wCQ5h1bnaSNjWPXG/2hp8AQ== + +"@esbuild/freebsd-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.1.tgz#d36af9085edb34244b41e5a57640e6b4452cbec2" + integrity sha512-paAkKN1n1jJitw+dAoR27TdCzxRl1FOEITx3h201R6NoXUojpMzgMLdkXVgCvaCSCqwYkeGLoe9UVNRDKSvQgw== + +"@esbuild/linux-arm64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.1.tgz#9d2ad42eea33b2a9571f13e7ecc39ee9d3ff0c6d" + integrity sha512-G65d08YoH00TL7Xg4LaL3gLV21bpoAhQ+r31NUu013YB7KK0fyXIt05VbsJtpqh/6wWxoLJZOvQHYnodRrnbUQ== + +"@esbuild/linux-arm@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.1.tgz#d6f7c5873479dd97148bef3e3a7f09d486642883" + integrity sha512-tRHnxWJnvNnDpNVnsyDhr1DIQZUfCXlHSCDohbXFqmg9W4kKR7g8LmA3kzcwbuxbRMKeit8ladnCabU5f2traA== + +"@esbuild/linux-ia32@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.1.tgz#8f2aef34a31c8d16dbce0b8679021f4881f38efe" + integrity sha512-tt/54LqNNAqCz++QhxoqB9+XqdsaZOtFD/srEhHYwBd3ZUOepmR1Eeot8bS+Q7BiEvy9vvKbtpHf+r6q8hF5UA== + +"@esbuild/linux-loong64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.1.tgz#44461ea2388efbafa6cf12b2bc1407a5388da066" + integrity sha512-MhNalK6r0nZD0q8VzUBPwheHzXPr9wronqmZrewLfP7ui9Fv1tdPmg6e7A8lmg0ziQCziSDHxh3cyRt4YMhGnQ== + +"@esbuild/linux-mips64el@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.1.tgz#754d533a4fef4b0790d82bfe1e82d6876f18370e" + integrity sha512-YCKVY7Zen5rwZV+nZczOhFmHaeIxR4Zn3jcmNH53LbgF6IKRwmrMywqDrg4SiSNApEefkAbPSIzN39FC8VsxPg== + +"@esbuild/linux-ppc64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.1.tgz#2aafcfe2826c7d5d2e3c41eb8934e6368a7cada5" + integrity sha512-bw7bcQ+270IOzDV4mcsKAnDtAFqKO0jVv3IgRSd8iM0ac3L8amvCrujRVt1ajBTJcpDaFhIX+lCNRKteoDSLig== + +"@esbuild/linux-riscv64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.1.tgz#481ceaf5939d14fb25da62a385b5e6c2096a3370" + integrity sha512-ARmDRNkcOGOm1AqUBSwRVDfDeD9hGYRfkudP2QdoonBz1ucWVnfBPfy7H4JPI14eYtZruRSczJxyu7SRYDVOcg== + +"@esbuild/linux-s390x@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.1.tgz#e25b97005e4c82540d1bc7af88e333fb55142570" + integrity sha512-o73TcUNMuoTZlhwFdsgr8SfQtmMV58sbgq6gQq9G1xUiYnHMTmJbwq65RzMx89l0iya69lR4bxBgtWiiOyDQZA== + +"@esbuild/linux-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.1.tgz#a05a61d0a0cbb03baa6db12cd8164c1e5265ffb2" + integrity sha512-da4/1mBJwwgJkbj4fMH7SOXq2zapgTo0LKXX1VUZ0Dxr+e8N0WbS80nSZ5+zf3lvpf8qxrkZdqkOqFfm57gXwA== + +"@esbuild/netbsd-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.1.tgz#e298f854e8999563f2e4668bd542678c46be4b53" + integrity sha512-CPWs0HTFe5woTJN5eKPvgraUoRHrCtzlYIAv9wBC+FAyagBSaf+UdZrjwYyTGnwPGkThV4OCI7XibZOnPvONVw== + +"@esbuild/openbsd-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.1.tgz#640d34de1e3c6bc3ff64e0379aae00ede3608f14" + integrity sha512-xxhTm5QtzNLc24R0hEkcH+zCx/o49AsdFZ0Cy5zSd/5tOj4X2g3/2AJB625NoadUuc4A8B3TenLJoYdWYOYCew== + +"@esbuild/sunos-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.1.tgz#f53cb1cdcbf05b3320e147ddb85ec2b1cf2b6cfc" + integrity sha512-CWibXszpWys1pYmbr9UiKAkX6x+Sxw8HWtw1dRESK1dLW5fFJ6rMDVw0o8MbadusvVQx1a8xuOxnHXT941Hp1A== + +"@esbuild/win32-arm64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.1.tgz#df4f44f9b4fec9598c0ec2c34fec9c568c8ab85d" + integrity sha512-jb5B4k+xkytGbGUS4T+Z89cQJ9DJ4lozGRSV+hhfmCPpfJ3880O31Q1srPCimm+V6UCbnigqD10EgDNgjvjerQ== + +"@esbuild/win32-ia32@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.1.tgz#a57edbd9905db9f957327ae0facfbf406a80a4e4" + integrity sha512-PgyFvjJhXqHn1uxPhyN1wZ6dIomKjiLUQh1LjFvjiV1JmnkZ/oMPrfeEAZg5R/1ftz4LZWZr02kefNIQ5SKREQ== + +"@esbuild/win32-x64@0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.1.tgz#eb86553d90e86a8c174b96650fdb4c60f2de16a7" + integrity sha512-W9NttRZQR5ehAiqHGDnvfDaGmQOm6Fi4vSlce8mjM75x//XKuVAByohlEX6N17yZnVXxQFuh4fDRunP8ca6bfA== "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" @@ -129,7 +124,7 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.6.1": version "4.10.0" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== @@ -149,12 +144,12 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.56.0": - version "8.56.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" - integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== +"@eslint/js@8.57.0": + version "8.57.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" + integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@humanwhocodes/config-array@^0.11.13": +"@humanwhocodes/config-array@^0.11.14": version "0.11.14" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== @@ -169,9 +164,9 @@ integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" - integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== "@lemaik/qrcode-svg@^1.2.0": version "1.2.0" @@ -204,7 +199,7 @@ resolved "https://registry.yarnpkg.com/@types/core-js/-/core-js-2.5.8.tgz#d5c6ec44f2f3328653dce385ae586bd8261f8e85" integrity sha512-VgnAj6tIAhJhZdJ8/IpxdatM8G4OD3VWGlp6xIxUGENZlpbob9Ty4VVdC1FIEp0aK6DBscDDjyzy5FB60TuNqg== -"@types/json-schema@^7.0.12": +"@types/json-schema@^7.0.15": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -217,100 +212,100 @@ "@types/lodash" "*" "@types/lodash@*": - version "4.14.202" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8" - integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ== - -"@types/semver@^7.5.0": - version "7.5.6" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339" - integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== - -"@typescript-eslint/eslint-plugin@^6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz#bb0676af940bc23bf299ca58dbdc6589c2548c2e" - integrity sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg== - dependencies: - "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.19.1" - "@typescript-eslint/type-utils" "6.19.1" - "@typescript-eslint/utils" "6.19.1" - "@typescript-eslint/visitor-keys" "6.19.1" + version "4.17.1" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.1.tgz#0fabfcf2f2127ef73b119d98452bd317c4a17eb8" + integrity sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q== + +"@types/semver@^7.5.8": + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== + +"@typescript-eslint/eslint-plugin@^7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz#c78e309fe967cb4de05b85cdc876fb95f8e01b6f" + integrity sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg== + dependencies: + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "7.8.0" + "@typescript-eslint/type-utils" "7.8.0" + "@typescript-eslint/utils" "7.8.0" + "@typescript-eslint/visitor-keys" "7.8.0" debug "^4.3.4" graphemer "^1.4.0" - ignore "^5.2.4" + ignore "^5.3.1" natural-compare "^1.4.0" - semver "^7.5.4" - ts-api-utils "^1.0.1" - -"@typescript-eslint/parser@^6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.19.1.tgz#68a87bb21afaf0b1689e9cdce0e6e75bc91ada78" - integrity sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ== - dependencies: - "@typescript-eslint/scope-manager" "6.19.1" - "@typescript-eslint/types" "6.19.1" - "@typescript-eslint/typescript-estree" "6.19.1" - "@typescript-eslint/visitor-keys" "6.19.1" + semver "^7.6.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/parser@^7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.8.0.tgz#1e1db30c8ab832caffee5f37e677dbcb9357ddc8" + integrity sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ== + dependencies: + "@typescript-eslint/scope-manager" "7.8.0" + "@typescript-eslint/types" "7.8.0" + "@typescript-eslint/typescript-estree" "7.8.0" + "@typescript-eslint/visitor-keys" "7.8.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz#2f527ee30703a6169a52b31d42a1103d80acd51b" - integrity sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w== +"@typescript-eslint/scope-manager@7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz#bb19096d11ec6b87fb6640d921df19b813e02047" + integrity sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g== dependencies: - "@typescript-eslint/types" "6.19.1" - "@typescript-eslint/visitor-keys" "6.19.1" + "@typescript-eslint/types" "7.8.0" + "@typescript-eslint/visitor-keys" "7.8.0" -"@typescript-eslint/type-utils@6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz#6a130e3afe605a4898e043fa9f72e96309b54935" - integrity sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg== +"@typescript-eslint/type-utils@7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz#9de166f182a6e4d1c5da76e94880e91831e3e26f" + integrity sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A== dependencies: - "@typescript-eslint/typescript-estree" "6.19.1" - "@typescript-eslint/utils" "6.19.1" + "@typescript-eslint/typescript-estree" "7.8.0" + "@typescript-eslint/utils" "7.8.0" debug "^4.3.4" - ts-api-utils "^1.0.1" + ts-api-utils "^1.3.0" -"@typescript-eslint/types@6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.19.1.tgz#2d4c9d492a63ede15e7ba7d129bdf7714b77f771" - integrity sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg== +"@typescript-eslint/types@7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.8.0.tgz#1fd2577b3ad883b769546e2d1ef379f929a7091d" + integrity sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw== -"@typescript-eslint/typescript-estree@6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz#796d88d88882f12e85bb33d6d82d39e1aea54ed1" - integrity sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA== +"@typescript-eslint/typescript-estree@7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz#b028a9226860b66e623c1ee55cc2464b95d2987c" + integrity sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg== dependencies: - "@typescript-eslint/types" "6.19.1" - "@typescript-eslint/visitor-keys" "6.19.1" + "@typescript-eslint/types" "7.8.0" + "@typescript-eslint/visitor-keys" "7.8.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" - minimatch "9.0.3" - semver "^7.5.4" - ts-api-utils "^1.0.1" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" -"@typescript-eslint/utils@6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.19.1.tgz#df93497f9cfddde2bcc2a591da80536e68acd151" - integrity sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w== +"@typescript-eslint/utils@7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.8.0.tgz#57a79f9c0c0740ead2f622e444cfaeeb9fd047cd" + integrity sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" - "@types/json-schema" "^7.0.12" - "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.19.1" - "@typescript-eslint/types" "6.19.1" - "@typescript-eslint/typescript-estree" "6.19.1" - semver "^7.5.4" - -"@typescript-eslint/visitor-keys@6.19.1": - version "6.19.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz#2164073ed4fc34a5ff3b5e25bb5a442100454c4c" - integrity sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ== - dependencies: - "@typescript-eslint/types" "6.19.1" - eslint-visitor-keys "^3.4.1" + "@types/json-schema" "^7.0.15" + "@types/semver" "^7.5.8" + "@typescript-eslint/scope-manager" "7.8.0" + "@typescript-eslint/types" "7.8.0" + "@typescript-eslint/typescript-estree" "7.8.0" + semver "^7.6.0" + +"@typescript-eslint/visitor-keys@7.8.0": + version "7.8.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz#7285aab991da8bee411a42edbd5db760d22fdd91" + integrity sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA== + dependencies: + "@typescript-eslint/types" "7.8.0" + eslint-visitor-keys "^3.4.3" "@ungap/structured-clone@^1.2.0": version "1.2.0" @@ -416,10 +411,10 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -core-js@^3.35.1: - version "3.35.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.35.1.tgz#9c28f8b7ccee482796f8590cc8d15739eaaf980c" - integrity sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw== +core-js@^3.37.0: + version "3.37.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.37.0.tgz#d8dde58e91d156b2547c19d8a4efd5c7f6c426bb" + integrity sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug== cross-spawn@^7.0.2: version "7.0.3" @@ -456,34 +451,34 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -esbuild@^0.20.0: - version "0.20.0" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.20.0.tgz#a7170b63447286cd2ff1f01579f09970e6965da4" - integrity sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA== +esbuild@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.1.tgz#3d6f199f6ec849158278c6632f438463bab88c38" + integrity sha512-GPqx+FX7mdqulCeQ4TsGZQ3djBJkx5k7zBGtqt9ycVlWNg8llJ4RO9n2vciu8BN2zAEs6lPbPl0asZsAh7oWzg== optionalDependencies: - "@esbuild/aix-ppc64" "0.20.0" - "@esbuild/android-arm" "0.20.0" - "@esbuild/android-arm64" "0.20.0" - "@esbuild/android-x64" "0.20.0" - "@esbuild/darwin-arm64" "0.20.0" - "@esbuild/darwin-x64" "0.20.0" - "@esbuild/freebsd-arm64" "0.20.0" - "@esbuild/freebsd-x64" "0.20.0" - "@esbuild/linux-arm" "0.20.0" - "@esbuild/linux-arm64" "0.20.0" - "@esbuild/linux-ia32" "0.20.0" - "@esbuild/linux-loong64" "0.20.0" - "@esbuild/linux-mips64el" "0.20.0" - "@esbuild/linux-ppc64" "0.20.0" - "@esbuild/linux-riscv64" "0.20.0" - "@esbuild/linux-s390x" "0.20.0" - "@esbuild/linux-x64" "0.20.0" - "@esbuild/netbsd-x64" "0.20.0" - "@esbuild/openbsd-x64" "0.20.0" - "@esbuild/sunos-x64" "0.20.0" - "@esbuild/win32-arm64" "0.20.0" - "@esbuild/win32-ia32" "0.20.0" - "@esbuild/win32-x64" "0.20.0" + "@esbuild/aix-ppc64" "0.21.1" + "@esbuild/android-arm" "0.21.1" + "@esbuild/android-arm64" "0.21.1" + "@esbuild/android-x64" "0.21.1" + "@esbuild/darwin-arm64" "0.21.1" + "@esbuild/darwin-x64" "0.21.1" + "@esbuild/freebsd-arm64" "0.21.1" + "@esbuild/freebsd-x64" "0.21.1" + "@esbuild/linux-arm" "0.21.1" + "@esbuild/linux-arm64" "0.21.1" + "@esbuild/linux-ia32" "0.21.1" + "@esbuild/linux-loong64" "0.21.1" + "@esbuild/linux-mips64el" "0.21.1" + "@esbuild/linux-ppc64" "0.21.1" + "@esbuild/linux-riscv64" "0.21.1" + "@esbuild/linux-s390x" "0.21.1" + "@esbuild/linux-x64" "0.21.1" + "@esbuild/netbsd-x64" "0.21.1" + "@esbuild/openbsd-x64" "0.21.1" + "@esbuild/sunos-x64" "0.21.1" + "@esbuild/win32-arm64" "0.21.1" + "@esbuild/win32-ia32" "0.21.1" + "@esbuild/win32-x64" "0.21.1" escape-string-regexp@^4.0.0: version "4.0.0" @@ -503,16 +498,16 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^8.56.0: - version "8.56.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.56.0.tgz#4957ce8da409dc0809f99ab07a1b94832ab74b15" - integrity sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ== +eslint@^8.57.0: + version "8.57.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" + integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" "@eslint/eslintrc" "^2.1.4" - "@eslint/js" "8.56.0" - "@humanwhocodes/config-array" "^0.11.13" + "@eslint/js" "8.57.0" + "@humanwhocodes/config-array" "^0.11.14" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" "@ungap/structured-clone" "^1.2.0" @@ -612,9 +607,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.0.tgz#ca5e1a90b5e68f97fc8b61330d5819b82f5fab03" - integrity sha512-zGygtijUMT7jnk3h26kUms3BkSDp4IfIKjmnqI2tvx6nuBfiF1UqOxbnLfzdv+apBy+53oaImsKtMw/xYbW+1w== + version "1.17.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" @@ -650,9 +645,9 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^3.2.9: - version "3.2.9" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" - integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== + version "3.3.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== fs.realpath@^1.0.0: version "1.0.0" @@ -714,15 +709,15 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -headers-polyfill@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.2.tgz#9115a76eee3ce8fbf95b6e3c6bf82d936785b44a" - integrity sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw== +headers-polyfill@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07" + integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ== -ignore@^5.2.0, ignore@^5.2.4: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" - integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== +ignore@^5.2.0, ignore@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" + integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== import-fresh@^3.2.1: version "3.3.0" @@ -844,13 +839,6 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" @@ -864,13 +852,6 @@ micromatch@^4.0.4: braces "^3.0.2" picomatch "^2.3.1" -minimatch@9.0.3: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -878,6 +859,13 @@ minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimatch@^9.0.4: + version "9.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" + integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" @@ -901,16 +889,16 @@ once@^1.3.0: wrappy "1" optionator@^0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" - integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: - "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" + word-wrap "^1.2.5" p-limit@^3.0.2: version "3.1.0" @@ -948,10 +936,10 @@ path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-to-regexp@^6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.1.tgz#d54934d6798eb9e5ef14e7af7962c945906918e5" - integrity sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw== +path-to-regexp@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.2.tgz#324377a83e5049cbecadc5554d6a63a9a4866b36" + integrity sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw== path-type@^4.0.0: version "4.0.0" @@ -1002,12 +990,10 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -semver@^7.5.4: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" +semver@^7.6.0: + version "7.6.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.1.tgz#60bfe090bf907a25aa8119a72b9f90ef7ca281b2" + integrity sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA== shebang-command@^2.0.0: version "2.0.0" @@ -1057,10 +1043,10 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -ts-api-utils@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" - integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== +ts-api-utils@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" + integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" @@ -1074,10 +1060,10 @@ type-fest@^0.20.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -typescript@^5.3.3: - version "5.3.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" - integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== +typescript@^5.4.5: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== uri-js@^4.2.2: version "4.4.1" @@ -1086,10 +1072,10 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -web-streams-polyfill@^3.2.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz#32e26522e05128203a7de59519be3c648004343b" - integrity sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ== +web-streams-polyfill@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0.tgz#74cedf168339ee6e709532f76c49313a8c7acdac" + integrity sha512-0zJXHRAYEjM2tUfZ2DiSOHAa2aw1tisnnhU3ufD57R8iefL+DcdJyRBRyJpG+NUimDgbTI/lH+gAE1PAvV3Cgw== which@^2.0.1: version "2.0.2" @@ -1098,16 +1084,16 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" From c56af53a334f2be1df24b3d315e7f4f0d5845830 Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Thu, 9 May 2024 03:52:56 +0200 Subject: [PATCH 2/6] chore: add eslint config --- .eslintrc.js | 23 ++++++++ .../flatpak/modules/yarn-deps-sources.json | 56 +++++++++++++++++++ package.json | 9 ++- yarn.lock | 48 ++++++++++++++++ 4 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..4a525673 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,23 @@ +module.exports = { + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:prettier/recommended", + ], + parser: "@typescript-eslint/parser", + parserOptions: { + sourceType: "module", + project: "tsconfig.json", + tsconfigRootDir: __dirname, + warnOnUnsupportedTypeScriptVersion: false, + }, + rules: { + "@typescript-eslint/restrict-template-expressions": ["error", { + allowNullish: true, + }], + "prettier/prettier": "error", + }, + plugins: ["@typescript-eslint", "prettier"], + root: true, +}; diff --git a/build-aux/flatpak/modules/yarn-deps-sources.json b/build-aux/flatpak/modules/yarn-deps-sources.json index 839c87d9..87757f5c 100644 --- a/build-aux/flatpak/modules/yarn-deps-sources.json +++ b/build-aux/flatpak/modules/yarn-deps-sources.json @@ -277,6 +277,13 @@ "dest-filename": "@nodelib-fs.walk-1.2.8.tgz", "dest": "flatpak-node/yarn-mirror" }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31", + "sha512": "72af28e1c587d226d787d5468b93f6d13bbd5c5ff47c55e5f445229ebf507d333b6bba74a13038889442416a695d1d4f83c75233450222d0a43f0b24f6a59660", + "dest-filename": "@pkgr-core-0.1.1.tgz", + "dest": "flatpak-node/yarn-mirror" + }, { "type": "file", "url": "https://registry.yarnpkg.com/@types/core-js/-/core-js-2.5.8.tgz#d5c6ec44f2f3328653dce385ae586bd8261f8e85", @@ -543,6 +550,20 @@ "dest-filename": "escape-string-regexp-4.0.0.tgz", "dest": "flatpak-node/yarn-mirror" }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f", + "sha512": "3525a5e411505843e2d63e138d5348b73615edd65767ec0fe88e9986b046a42850859454684962844f6e45191c6d19cd6fbe9430a0c5debf964e635c18f2acab", + "dest-filename": "eslint-config-prettier-9.1.0.tgz", + "dest": "flatpak-node/yarn-mirror" + }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1", + "sha512": "0bd182540b3812aed90bf5c54072132e21c9c509e076dada5da33e2e8505a05a7f947365d999fc7f75906def47bd304143d627285074ff602376ac28e43d4403", + "dest-filename": "eslint-plugin-prettier-5.1.3.tgz", + "dest": "flatpak-node/yarn-mirror" + }, { "type": "file", "url": "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f", @@ -613,6 +634,13 @@ "dest-filename": "fast-deep-equal-3.1.3.tgz", "dest": "flatpak-node/yarn-mirror" }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0", + "sha512": "5713cfe0da9b5238fa31a00e69f59e527d9c5d62dc0ad96392552d65fd089dde1743e40fb660346f5f33672d23210c7e131455091fd94290668a4e655ec84db3", + "dest-filename": "fast-diff-1.3.0.tgz", + "dest": "flatpak-node/yarn-mirror" + }, { "type": "file", "url": "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129", @@ -1019,6 +1047,20 @@ "dest-filename": "prelude-ls-1.2.1.tgz", "dest": "flatpak-node/yarn-mirror" }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b", + "sha512": "19b2b670ff67ada492505f4dd97c14c2a7f394016530d61897e4a113f57e1fc6bdb8d97fa14a81d70d842f9e098743a5c9149df117d6609ddca154b84d138fdb", + "dest-filename": "prettier-linter-helpers-1.0.0.tgz", + "dest": "flatpak-node/yarn-mirror" + }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368", + "sha512": "dff1966bd68e0b461e0fb2d47ef386d8d883ca139646fb7593eadc2a13ae627318db88a20a98609de51f243c855ddeab642027b8b06fe9478050bb6b853fc5e0", + "dest-filename": "prettier-3.2.5.tgz", + "dest": "flatpak-node/yarn-mirror" + }, { "type": "file", "url": "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5", @@ -1110,6 +1152,13 @@ "dest-filename": "supports-color-7.2.0.tgz", "dest": "flatpak-node/yarn-mirror" }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7", + "sha512": "1f038a00fed673969119874a1fe770d0f451a5b3bce35bf60c4341b639d1e47156a22341c8097bbebc77a741bfac2c985d0b2bc6ab57e3c4c8985b4f7081d2a5", + "dest-filename": "synckit-0.8.8.tgz", + "dest": "flatpak-node/yarn-mirror" + }, { "type": "file", "url": "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4", @@ -1131,6 +1180,13 @@ "dest-filename": "ts-api-utils-1.3.0.tgz", "dest": "flatpak-node/yarn-mirror" }, + { + "type": "file", + "url": "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae", + "sha512": "0046311fdde31853e7fdada2540c16f3b56e508911d45554281efb370305ee70530e40ebad3fc7a6dfc8ac2274417856dbb8d304371fe5963bc3a462a93330d9", + "dest-filename": "tslib-2.6.2.tgz", + "dest": "flatpak-node/yarn-mirror" + }, { "type": "file", "url": "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1", diff --git a/package.json b/package.json index e019cb51..a762b9f4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "description": "An elegant music streaming app", "main": "src/main.ts", - "type": "module", "repository": "https://github.com/vixalien/muzika", "author": "Angelo Verlain ", "license": "MIT", @@ -23,13 +22,17 @@ "core-js": "^3.37.0", "esbuild": "^0.21.1", "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", "event-target-polyfill": "^0.0.4", "headers-polyfill": "^4.0.3", - "minimist": "^1.2.8" + "minimist": "^1.2.8", + "prettier": "^3.2.5" }, "scripts": { "build": "node lib/build.js", "typecheck": "tsc --strict --noEmit", - "generate-sources": "flatpak-node-generator yarn yarn.lock -o build-aux/flatpak/modules/yarn-deps-sources.json" + "generate-sources": "flatpak-node-generator yarn yarn.lock -o build-aux/flatpak/modules/yarn-deps-sources.json", + "lint": "eslint src types" } } diff --git a/yarn.lock b/yarn.lock index a2f8562b..e3499747 100644 --- a/yarn.lock +++ b/yarn.lock @@ -194,6 +194,11 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@types/core-js@^2.5.8": version "2.5.8" resolved "https://registry.yarnpkg.com/@types/core-js/-/core-js-2.5.8.tgz#d5c6ec44f2f3328653dce385ae586bd8261f8e85" @@ -485,6 +490,19 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +eslint-config-prettier@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + +eslint-plugin-prettier@^5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1" + integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.8.6" + eslint-scope@^7.2.2: version "7.2.2" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" @@ -585,6 +603,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.2.9: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -956,6 +979,18 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + punycode@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" @@ -1031,6 +1066,14 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +synckit@^0.8.6: + version "0.8.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" + integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -1048,6 +1091,11 @@ ts-api-utils@^1.3.0: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== +tslib@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" From e432bf6c795ffe8993154499223387d9ec1f063d Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Thu, 9 May 2024 03:56:17 +0200 Subject: [PATCH 3/6] chore(lint): auto-fix --- package.json | 2 +- src/application.ts | 4 +- src/components/carousel/card.ts | 125 +++-- src/components/carousel/flatcard.ts | 236 ++++----- src/components/carousel/index.ts | 56 +- src/components/carousel/view/flatgrid.ts | 29 +- src/components/carousel/view/flatlist.ts | 29 +- src/components/carousel/view/grid.ts | 12 +- src/components/carousel/view/list.ts | 9 +- src/components/carousel/view/mood.ts | 30 +- src/components/carousel/view/util.ts | 20 +- src/components/dynamic-action.ts | 133 ++--- src/components/dynamic-image.ts | 217 ++++---- src/components/fixed-ratio-thumbnail.ts | 159 +++--- src/components/inline-tab-switcher.ts | 21 +- src/components/library/view.ts | 76 +-- src/components/loading.ts | 27 +- src/components/nav/page.ts | 77 +-- src/components/navbar/button.ts | 5 +- src/components/navbar/index.ts | 105 ++-- src/components/navbar/title.ts | 12 +- src/components/paginator.ts | 53 +- src/components/player/full.ts | 82 +-- src/components/player/lyrics.ts | 107 ++-- src/components/player/mini.ts | 24 +- src/components/player/now-playing/details.ts | 69 +-- src/components/player/now-playing/view.ts | 108 ++-- src/components/player/preview.ts | 44 +- src/components/player/progress.ts | 77 +-- src/components/player/queue.ts | 40 +- src/components/player/queueitem.ts | 20 +- src/components/player/related.ts | 91 ++-- src/components/player/scale.ts | 35 +- src/components/player/video/controls.ts | 49 +- src/components/player/video/full.ts | 80 ++- src/components/player/video/languages.ts | 500 +++++++++--------- src/components/player/video/mini.ts | 78 ++- src/components/player/video/util.ts | 26 +- src/components/player/video/view.ts | 42 +- .../player/video/volume-controls.ts | 15 +- src/components/player/view.ts | 9 +- .../playlist/add-to-playlist-item.ts | 19 +- src/components/playlist/bar.ts | 89 ++-- src/components/playlist/columnview.ts | 257 ++++----- src/components/playlist/edit.ts | 100 ++-- src/components/playlist/header.ts | 97 ++-- src/components/playlist/itemview.ts | 143 ++--- src/components/playlist/listitem.ts | 71 +-- src/components/playlist/listview.ts | 127 ++--- src/components/playlist/save-to-playlist.ts | 163 +++--- src/components/search/section.ts | 47 +- src/components/search/topresultcard.ts | 178 +++---- src/components/search/topresultsection.ts | 19 +- src/components/webimage.ts | 59 +-- src/mpris.ts | 106 ++-- src/muse.ts | 21 +- src/navigation.ts | 69 +-- src/pages/album.ts | 45 +- src/pages/artist-albums.ts | 23 +- src/pages/artist.ts | 12 +- src/pages/authentication-error.ts | 24 +- src/pages/channel-playlists.ts | 24 +- src/pages/channel.ts | 35 +- src/pages/charts.ts | 27 +- src/pages/error.ts | 23 +- src/pages/explore.ts | 27 +- src/pages/home.ts | 35 +- src/pages/library/albums.ts | 9 +- src/pages/library/artists.ts | 9 +- src/pages/library/base.ts | 32 +- src/pages/library/history.ts | 52 +- src/pages/library/index.ts | 9 +- src/pages/library/playlists.ts | 9 +- src/pages/library/songs.ts | 30 +- src/pages/library/subscriptions.ts | 9 +- src/pages/login.ts | 37 +- src/pages/mood-playlists.ts | 23 +- src/pages/moods.ts | 23 +- src/pages/new-releases.ts | 19 +- src/pages/playlist.ts | 143 ++--- src/pages/preferences.ts | 21 +- src/pages/search.ts | 120 +++-- src/player/helpers.ts | 15 +- src/player/index.ts | 276 +++++----- src/player/mpd.ts | 324 ++++++------ src/player/queue.ts | 321 +++++------ src/polyfills/customevent.ts | 8 +- src/polyfills/fetch.ts | 30 +- src/sidebar.ts | 18 +- src/util/action.ts | 2 +- src/util/giofilestore.ts | 8 +- src/util/label.ts | 24 +- src/util/menu/index.ts | 8 +- src/util/menu/like.ts | 13 +- src/util/objectcontainer.ts | 50 +- src/util/playablelist.ts | 234 ++++---- src/util/portals.ts | 20 +- src/util/secret-store.ts | 8 +- src/util/signal-listener.ts | 5 +- src/util/text.ts | 9 +- src/util/window.ts | 3 +- src/window.ts | 25 +- types/ambient.d.ts | 8 +- 103 files changed, 3386 insertions(+), 3341 deletions(-) diff --git a/package.json b/package.json index a762b9f4..4d741c11 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,6 @@ "build": "node lib/build.js", "typecheck": "tsc --strict --noEmit", "generate-sources": "flatpak-node-generator yarn yarn.lock -o build-aux/flatpak/modules/yarn-deps-sources.json", - "lint": "eslint src types" + "lint": "eslint --ext .ts,.tsx,.js,.jsx src types" } } diff --git a/src/application.ts b/src/application.ts index 706a6be3..8e069843 100644 --- a/src/application.ts +++ b/src/application.ts @@ -37,8 +37,8 @@ export class Application extends Adw.Application { }, { name: "about", - activate: this.show_about_dialog_cb.bind(this) - } + activate: this.show_about_dialog_cb.bind(this), + }, ]); this.set_accels_for_action("app.quit", ["q"]); diff --git a/src/components/carousel/card.ts b/src/components/carousel/card.ts index 4d81faa4..7a10386b 100644 --- a/src/components/carousel/card.ts +++ b/src/components/carousel/card.ts @@ -33,23 +33,19 @@ enum CarouselImageType { export class CarouselCard extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "CarouselCard", - Template: - "resource:///com/vixalien/muzika/ui/components/carousel/card.ui", - Children: [ - "dynamic_image", - ], - Properties: { - state: get_state_pspec(), + GObject.registerClass( + { + GTypeName: "CarouselCard", + Template: + "resource:///com/vixalien/muzika/ui/components/carousel/card.ui", + Children: ["dynamic_image"], + Properties: { + state: get_state_pspec(), + }, + InternalChildren: ["title", "subtitles", "explicit", "subtitle"], }, - InternalChildren: [ - "title", - "subtitles", - "explicit", - "subtitle", - ], - }, this); + this, + ); } dynamic_image!: DynamicImage; @@ -81,10 +77,7 @@ export class CarouselCard extends Gtk.Box { this.content = undefined; } - private setup_image( - image_type: CarouselImageType, - thumbnails: Thumbnail[], - ) { + private setup_image(image_type: CarouselImageType, thumbnails: Thumbnail[]) { switch (image_type) { case CarouselImageType.AVATAR: this.dynamic_image.avatar_thumbnails = thumbnails; @@ -93,7 +86,7 @@ export class CarouselCard extends Gtk.Box { this.dynamic_image.persistent_play_button = true; this.dynamic_image.cover_thumbnails = thumbnails; break; - // TODO: fix + // TODO: fix case CarouselImageType.PLAYLIST_IMAGE: this.dynamic_image.playlist = true; this.dynamic_image.cover_thumbnails = thumbnails; @@ -179,7 +172,7 @@ export class CarouselCard extends Gtk.Box { menuLikeRow( song.likeStatus, song.videoId, - (likeStatus) => song.likeStatus = likeStatus, + (likeStatus) => (song.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${song.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${song.videoId}?next=true")`], @@ -187,15 +180,15 @@ export class CarouselCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${song.videoId}")`], song.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${song.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${song.album.id}")`, + ] : null, song.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${song.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${song.artists[0].id}")`, + ] : null, ]; }); @@ -213,15 +206,15 @@ export class CarouselCard extends Gtk.Box { this.menu_helper.props = [ artist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${artist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${artist.shuffleId}?next=true")`, + ] : null, artist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${artist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${artist.radioId}?next=true")`, + ] : null, ]; } @@ -253,7 +246,7 @@ export class CarouselCard extends Gtk.Box { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -261,9 +254,9 @@ export class CarouselCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.artists && video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -283,7 +276,7 @@ export class CarouselCard extends Gtk.Box { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -291,15 +284,15 @@ export class CarouselCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${video.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${video.album.id}")`, + ] : null, video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -317,15 +310,15 @@ export class CarouselCard extends Gtk.Box { this.menu_helper.props = [ playlist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${playlist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${playlist.shuffleId}?next=true")`, + ] : null, playlist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${playlist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${playlist.radioId}?next=true")`, + ] : null, [ _("Play next"), @@ -351,15 +344,15 @@ export class CarouselCard extends Gtk.Box { this.menu_helper.props = [ playlist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${playlist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${playlist.shuffleId}?next=true")`, + ] : null, playlist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${playlist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${playlist.radioId}?next=true")`, + ] : null, [ _("Play next"), @@ -386,15 +379,15 @@ export class CarouselCard extends Gtk.Box { this.menu_helper.props = [ album.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${album.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${album.shuffleId}?next=true")`, + ] : null, album.radioId ? [ - _("Start radio"), - `queue.play-playlist("${album.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${album.radioId}?next=true")`, + ] : null, [ _("Play next"), @@ -407,9 +400,9 @@ export class CarouselCard extends Gtk.Box { ], album.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${album.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${album.artists[0].id}")`, + ] : null, ]; } diff --git a/src/components/carousel/flatcard.ts b/src/components/carousel/flatcard.ts index 59ee030d..2ef257e5 100644 --- a/src/components/carousel/flatcard.ts +++ b/src/components/carousel/flatcard.ts @@ -36,27 +36,22 @@ GObject.type_ensure(DynamicImage.$gtype); export type FlatCardItem = MixedCardItem | InlineSong | SearchContent; -export type InlineSong = - | FlatSong - | Ranked - | Ranked; +export type InlineSong = FlatSong | Ranked | Ranked; export class FlatCard extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "FlatCard", - Template: - "resource:///com/vixalien/muzika/ui/components/carousel/flatcard.ui", - InternalChildren: [ - "title", - "explicit", - "subtitle", - "dynamic_image", - ], - Properties: { - state: get_state_pspec(), + GObject.registerClass( + { + GTypeName: "FlatCard", + Template: + "resource:///com/vixalien/muzika/ui/components/carousel/flatcard.ui", + InternalChildren: ["title", "explicit", "subtitle", "dynamic_image"], + Properties: { + state: get_state_pspec(), + }, }, - }, this); + this, + ); } content?: FlatCardItem; @@ -170,7 +165,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( song.likeStatus, song.videoId!, - (likeStatus) => song.likeStatus = likeStatus, + (likeStatus) => (song.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${song.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${song.videoId}?next=true")`], @@ -178,9 +173,9 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${song.videoId}")`], song.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${song.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${song.album.id}")`, + ] : null, ]; }); @@ -200,7 +195,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( song.likeStatus, song.videoId, - (likeStatus) => song.likeStatus = likeStatus, + (likeStatus) => (song.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${song.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${song.videoId}?next=true")`], @@ -208,15 +203,15 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${song.videoId}")`], song.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${song.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${song.album.id}")`, + ] : null, song.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${song.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${song.artists[0].id}")`, + ] : null, ]; }); @@ -239,7 +234,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -247,9 +242,9 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.artists && video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -269,7 +264,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( song.likeStatus, song.videoId, - (likeStatus) => song.likeStatus = likeStatus, + (likeStatus) => (song.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${song.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${song.videoId}?next=true")`], @@ -277,15 +272,15 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${song.videoId}")`], song.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${song.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${song.album.id}")`, + ] : null, song.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${song.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${song.artists[0].id}")`, + ] : null, ]; }); @@ -310,7 +305,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -318,9 +313,9 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.artists && video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -338,15 +333,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ album.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${album.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${album.shuffleId}?next=true")`, + ] : null, album.radioId ? [ - _("Start radio"), - `queue.play-playlist("${album.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${album.radioId}?next=true")`, + ] : null, // TODO: get album audioPlaylistId // [ @@ -360,9 +355,9 @@ export class FlatCard extends Gtk.Box { // ], album.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${album.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${album.artists[0].id}")`, + ] : null, ]; } @@ -379,20 +374,17 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ playlist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${playlist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${playlist.shuffleId}?next=true")`, + ] : null, playlist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${playlist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${playlist.radioId}?next=true")`, + ] : null, - [ - _("Play next"), - `queue.add-playlist("${playlist.browseId}?next=true")`, - ], + [_("Play next"), `queue.add-playlist("${playlist.browseId}?next=true")`], [_("Add to queue"), `queue.add-playlist("${playlist.browseId}")`], [ _("Save to playlist"), @@ -414,15 +406,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ artist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${artist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${artist.shuffleId}?next=true")`, + ] : null, artist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${artist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${artist.radioId}?next=true")`, + ] : null, ]; } @@ -451,10 +443,7 @@ export class FlatCard extends Gtk.Box { this.setup_playlist(radio.playlistId); this.menu_helper.props = [ - [ - _("Play next"), - `queue.add-playlist("${radio.playlistId}?next=true")`, - ], + [_("Play next"), `queue.add-playlist("${radio.playlistId}?next=true")`], [_("Add to queue"), `queue.add-playlist("${radio.playlistId}")`], [ _("Save to playlist"), @@ -478,7 +467,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( song.likeStatus, song.videoId, - (likeStatus) => song.likeStatus = likeStatus, + (likeStatus) => (song.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${song.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${song.videoId}?next=true")`], @@ -486,15 +475,15 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${song.videoId}")`], song.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${song.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${song.album.id}")`, + ] : null, song.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${song.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${song.artists[0].id}")`, + ] : null, ]; }); @@ -512,15 +501,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ artist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${artist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${artist.shuffleId}?next=true")`, + ] : null, artist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${artist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${artist.radioId}?next=true")`, + ] : null, ]; } @@ -538,15 +527,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ artist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${artist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${artist.shuffleId}?next=true")`, + ] : null, artist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${artist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${artist.radioId}?next=true")`, + ] : null, ]; } @@ -568,7 +557,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -576,9 +565,9 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.artists && video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -601,7 +590,7 @@ export class FlatCard extends Gtk.Box { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -609,9 +598,9 @@ export class FlatCard extends Gtk.Box { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.artists && video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -623,7 +612,7 @@ export class FlatCard extends Gtk.Box { this.set_title(playlist.title); this.set_subtitle( _("Playlist"), - playlist.description ? [playlist.description] : (playlist.authors ?? []), + playlist.description ? [playlist.description] : playlist.authors ?? [], ); this.load_thumbnails(playlist.thumbnails); @@ -632,15 +621,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ playlist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${playlist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${playlist.shuffleId}?next=true")`, + ] : null, playlist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${playlist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${playlist.radioId}?next=true")`, + ] : null, [ _("Play next"), @@ -659,10 +648,7 @@ export class FlatCard extends Gtk.Box { this.set_title(playlist.title); this.show_type = false; - this.set_subtitle( - _("Radio"), - _("Start Radio"), - ); + this.set_subtitle(_("Radio"), _("Start Radio")); this.load_thumbnails(playlist.thumbnails); this.setup_playlist(playlist.playlistId); @@ -670,15 +656,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ playlist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${playlist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${playlist.shuffleId}?next=true")`, + ] : null, playlist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${playlist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${playlist.radioId}?next=true")`, + ] : null, [ _("Play next"), @@ -704,15 +690,15 @@ export class FlatCard extends Gtk.Box { this.menu_helper.props = [ album.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${album.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${album.shuffleId}?next=true")`, + ] : null, album.radioId ? [ - _("Start radio"), - `queue.play-playlist("${album.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${album.radioId}?next=true")`, + ] : null, [ _("Play next"), @@ -725,9 +711,9 @@ export class FlatCard extends Gtk.Box { ], album.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${album.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${album.artists[0].id}")`, + ] : null, ]; } diff --git a/src/components/carousel/index.ts b/src/components/carousel/index.ts index 762221e4..db9abc48 100644 --- a/src/components/carousel/index.ts +++ b/src/components/carousel/index.ts @@ -22,23 +22,26 @@ export class Carousel< }, > extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "Carousel", - Template: - "resource:///com/vixalien/muzika/ui/components/carousel/carousel.ui", - InternalChildren: [ - "title", - "subtitle", - "text", - "text_view", - "scrolled", - "buttons", - "left_button", - "right_button", - "carousel_stack", - "more_button", - ], - }, this); + GObject.registerClass( + { + GTypeName: "Carousel", + Template: + "resource:///com/vixalien/muzika/ui/components/carousel/carousel.ui", + InternalChildren: [ + "title", + "subtitle", + "text", + "text_view", + "scrolled", + "buttons", + "left_button", + "right_button", + "carousel_stack", + "more_button", + ], + }, + this, + ); } content?: Content; @@ -89,9 +92,9 @@ export class Carousel< const animation = Adw.TimedAnimation.new( this._scrolled, hadjustment.value, - (direction === Gtk.DirectionType.RIGHT) - ? (hadjustment.value + hadjustment.page_size) - : (hadjustment.value - hadjustment.page_size), + direction === Gtk.DirectionType.RIGHT + ? hadjustment.value + hadjustment.page_size + : hadjustment.value - hadjustment.page_size, 400, target, ); @@ -103,8 +106,8 @@ export class Carousel< const hadjustment = this._scrolled.get_hadjustment(); if ( - (hadjustment.get_upper() - hadjustment.get_lower()) == - hadjustment.page_size + hadjustment.get_upper() - hadjustment.get_lower() == + hadjustment.page_size ) { this._left_button.hide(); this._right_button.hide(); @@ -116,7 +119,8 @@ export class Carousel< this._left_button.set_sensitive(false); this._right_button.set_sensitive(true); } else if ( - hadjustment.value >= (hadjustment.get_upper() - hadjustment.page_size) + hadjustment.value >= + hadjustment.get_upper() - hadjustment.page_size ) { this._left_button.set_sensitive(true); this._right_button.set_sensitive(false); @@ -163,15 +167,13 @@ export class Carousel< 0, contents .filter((content) => content != null) - .map((content) => PlayableContainer.new(content!)), + .map((content) => PlayableContainer.new(content)), ); this._scrolled.child = moodview; } - show_content( - content: Content, - ) { + show_content(content: Content) { this._title.set_label(content.title ?? ""); if (content.subtitle) { diff --git a/src/components/carousel/view/flatgrid.ts b/src/components/carousel/view/flatgrid.ts index 8c0a99ab..f7a7dd19 100644 --- a/src/components/carousel/view/flatgrid.ts +++ b/src/components/carousel/view/flatgrid.ts @@ -15,20 +15,23 @@ export interface FlatGridViewConstructorProperties export class FlatGridView extends Gtk.GridView { static { - GObject.registerClass({ - GTypeName: "FlatGridView", - Properties: { - "child-type": GObject.ParamSpec.uint( - "child-type", - "Child Type", - "The type of children rendered by this listview", - GObject.ParamFlags.READWRITE, - FlatViewChildType.INLINE_SONG, - FlatViewChildType.MIXED_CARD, - FlatViewChildType.INLINE_SONG, - ), + GObject.registerClass( + { + GTypeName: "FlatGridView", + Properties: { + "child-type": GObject.ParamSpec.uint( + "child-type", + "Child Type", + "The type of children rendered by this listview", + GObject.ParamFlags.READWRITE, + FlatViewChildType.INLINE_SONG, + FlatViewChildType.MIXED_CARD, + FlatViewChildType.INLINE_SONG, + ), + }, }, - }, this); + this, + ); } items = new PlayableList(); diff --git a/src/components/carousel/view/flatlist.ts b/src/components/carousel/view/flatlist.ts index 528e5566..936c45fa 100644 --- a/src/components/carousel/view/flatlist.ts +++ b/src/components/carousel/view/flatlist.ts @@ -15,20 +15,23 @@ export interface FlatListViewConstructorProperties export class FlatListView extends Gtk.ListView { static { - GObject.registerClass({ - GTypeName: "FlatListView", - Properties: { - "child-type": GObject.ParamSpec.uint( - "child-type", - "Child Type", - "The type of children rendered by this listview", - GObject.ParamFlags.READWRITE, - FlatViewChildType.INLINE_SONG, - FlatViewChildType.MIXED_CARD, - FlatViewChildType.INLINE_SONG, - ), + GObject.registerClass( + { + GTypeName: "FlatListView", + Properties: { + "child-type": GObject.ParamSpec.uint( + "child-type", + "Child Type", + "The type of children rendered by this listview", + GObject.ParamFlags.READWRITE, + FlatViewChildType.INLINE_SONG, + FlatViewChildType.MIXED_CARD, + FlatViewChildType.INLINE_SONG, + ), + }, }, - }, this); + this, + ); } private _items!: PlayableList; diff --git a/src/components/carousel/view/grid.ts b/src/components/carousel/view/grid.ts index b0671207..83315241 100644 --- a/src/components/carousel/view/grid.ts +++ b/src/components/carousel/view/grid.ts @@ -12,9 +12,12 @@ export type RequiredMixedItem = NonNullable; export class CarouselGridView extends Gtk.GridView { static { - GObject.registerClass({ - GTypeName: "CarouselGridView", - }, this); + GObject.registerClass( + { + GTypeName: "CarouselGridView", + }, + this, + ); } private _items!: PlayableList; @@ -54,8 +57,7 @@ export class CarouselGridView extends Gtk.GridView { const card = new CarouselCard(); card.dynamic_image.hexpand = card.dynamic_image.vexpand = - card.dynamic_image - .can_expand = + card.dynamic_image.can_expand = true; list_item.set_child(card); } diff --git a/src/components/carousel/view/list.ts b/src/components/carousel/view/list.ts index 9712dde9..c69b8dcc 100644 --- a/src/components/carousel/view/list.ts +++ b/src/components/carousel/view/list.ts @@ -12,9 +12,12 @@ export type RequiredMixedItem = NonNullable; export class CarouselListView extends Gtk.ListView { static { - GObject.registerClass({ - GTypeName: "CarouselListView", - }, this); + GObject.registerClass( + { + GTypeName: "CarouselListView", + }, + this, + ); } items = new PlayableList(); diff --git a/src/components/carousel/view/mood.ts b/src/components/carousel/view/mood.ts index ceb9b3fa..af4a2fe3 100644 --- a/src/components/carousel/view/mood.ts +++ b/src/components/carousel/view/mood.ts @@ -9,12 +9,15 @@ import { mood_activate_cb } from "./util"; export class MoodBox extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "MoodBox", - Template: - "resource:///com/vixalien/muzika/ui/components/carousel/moodbox.ui", - InternalChildren: ["label"], - }, this); + GObject.registerClass( + { + GTypeName: "MoodBox", + Template: + "resource:///com/vixalien/muzika/ui/components/carousel/moodbox.ui", + InternalChildren: ["label"], + }, + this, + ); } private _label!: Gtk.Label; @@ -32,16 +35,21 @@ export class MoodBox extends Adw.Bin { -1, ); - this.get_style_context() - .add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + this.get_style_context().add_provider( + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION, + ); } } export class CarouselMoodView extends Gtk.GridView { static { - GObject.registerClass({ - GTypeName: "CarouselMoodView", - }, this); + GObject.registerClass( + { + GTypeName: "CarouselMoodView", + }, + this, + ); } items = new PlayableList(); diff --git a/src/components/carousel/view/util.ts b/src/components/carousel/view/util.ts index 98857755..b2dff703 100644 --- a/src/components/carousel/view/util.ts +++ b/src/components/carousel/view/util.ts @@ -17,16 +17,11 @@ export enum FlatViewChildType { MIXED_CARD, } -function activate_inline_song( - view: Gtk.Widget, - song: InlineSong, -) { +function activate_inline_song(view: Gtk.Widget, song: InlineSong) { if (song.videoId) { view.activate_action( "queue.play-song", - GLib.Variant.new_string( - song.videoId, - ), + GLib.Variant.new_string(song.videoId), ); } } @@ -93,10 +88,7 @@ export function flat_view_activate_cb( } } -function activate_mixed_card( - view: Gtk.Widget, - item: MixedCardItem, -) { +function activate_mixed_card(view: Gtk.Widget, item: MixedCardItem) { let uri: string | null = null; switch (item.type) { @@ -105,7 +97,7 @@ function activate_mixed_card( uri = `playlist:${item.playlistId}`; break; case "artist": - // library channels are music channels + // library channels are music channels case "channel": uri = `artist:${item.browseId}`; break; @@ -128,9 +120,7 @@ function activate_mixed_card( if (item.videoId) { view.activate_action( "queue.play-song", - GLib.Variant.new_string( - item.videoId, - ), + GLib.Variant.new_string(item.videoId), ); } break; diff --git a/src/components/dynamic-action.ts b/src/components/dynamic-action.ts index 74a62f76..ab1da0d1 100644 --- a/src/components/dynamic-action.ts +++ b/src/components/dynamic-action.ts @@ -32,67 +32,70 @@ export function get_state_pspec() { export class DynamicAction extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "DynamicAction", - Template: - "resource:///com/vixalien/muzika/ui/components/dynamic-action.ui", - InternalChildren: [ - "stack", - "play", - "pause", - "persistent_play", - "loading", - "pause_image", - "play_image", - "persistent_play_image", - "wave", - "spinner", - ], - Properties: { - "size": GObject.ParamSpec.int( - "size", - "Size", - "The size of the dynamic action. This will only have effect if `fill` is set to `true`", - GObject.ParamFlags.READWRITE, - -1, - 1000000, - 48, - ), - "state": get_state_pspec(), - "fill": GObject.ParamSpec.boolean( - "fill", - "Fill", - "If this dynamic action should fill the container or just display at the bottom right edge", - GObject.ParamFlags.READWRITE, - false, - ), - "locked": GObject.ParamSpec.boolean( - "locked", - "Static", - "If this dynamic action should stop updating it's state", - GObject.ParamFlags.READWRITE, - false, - ), - "hovering": GObject.ParamSpec.boolean( - "hovering", - "Hovering", - "Whether the mouse is hovering over this dynamic action", - GObject.ParamFlags.READWRITE, - false, - ), - "persistent-play-button": GObject.ParamSpec.boolean( - "persistent-play-button", - "Persistent Play Button", - "Whether to show the play button even when the song is not paused", - GObject.ParamFlags.READWRITE, - false, - ), + GObject.registerClass( + { + GTypeName: "DynamicAction", + Template: + "resource:///com/vixalien/muzika/ui/components/dynamic-action.ui", + InternalChildren: [ + "stack", + "play", + "pause", + "persistent_play", + "loading", + "pause_image", + "play_image", + "persistent_play_image", + "wave", + "spinner", + ], + Properties: { + size: GObject.ParamSpec.int( + "size", + "Size", + "The size of the dynamic action. This will only have effect if `fill` is set to `true`", + GObject.ParamFlags.READWRITE, + -1, + 1000000, + 48, + ), + state: get_state_pspec(), + fill: GObject.ParamSpec.boolean( + "fill", + "Fill", + "If this dynamic action should fill the container or just display at the bottom right edge", + GObject.ParamFlags.READWRITE, + false, + ), + locked: GObject.ParamSpec.boolean( + "locked", + "Static", + "If this dynamic action should stop updating it's state", + GObject.ParamFlags.READWRITE, + false, + ), + hovering: GObject.ParamSpec.boolean( + "hovering", + "Hovering", + "Whether the mouse is hovering over this dynamic action", + GObject.ParamFlags.READWRITE, + false, + ), + "persistent-play-button": GObject.ParamSpec.boolean( + "persistent-play-button", + "Persistent Play Button", + "Whether to show the play button even when the song is not paused", + GObject.ParamFlags.READWRITE, + false, + ), + }, + Signals: { + play: {}, + pause: {}, + }, }, - Signals: { - play: {}, - pause: {}, - }, - }, this); + this, + ); } constructor(props?: Partial) { @@ -307,11 +310,9 @@ function set_properties< Prop extends keyof T, Value extends T[Prop], >(object: T | T[], key: Prop | Prop[], value: Value) { - ([object].flat() as T[]) - .forEach((object) => { - ([key].flat() as Prop[]) - .forEach((key) => { - object[key] = value; - }); + ([object].flat() as T[]).forEach((object) => { + ([key].flat() as Prop[]).forEach((key) => { + object[key] = value; }); + }); } diff --git a/src/components/dynamic-image.ts b/src/components/dynamic-image.ts index d25c9044..c1a3e9a0 100644 --- a/src/components/dynamic-image.ts +++ b/src/components/dynamic-image.ts @@ -4,7 +4,11 @@ import Adw from "gi://Adw"; import { Thumbnail } from "libmuse"; import { load_thumbnails } from "./webimage"; -import { DynamicAction, DynamicActionState, get_state_pspec } from "./dynamic-action"; +import { + DynamicAction, + DynamicActionState, + get_state_pspec, +} from "./dynamic-action"; import { SignalListeners } from "src/util/signal-listener"; import { get_player } from "src/application"; import { FixedRatioThumbnail } from "./fixed-ratio-thumbnail"; @@ -20,12 +24,17 @@ export enum DynamicImageStorageType { } export type DynamicImageInnerChild = - Type extends DynamicImageStorageType.EMPTY ? Adw.Bin - : Type extends DynamicImageStorageType.TRACK_NUMBER ? Gtk.Label - : Type extends DynamicImageStorageType.COVER_THUMBNAIL ? Gtk.Picture - : Type extends DynamicImageStorageType.AVATAR ? Adw.Avatar - : Type extends DynamicImageStorageType.VIDEO_THUMBNAIL ? Gtk.Image - : never; + Type extends DynamicImageStorageType.EMPTY + ? Adw.Bin + : Type extends DynamicImageStorageType.TRACK_NUMBER + ? Gtk.Label + : Type extends DynamicImageStorageType.COVER_THUMBNAIL + ? Gtk.Picture + : Type extends DynamicImageStorageType.AVATAR + ? Adw.Avatar + : Type extends DynamicImageStorageType.VIDEO_THUMBNAIL + ? Gtk.Image + : never; export interface DynamicImageConstructorProperties extends Gtk.Overlay.ConstructorProperties { @@ -39,97 +48,100 @@ export interface DynamicImageConstructorProperties export class DynamicImage extends Gtk.Overlay { static { - GObject.registerClass({ - GTypeName: "DynamicImage", - Template: - "resource:///com/vixalien/muzika/ui/components/dynamic-image.ui", - InternalChildren: ["container", "action", "check"], - Properties: { - "size": GObject.ParamSpec.int( - "size", - "Size", - "The size of the dynamic image", - GObject.ParamFlags.READWRITE, - 0, - 1000000, - 0, - ), - "action-size": GObject.ParamSpec.int( - "action-size", - "Action Size", - "The size of the inset dynamic action", - GObject.ParamFlags.READWRITE, - 0, - 1000000, - 0, - ), - "state": get_state_pspec(), - "storage-type": GObject.ParamSpec.uint( - "storage-type", - "Storage Type", - "The current type of child being shown by this dynamic image", - GObject.ParamFlags.READABLE, - DynamicImageStorageType.EMPTY, - DynamicImageStorageType.AVATAR, - DynamicImageStorageType.EMPTY, - ), - "track-number": GObject.ParamSpec.int( - "track-number", - "Track Number", - "Track Number displayed by this dynamic image", - GObject.ParamFlags.READWRITE, - 0, - 1000000, - 0, - ), - "playlist": GObject.ParamSpec.boolean( - "playlist", - "Playlist", - "Whether this dynamic image is showing a playlist", - GObject.ParamFlags.READWRITE, - false, - ), - "persistent-play-button": GObject.ParamSpec.boolean( - "persistent-play-button", - "Persistent Play Button", - "Whether to always show the play button", - GObject.ParamFlags.READWRITE, - false, - ), - can_expand: GObject.ParamSpec.boolean( - "can-expand", - "Can Expand", - "Whether to expand the image to fill the available space", - GObject.ParamFlags.READWRITE, - false, - ), - "selection-mode": GObject.ParamSpec.boolean( - "selection-mode", - "Selection mode", - "Whether the image is in selection mode", - GObject.ParamFlags.READWRITE, - false, - ), - selected: GObject.ParamSpec.boolean( - "selected", - "Selected", - "Whether the image is selected", - GObject.ParamFlags.READWRITE, - false, - ), - "action-locked": GObject.ParamSpec.boolean( - "action-locked", - "Action Locked", - "Whether the action is locked", - GObject.ParamFlags.READWRITE, - false, - ), + GObject.registerClass( + { + GTypeName: "DynamicImage", + Template: + "resource:///com/vixalien/muzika/ui/components/dynamic-image.ui", + InternalChildren: ["container", "action", "check"], + Properties: { + size: GObject.ParamSpec.int( + "size", + "Size", + "The size of the dynamic image", + GObject.ParamFlags.READWRITE, + 0, + 1000000, + 0, + ), + "action-size": GObject.ParamSpec.int( + "action-size", + "Action Size", + "The size of the inset dynamic action", + GObject.ParamFlags.READWRITE, + 0, + 1000000, + 0, + ), + state: get_state_pspec(), + "storage-type": GObject.ParamSpec.uint( + "storage-type", + "Storage Type", + "The current type of child being shown by this dynamic image", + GObject.ParamFlags.READABLE, + DynamicImageStorageType.EMPTY, + DynamicImageStorageType.AVATAR, + DynamicImageStorageType.EMPTY, + ), + "track-number": GObject.ParamSpec.int( + "track-number", + "Track Number", + "Track Number displayed by this dynamic image", + GObject.ParamFlags.READWRITE, + 0, + 1000000, + 0, + ), + playlist: GObject.ParamSpec.boolean( + "playlist", + "Playlist", + "Whether this dynamic image is showing a playlist", + GObject.ParamFlags.READWRITE, + false, + ), + "persistent-play-button": GObject.ParamSpec.boolean( + "persistent-play-button", + "Persistent Play Button", + "Whether to always show the play button", + GObject.ParamFlags.READWRITE, + false, + ), + can_expand: GObject.ParamSpec.boolean( + "can-expand", + "Can Expand", + "Whether to expand the image to fill the available space", + GObject.ParamFlags.READWRITE, + false, + ), + "selection-mode": GObject.ParamSpec.boolean( + "selection-mode", + "Selection mode", + "Whether the image is in selection mode", + GObject.ParamFlags.READWRITE, + false, + ), + selected: GObject.ParamSpec.boolean( + "selected", + "Selected", + "Whether the image is selected", + GObject.ParamFlags.READWRITE, + false, + ), + "action-locked": GObject.ParamSpec.boolean( + "action-locked", + "Action Locked", + "Whether the action is locked", + GObject.ParamFlags.READWRITE, + false, + ), + }, + Signals: { + play: {}, + pause: {}, + }, }, - Signals: { - play: {}, - pause: {}, - }, - }, this); + this, + ); } private _container!: Adw.Bin; @@ -166,7 +178,8 @@ export class DynamicImage extends Gtk.Overlay { if ( this.storage_type !== DynamicImageStorageType.COVER_THUMBNAIL && this.storage_type !== DynamicImageStorageType.VIDEO_THUMBNAIL - ) return; + ) + return; const all_classes = [ "icon-dropshadow", @@ -185,9 +198,11 @@ export class DynamicImage extends Gtk.Overlay { classes.push("br-9"); } - all_classes.filter((c) => !classes.includes(c)).forEach((c) => { - this.remove_css_class(c); - }); + all_classes + .filter((c) => !classes.includes(c)) + .forEach((c) => { + this.remove_css_class(c); + }); classes.forEach((c) => { this.add_css_class(c); diff --git a/src/components/fixed-ratio-thumbnail.ts b/src/components/fixed-ratio-thumbnail.ts index 62c38138..4c460590 100644 --- a/src/components/fixed-ratio-thumbnail.ts +++ b/src/components/fixed-ratio-thumbnail.ts @@ -18,79 +18,82 @@ export interface FixedRatioThumbnailProps export class FixedRatioThumbnail extends Gtk.Widget implements Gtk.Orientable { static { - GObject.registerClass({ - GTypeName: "FixedRatioThumbnail", - Properties: { - paintable: GObject.ParamSpec.object( - "paintable", - "Paintable", - "The currently displayed paintable", - GObject.ParamFlags.READWRITE, - Gdk.Paintable, - ), - min_width: GObject.ParamSpec.int( - "min-width", - "Minimum Width", - "The minimum width of this image", - GObject.ParamFlags.READWRITE, - 0, - GLib.MAXINT32, - 0, - ), - max_width: GObject.ParamSpec.int( - "max-width", - "Maximum Width", - "The maximum width of this image", - GObject.ParamFlags.READWRITE, - -1, - GLib.MAXINT32, - -1, - ), - min_height: GObject.ParamSpec.int( - "min-height", - "Minimum Height", - "The minimum height of this image", - GObject.ParamFlags.READWRITE, - 0, - GLib.MAXINT32, - 0, - ), - max_height: GObject.ParamSpec.int( - "max-height", - "Maximum Height", - "The maximum height of this image", - GObject.ParamFlags.READWRITE, - -1, - GLib.MAXINT32, - -1, - ), - orientation: GObject.ParamSpec.enum( - "orientation", - "Orientation", - "The orientation of the image", - GObject.ParamFlags.READWRITE, - Gtk.Orientation, - Gtk.Orientation.HORIZONTAL, - ), - can_expand: GObject.ParamSpec.boolean( - "can-expand", - "Can Expand", - "Whether to expand the image to fill the available space", - GObject.ParamFlags.READWRITE, - false, - ), - aspect_ratio: GObject.ParamSpec.float( - "aspect-ratio", - "Aspect Ratio", - "The preferred aspect ratio. If this is -1, the aspect ratio is inferred", - GObject.ParamFlags.READWRITE, - -1, - GLib.MAXINT32, - -1, - ), + GObject.registerClass( + { + GTypeName: "FixedRatioThumbnail", + Properties: { + paintable: GObject.ParamSpec.object( + "paintable", + "Paintable", + "The currently displayed paintable", + GObject.ParamFlags.READWRITE, + Gdk.Paintable, + ), + min_width: GObject.ParamSpec.int( + "min-width", + "Minimum Width", + "The minimum width of this image", + GObject.ParamFlags.READWRITE, + 0, + GLib.MAXINT32, + 0, + ), + max_width: GObject.ParamSpec.int( + "max-width", + "Maximum Width", + "The maximum width of this image", + GObject.ParamFlags.READWRITE, + -1, + GLib.MAXINT32, + -1, + ), + min_height: GObject.ParamSpec.int( + "min-height", + "Minimum Height", + "The minimum height of this image", + GObject.ParamFlags.READWRITE, + 0, + GLib.MAXINT32, + 0, + ), + max_height: GObject.ParamSpec.int( + "max-height", + "Maximum Height", + "The maximum height of this image", + GObject.ParamFlags.READWRITE, + -1, + GLib.MAXINT32, + -1, + ), + orientation: GObject.ParamSpec.enum( + "orientation", + "Orientation", + "The orientation of the image", + GObject.ParamFlags.READWRITE, + Gtk.Orientation, + Gtk.Orientation.HORIZONTAL, + ), + can_expand: GObject.ParamSpec.boolean( + "can-expand", + "Can Expand", + "Whether to expand the image to fill the available space", + GObject.ParamFlags.READWRITE, + false, + ), + aspect_ratio: GObject.ParamSpec.float( + "aspect-ratio", + "Aspect Ratio", + "The preferred aspect ratio. If this is -1, the aspect ratio is inferred", + GObject.ParamFlags.READWRITE, + -1, + GLib.MAXINT32, + -1, + ), + }, + Implements: [Gtk.Orientable], }, - Implements: [Gtk.Orientable], - }, this); + this, + ); } constructor(props?: Partial) { @@ -388,21 +391,21 @@ export class FixedRatioThumbnail extends Gtk.Widget implements Gtk.Orientable { this.queue_draw(); } - private paintable_invalidate_contents_binded = this - .paintable_invalidate_contents.bind(this); + private paintable_invalidate_contents_binded = + this.paintable_invalidate_contents.bind(this); private paintable_invalidate_size() { this.queue_resize(); } - private paintable_invalidate_size_binded = this - .paintable_invalidate_size.bind(this); + private paintable_invalidate_size_binded = + this.paintable_invalidate_size.bind(this); } function min_if_present(...values: (number | null)[]) { - return Math.min(...values.filter((v) => v && v > 0) as number[]); + return Math.min(...(values.filter((v) => v && v > 0) as number[])); } function max_if_present(...values: (number | null)[]) { - return Math.max(...values.filter((v) => v && v > 0) as number[]); + return Math.max(...(values.filter((v) => v && v > 0) as number[])); } diff --git a/src/components/inline-tab-switcher.ts b/src/components/inline-tab-switcher.ts index 3d05bdc2..fcec44a0 100644 --- a/src/components/inline-tab-switcher.ts +++ b/src/components/inline-tab-switcher.ts @@ -78,7 +78,7 @@ export class InlineTabSwitcher extends Gtk.Widget { { GTypeName: "InlineTabSwitcher", Signals: { - "changed": { + changed: { param_types: [GObject.TYPE_STRING], }, }, @@ -99,13 +99,10 @@ export class InlineTabSwitcher extends Gtk.Widget { this.tabs.set_model(this.model); this.tabs.connect("items-changed", this.items_changed_cb.bind(this)); - this.tabs.connect( - "selection-changed", - (_, position, items) => { - this.emit("changed", this.tabs.get_item(this.tabs.selected)!.id); - this.selection_changed_cb(position, items); - }, - ); + this.tabs.connect("selection-changed", (_, position, items) => { + this.emit("changed", this.tabs.get_item(this.tabs.selected)!.id); + this.selection_changed_cb(position, items); + }); this.populate_switcher(); } @@ -329,8 +326,10 @@ export class InlineTabSwitcher extends Gtk.Widget { if ( (flags & - (Gtk.StateFlags.PRELIGHT | Gtk.StateFlags.SELECTED | - Gtk.StateFlags.CHECKED)) != 0 + (Gtk.StateFlags.PRELIGHT | + Gtk.StateFlags.SELECTED | + Gtk.StateFlags.CHECKED)) != + 0 ) { return true; } @@ -349,7 +348,7 @@ export class InlineTabSwitcher extends Gtk.Widget { const prev_button = separator.get_prev_sibling() as Gtk.Button; const next_button = separator.get_next_sibling() as Gtk.Button; - separator.visible = (prev_button != null) && (next_button != null); + separator.visible = prev_button != null && next_button != null; if ( this.should_hide_separators(prev_button) || diff --git a/src/components/library/view.ts b/src/components/library/view.ts index 8b67a2d4..5b193f13 100644 --- a/src/components/library/view.ts +++ b/src/components/library/view.ts @@ -14,44 +14,48 @@ export interface LibraryViewOptions { export class LibraryView extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "LibraryView", - Template: "resource:///com/vixalien/muzika/ui/components/library/view.ui", - InternalChildren: [ - "drop_down", - "grid_button", - "list_button", - "stack", - "tools", - "box", - "list", - "grid", - "paginator", - ], - Children: ["scrolled"], - Signals: { - "filter-changed": { - param_types: [GObject.TYPE_STRING], + GObject.registerClass( + { + GTypeName: "LibraryView", + Template: + "resource:///com/vixalien/muzika/ui/components/library/view.ui", + InternalChildren: [ + "drop_down", + "grid_button", + "list_button", + "stack", + "tools", + "box", + "list", + "grid", + "paginator", + ], + Children: ["scrolled"], + Signals: { + "filter-changed": { + param_types: [GObject.TYPE_STRING], + }, + paginate: {}, + }, + Properties: { + "reveal-paginator": GObject.param_spec_boolean( + "reveal-paginator", + "Reveal Paginator", + "Whether to show the paginator component", + false, + GObject.ParamFlags.READWRITE, + ), + "paginator-loading": GObject.param_spec_boolean( + "paginator-loading", + "Paginator Loading", + "Whether the paginator is currently loading", + false, + GObject.ParamFlags.READWRITE, + ), }, - "paginate": {}, - }, - Properties: { - "reveal-paginator": GObject.param_spec_boolean( - "reveal-paginator", - "Reveal Paginator", - "Whether to show the paginator component", - false, - GObject.ParamFlags.READWRITE, - ), - "paginator-loading": GObject.param_spec_boolean( - "paginator-loading", - "Paginator Loading", - "Whether the paginator is currently loading", - false, - GObject.ParamFlags.READWRITE, - ), }, - }, this); + this, + ); } private _stack!: Gtk.Stack; diff --git a/src/components/loading.ts b/src/components/loading.ts index 9f0a518d..be512774 100644 --- a/src/components/loading.ts +++ b/src/components/loading.ts @@ -3,19 +3,22 @@ import GObject from "gi://GObject"; export class Loading extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "Loading", - Template: "resource:///com/vixalien/muzika/ui/components/loading.ui", - Properties: { - loading: GObject.ParamSpec.boolean( - "loading", - "Loading", - "Whether the loading spinner is visible", - GObject.ParamFlags.READWRITE, - false, - ), + GObject.registerClass( + { + GTypeName: "Loading", + Template: "resource:///com/vixalien/muzika/ui/components/loading.ui", + Properties: { + loading: GObject.ParamSpec.boolean( + "loading", + "Loading", + "Whether the loading spinner is visible", + GObject.ParamFlags.READWRITE, + false, + ), + }, }, - }, this); + this, + ); } private _loading = false; diff --git a/src/components/nav/page.ts b/src/components/nav/page.ts index f75934a7..fba74c6a 100644 --- a/src/components/nav/page.ts +++ b/src/components/nav/page.ts @@ -17,34 +17,35 @@ export interface PageState { // register Loading GObject.type_ensure(Loading.$gtype); -export class Page - extends Adw.NavigationPage { +export class Page< + Data extends unknown, + State extends unknown = null, +> extends Adw.NavigationPage { static { - GObject.registerClass({ - GTypeName: "Page", - Template: "resource:///com/vixalien/muzika/ui/components/nav/page.ui", - InternalChildren: [ - "stack", - "loading", - "content", - ], - Properties: { - content: GObject.ParamSpec.object( - "content", - "Content", - "The content to show on this page", - GObject.ParamFlags.READWRITE, - Gtk.Widget.$gtype, - ), - "is-loading": GObject.ParamSpec.boolean( - "is-loading", - "Is Loading", - "Whether the page is loading", - GObject.ParamFlags.READWRITE, - true, - ), + GObject.registerClass( + { + GTypeName: "Page", + Template: "resource:///com/vixalien/muzika/ui/components/nav/page.ui", + InternalChildren: ["stack", "loading", "content"], + Properties: { + content: GObject.ParamSpec.object( + "content", + "Content", + "The content to show on this page", + GObject.ParamFlags.READWRITE, + Gtk.Widget.$gtype, + ), + "is-loading": GObject.ParamSpec.boolean( + "is-loading", + "Is Loading", + "Whether the page is loading", + GObject.ParamFlags.READWRITE, + true, + ), + }, }, - }, this); + this, + ); } private _stack!: Gtk.Stack; @@ -80,9 +81,7 @@ export class Page private __state: PageState | null = null; private __error: any; - constructor( - meta: MuzikaPageMeta, - ) { + constructor(meta: MuzikaPageMeta) { super(); this.uri = meta.uri; @@ -144,20 +143,22 @@ export class Page this.last_match = match; try { - const result = await this.meta.load({ - match, - set_title: this.set_title.bind(this), - signal, - url: new URL("muzika:" + uri), - })?.catch((error) => { - throw error; - }); + const result = await this.meta + .load({ + match, + set_title: this.set_title.bind(this), + signal, + url: new URL("muzika:" + uri), + }) + ?.catch((error) => { + throw error; + }); this.loading = false; this.__error = null; const page = this.meta.build(); - page.present(result!); + page.present(result); this._content.child = this.page = page; } catch (error) { diff --git a/src/components/navbar/button.ts b/src/components/navbar/button.ts index 5184b33a..43af5aec 100644 --- a/src/components/navbar/button.ts +++ b/src/components/navbar/button.ts @@ -9,10 +9,7 @@ export class NavbarButton extends Gtk.Box { GTypeName: "NavbarButton", Template: "resource:///com/vixalien/muzika/ui/components/navbar/button.ui", - InternalChildren: [ - "image", - "label", - ], + InternalChildren: ["image", "label"], Properties: { "icon-name": GObject.ParamSpec.string( "icon-name", diff --git a/src/components/navbar/index.ts b/src/components/navbar/index.ts index b59e8ab3..159b76cf 100644 --- a/src/components/navbar/index.ts +++ b/src/components/navbar/index.ts @@ -20,10 +20,7 @@ export class NavbarView extends Gtk.Box { GTypeName: "NavbarView", Template: "resource:///com/vixalien/muzika/ui/components/navbar/index.ui", - InternalChildren: [ - "search", - "list_view", - ], + InternalChildren: ["search", "list_view"], Signals: { activated: { param_types: [GObject.TYPE_STRING], @@ -42,8 +39,8 @@ export class NavbarView extends Gtk.Box { private filter_model = Gtk.FilterListModel.new( this.model, Gtk.CustomFilter.new((obj: GObject.Object) => { - const button = - (obj as ObjectContainer).object; + const button = (obj as ObjectContainer) + .object; const logged_in = get_option("auth").has_token(); @@ -110,9 +107,8 @@ export class NavbarView extends Gtk.Box { list_view: Gtk.ListView, list_header: Gtk.ListHeader, ) { - const item = list_header.item as ObjectContainer< - NavbarButtonContructorProperties - >; + const item = + list_header.item as ObjectContainer; if (!item?.object.title) return; @@ -121,9 +117,8 @@ export class NavbarView extends Gtk.Box { } private header_bind_cb(list_view: Gtk.ListView, list_header: Gtk.ListHeader) { - const item = list_header.item as ObjectContainer< - NavbarButtonContructorProperties - >; + const item = + list_header.item as ObjectContainer; if (item?.object.title) { const object = item.object; @@ -239,7 +234,8 @@ export class NavbarView extends Gtk.Box { }); }), ); - }).catch((err) => { + }) + .catch((err) => { this.clear_playlists(); throw err; @@ -260,10 +256,7 @@ export class NavbarView extends Gtk.Box { uri = `muzika:search:${encodeURIComponent(query)}`; } - this.activate_action( - "navigator.visit", - GLib.Variant.new_string(uri), - ); + this.activate_action("navigator.visit", GLib.Variant.new_string(uri)); this.emit("searched"); } @@ -308,33 +301,40 @@ export class NavbarView extends Gtk.Box { } export class NavbarListStore< - T extends NavbarButtonContructorProperties = NavbarButtonContructorProperties, -> extends GObject.Object implements Gio.ListModel { + T extends + NavbarButtonContructorProperties = NavbarButtonContructorProperties, + > + extends GObject.Object + implements Gio.ListModel +{ static { - GObject.registerClass({ - GTypeName: "NavbarListStore", - Properties: { - item_type: GObject.ParamSpec.uint64( - "item-type", - "Item Type", - "The type of the items in the list", - GObject.ParamFlags.READWRITE, - 0, - Number.MAX_SAFE_INTEGER, - 0, - ), - n_items: GObject.ParamSpec.uint64( - "n-items", - "Number of Items", - "The number of items in the list", - GObject.ParamFlags.READABLE, - 0, - Number.MAX_SAFE_INTEGER, - 0, - ), + GObject.registerClass( + { + GTypeName: "NavbarListStore", + Properties: { + item_type: GObject.ParamSpec.uint64( + "item-type", + "Item Type", + "The type of the items in the list", + GObject.ParamFlags.READWRITE, + 0, + Number.MAX_SAFE_INTEGER, + 0, + ), + n_items: GObject.ParamSpec.uint64( + "n-items", + "Number of Items", + "The number of items in the list", + GObject.ParamFlags.READABLE, + 0, + Number.MAX_SAFE_INTEGER, + 0, + ), + }, + Implements: [Gio.ListModel, Gtk.SectionModel], }, - Implements: [Gio.ListModel, Gtk.SectionModel], - }, this); + this, + ); } private array = new Array>(); @@ -379,9 +379,7 @@ export class NavbarListStore< return ObjectContainer.$gtype; } - find( - fn: (item: ObjectContainer) => boolean, - ): number | null { + find(fn: (item: ObjectContainer) => boolean): number | null { const index = this.array.findIndex(fn); return index === -1 ? null : index; @@ -409,11 +407,7 @@ export class NavbarListStore< this.array.forEach(fn); } - splice( - position: number, - removed: number, - added: ObjectContainer[], - ): void { + splice(position: number, removed: number, added: ObjectContainer[]): void { this.array.splice(position, removed, ...added); this.items_changed(position, removed, added.length); @@ -438,11 +432,12 @@ export class NavbarListStore< } vfunc_get_section(position: number) { - const first_index = position === 0 - ? 0 - : this.array.findLastIndex((container, index) => { - return index <= position && container.object.title; - }); + const first_index = + position === 0 + ? 0 + : this.array.findLastIndex((container, index) => { + return index <= position && container.object.title; + }); const last_index = this.array.findIndex((container, index) => { return index > position && container.object.title; }); diff --git a/src/components/navbar/title.ts b/src/components/navbar/title.ts index 2df30bd9..db000fc5 100644 --- a/src/components/navbar/title.ts +++ b/src/components/navbar/title.ts @@ -6,14 +6,10 @@ export class NavbarTitle extends Gtk.Box { GObject.registerClass( { GTypeName: "NavbarTitle", - Template: "resource:///com/vixalien/muzika/ui/components/navbar/title.ui", - InternalChildren: [ - "label", - "action", - ], - Implements: [ - Gtk.Buildable, - ], + Template: + "resource:///com/vixalien/muzika/ui/components/navbar/title.ui", + InternalChildren: ["label", "action"], + Implements: [Gtk.Buildable], Properties: { action: GObject.ParamSpec.object( "action", diff --git a/src/components/paginator.ts b/src/components/paginator.ts index d73be19e..2f96e27e 100644 --- a/src/components/paginator.ts +++ b/src/components/paginator.ts @@ -3,34 +3,33 @@ import GObject from "gi://GObject"; export class Paginator extends Gtk.Revealer { static { - GObject.registerClass({ - GTypeName: "Paginator", - Template: "resource:///com/vixalien/muzika/ui/components/paginator.ui", - InternalChildren: [ - "stack", - "button", - "spinner", - ], - Signals: { - "activate": {}, + GObject.registerClass( + { + GTypeName: "Paginator", + Template: "resource:///com/vixalien/muzika/ui/components/paginator.ui", + InternalChildren: ["stack", "button", "spinner"], + Signals: { + activate: {}, + }, + Properties: { + loading: GObject.ParamSpec.boolean( + "loading", + "Loading", + "Whether the button is loading", + GObject.ParamFlags.READWRITE, + false, + ), + "can-paginate": GObject.ParamSpec.boolean( + "can-paginate", + "Can Paginate", + "Whether the content can be paginated and the paginator is visible", + GObject.ParamFlags.READWRITE, + false, + ), + }, }, - Properties: { - "loading": GObject.ParamSpec.boolean( - "loading", - "Loading", - "Whether the button is loading", - GObject.ParamFlags.READWRITE, - false, - ), - "can-paginate": GObject.ParamSpec.boolean( - "can-paginate", - "Can Paginate", - "Whether the content can be paginated and the paginator is visible", - GObject.ParamFlags.READWRITE, - false, - ), - }, - }, this); + this, + ); } _stack!: Gtk.Stack; diff --git a/src/components/player/full.ts b/src/components/player/full.ts index 23c3bbe1..eab22549 100644 --- a/src/components/player/full.ts +++ b/src/components/player/full.ts @@ -18,23 +18,27 @@ GObject.type_ensure(PlayerPreview.$gtype); export class FullPlayerView extends Gtk.ActionBar { static { - GObject.registerClass({ - GTypeName: "FullPlayerView", - Template: "resource:///com/vixalien/muzika/ui/components/player/full.ui", - InternalChildren: [ - "title", - "subtitle", - "shuffle_button", - "prev_button", - "play_image", - "next_button", - "repeat_button", - "progress_label", - "duration_label", - "volume_button", - "scale_and_timer", - ], - }, this); + GObject.registerClass( + { + GTypeName: "FullPlayerView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/full.ui", + InternalChildren: [ + "title", + "subtitle", + "shuffle_button", + "prev_button", + "play_image", + "next_button", + "repeat_button", + "progress_label", + "duration_label", + "volume_button", + "scale_and_timer", + ], + }, + this, + ); } _title!: Gtk.Label; @@ -74,7 +78,7 @@ export class FullPlayerView extends Gtk.ActionBar { const song = this.player.queue.current?.object; if (song) { - this.show_song(song!); + this.show_song(song); } } @@ -90,9 +94,7 @@ export class FullPlayerView extends Gtk.ActionBar { this.song_changed.bind(this), ); - this.listeners.add_bindings( - bind_play_icon(this._play_image), - ); + this.listeners.add_bindings(bind_play_icon(this._play_image)); this.listeners.connect(this.player, "notify::duration", () => { this._duration_label.label = micro_to_string(this.player.duration); @@ -100,9 +102,7 @@ export class FullPlayerView extends Gtk.ActionBar { // buttons - this.listeners.add_bindings( - ...bind_repeat_button(this._repeat_button), - ); + this.listeners.add_bindings(...bind_repeat_button(this._repeat_button)); // setting up volume button @@ -116,18 +116,22 @@ export class FullPlayerView extends Gtk.ActionBar { this.player.cubic_volume = this._volume_button.adjustment.value; }); - this.listeners.connect(this._volume_button, "query-tooltip", ( - _widget: Gtk.VolumeButton, - _x: number, - _y: number, - _keyboard_mode: boolean, - tooltip: Gtk.Tooltip, - ) => { - tooltip.set_text( - `${Math.round(this._volume_button.adjustment.value * 100)}%`, - ); - return true; - }); + this.listeners.connect( + this._volume_button, + "query-tooltip", + ( + _widget: Gtk.VolumeButton, + _x: number, + _y: number, + _keyboard_mode: boolean, + tooltip: Gtk.Tooltip, + ) => { + tooltip.set_text( + `${Math.round(this._volume_button.adjustment.value * 100)}%`, + ); + return true; + }, + ); this.listeners.connect(this.player, "notify::timestamp", () => { this._progress_label.label = micro_to_string(this.player.timestamp); @@ -147,9 +151,9 @@ export class FullPlayerView extends Gtk.ActionBar { if (track.album) { this._title.set_markup( - `${ - escape_label(track.title) - }`, + `${escape_label( + track.title, + )}`, ); this._title.tooltip_text = track.title; } else { diff --git a/src/components/player/lyrics.ts b/src/components/player/lyrics.ts index fbb524a1..1871e214 100644 --- a/src/components/player/lyrics.ts +++ b/src/components/player/lyrics.ts @@ -15,9 +15,12 @@ type LyricLine = TimedLyrics["timed_lyrics"][number]; export class TimedLyricLineRow extends Gtk.ListBoxRow { static { - GObject.registerClass({ - GTypeName: "TimedLyricLineRow", - }, this); + GObject.registerClass( + { + GTypeName: "TimedLyricLineRow", + }, + this, + ); } line: LyricLine; @@ -38,21 +41,24 @@ export class TimedLyricLineRow extends Gtk.ListBoxRow { export class LyricsView extends Gtk.Stack { static { - GObject.registerClass({ - GTypeName: "LyricsView", - Template: - "resource:///com/vixalien/muzika/ui/components/player/lyrics.ui", - InternalChildren: [ - "no_lyrics", - "loading", - "lyrics_window", - "view", - "buffer", - "timed_window", - "timed_listbox", - "timed_source", - ], - }, this); + GObject.registerClass( + { + GTypeName: "LyricsView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/lyrics.ui", + InternalChildren: [ + "no_lyrics", + "loading", + "lyrics_window", + "view", + "buffer", + "timed_window", + "timed_listbox", + "timed_source", + ], + }, + this, + ); } private _no_lyrics!: Adw.StatusPage; @@ -98,18 +104,21 @@ export class LyricsView extends Gtk.Stack { await get_lyrics(new_lyrics, { signal: this.controller.signal, - }).then((lyrics) => { - this.loaded_lyrics = new_lyrics; - this.show_lyrics(lyrics); - }).catch((err) => { - if (err.name === "AbortError") { - return; - } else { - throw err; - } - }).finally(() => { - this._loading.stop(); - }); + }) + .then((lyrics) => { + this.loaded_lyrics = new_lyrics; + this.show_lyrics(lyrics); + }) + .catch((err) => { + if (err.name === "AbortError") { + return; + } else { + throw err; + } + }) + .finally(() => { + this._loading.stop(); + }); } else { this.loaded_lyrics = null; this.set_visible_child(this._no_lyrics); @@ -135,7 +144,8 @@ export class LyricsView extends Gtk.Stack { this.clear_views(); if ( - lyrics.timed && Gtk.Settings.get_default()!.gtk_enable_animations === true + lyrics.timed && + Gtk.Settings.get_default()!.gtk_enable_animations === true ) { lyrics.timed_lyrics.forEach((line) => { const row = new TimedLyricLineRow(line); @@ -161,12 +171,8 @@ export class LyricsView extends Gtk.Stack { private pending_animation: Adw.Animation | null = null; - private scroll_to_row( - _: Gtk.ListBox, - row: Gtk.ListBoxRow, - force = false, - ) { - if (((this.get_state_flags() & Gtk.StateFlags.ACTIVE) !== 0) && !force) { + private scroll_to_row(_: Gtk.ListBox, row: Gtk.ListBoxRow, force = false) { + if ((this.get_state_flags() & Gtk.StateFlags.ACTIVE) !== 0 && !force) { return; } @@ -183,9 +189,7 @@ export class LyricsView extends Gtk.Stack { const scroll_to = rect.get_y() - 180; // don't scroll if the scroll value is near the target (in one direction) - if ( - Math.abs(scroll_to - this._timed_window.vadjustment.value) < 40 - ) { + if (Math.abs(scroll_to - this._timed_window.vadjustment.value) < 40) { return; } @@ -202,7 +206,7 @@ export class LyricsView extends Gtk.Stack { property_target, ); - let id = animation.connect("done", () => { + const id = animation.connect("done", () => { this.pending_animation = null; animation.disconnect(id); }); @@ -213,10 +217,7 @@ export class LyricsView extends Gtk.Stack { } } - private lyrics_row_activated( - _: Gtk.ListBox, - row: TimedLyricLineRow, - ) { + private lyrics_row_activated(_: Gtk.ListBox, row: TimedLyricLineRow) { const player = get_player(); player.seek(row.line.start * 1000 + 1); @@ -249,8 +250,8 @@ export class LyricsView extends Gtk.Stack { } const line_id = this.lyrics.timed_lyrics.findIndex((line) => { - const timestamp_milli = (player.timestamp / 1000) + - LyricsView.ANIMATION_DURATION / 2; + const timestamp_milli = + player.timestamp / 1000 + LyricsView.ANIMATION_DURATION / 2; return timestamp_milli >= line.start && timestamp_milli <= line.end; }); @@ -277,14 +278,10 @@ export class LyricsView extends Gtk.Stack { vfunc_map(): void { super.vfunc_map(); - this.listeners.connect( - this.player.queue, - "notify::current", - () => { - this._loading.start(); - this.set_visible_child(this._loading); - }, - ); + this.listeners.connect(this.player.queue, "notify::current", () => { + this._loading.start(); + this.set_visible_child(this._loading); + }); this.listeners.connect( this.player.queue, diff --git a/src/components/player/mini.ts b/src/components/player/mini.ts index dc345475..5321b69d 100644 --- a/src/components/player/mini.ts +++ b/src/components/player/mini.ts @@ -12,15 +12,15 @@ import { bind_play_icon } from "src/player/helpers.js"; export class MiniPlayerView extends Gtk.Overlay { static { - GObject.registerClass({ - GTypeName: "MiniPlayerView", - Template: "resource:///com/vixalien/muzika/ui/components/player/mini.ui", - InternalChildren: [ - "title", - "subtitle", - "play_button", - ], - }, this); + GObject.registerClass( + { + GTypeName: "MiniPlayerView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/mini.ui", + InternalChildren: ["title", "subtitle", "play_button"], + }, + this, + ); } private _title!: Gtk.Label; @@ -45,7 +45,7 @@ export class MiniPlayerView extends Gtk.Overlay { const song = this.player.queue.current?.object; if (song) { - this.show_song(song!); + this.show_song(song); } } @@ -61,9 +61,7 @@ export class MiniPlayerView extends Gtk.Overlay { this.song_changed.bind(this), ); - this.listeners.add_bindings( - bind_play_icon(this._play_button), - ); + this.listeners.add_bindings(bind_play_icon(this._play_button)); this.listeners.connect(this.player, "notify::duration", () => { this.progress_bar.set_duration(this.player.duration); diff --git a/src/components/player/now-playing/details.ts b/src/components/player/now-playing/details.ts index 4e541a0f..15b08db0 100644 --- a/src/components/player/now-playing/details.ts +++ b/src/components/player/now-playing/details.ts @@ -14,41 +14,44 @@ GObject.type_ensure(RelatedView.$gtype); export class PlayerNowPlayingDetails extends Adw.NavigationPage { static { - GObject.registerClass({ - GTypeName: "PlayerNowPlayingDetails", - Template: - "resource:///com/vixalien/muzika/ui/components/player/now-playing/details.ui", - Properties: { - stack: GObject.param_spec_object( + GObject.registerClass( + { + GTypeName: "PlayerNowPlayingDetails", + Template: + "resource:///com/vixalien/muzika/ui/components/player/now-playing/details.ui", + Properties: { + stack: GObject.param_spec_object( + "stack", + "Stack", + "The View Stack", + Adw.ViewStack.$gtype, + GObject.ParamFlags.READABLE, + ), + header_title: GObject.param_spec_object( + "header-title", + "Header Title Widget", + "The widget to show as the header title", + Gtk.Widget.$gtype, + GObject.ParamFlags.READWRITE, + ), + show_mini_player: GObject.param_spec_boolean( + "show-mini-player", + "Show Mini Player", + "Whether to show the mini player", + false, + GObject.ParamFlags.READWRITE, + ), + }, + InternalChildren: [ "stack", - "Stack", - "The View Stack", - Adw.ViewStack.$gtype, - GObject.ParamFlags.READABLE, - ), - header_title: GObject.param_spec_object( - "header-title", - "Header Title Widget", - "The widget to show as the header title", - Gtk.Widget.$gtype, - GObject.ParamFlags.READWRITE, - ), - show_mini_player: GObject.param_spec_boolean( - "show-mini-player", - "Show Mini Player", - "Whether to show the mini player", - false, - GObject.ParamFlags.READWRITE, - ), + "headerbar", + "lyrics_page", + "related_page", + "toolbar_view", + ], }, - InternalChildren: [ - "stack", - "headerbar", - "lyrics_page", - "related_page", - "toolbar_view", - ], - }, this); + this, + ); } private _stack!: Adw.ViewStack; diff --git a/src/components/player/now-playing/view.ts b/src/components/player/now-playing/view.ts index b9d7b1a5..1b494d9c 100644 --- a/src/components/player/now-playing/view.ts +++ b/src/components/player/now-playing/view.ts @@ -19,47 +19,50 @@ import { get_button_props } from "src/util/menu/like"; export class PlayerNowPlayingView extends Adw.NavigationPage { static { - GObject.registerClass({ - GTypeName: "PlayerNowPlayingView", - Template: - "resource:///com/vixalien/muzika/ui/components/player/now-playing/view.ui", - InternalChildren: [ - "video_counterpart", - "music_counterpart", - "title", - "subtitle", - "picture", - "timestamp", - "duration", - "play_image", - "overlay_box", - "repeat_button", - "expand_button", - "fullscreen_button", - "switchers", - "like_button", - "dislike_button", - ], - Properties: { - switcher_stack: GObject.param_spec_object( - "switcher-stack", - "Switcher Stack", - "The Stack associated with the switcher", - Adw.ViewStack.$gtype, - GObject.ParamFlags.READWRITE, - ), - switcher_visible: GObject.param_spec_boolean( - "switcher-visible", - "Switcher Visible", - "Whether to show the switcher stack", - false, - GObject.ParamFlags.READWRITE, - ), - }, - Signals: { - "bottom-bar-clicked": {}, + GObject.registerClass( + { + GTypeName: "PlayerNowPlayingView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/now-playing/view.ui", + InternalChildren: [ + "video_counterpart", + "music_counterpart", + "title", + "subtitle", + "picture", + "timestamp", + "duration", + "play_image", + "overlay_box", + "repeat_button", + "expand_button", + "fullscreen_button", + "switchers", + "like_button", + "dislike_button", + ], + Properties: { + switcher_stack: GObject.param_spec_object( + "switcher-stack", + "Switcher Stack", + "The Stack associated with the switcher", + Adw.ViewStack.$gtype, + GObject.ParamFlags.READWRITE, + ), + switcher_visible: GObject.param_spec_boolean( + "switcher-visible", + "Switcher Visible", + "Whether to show the switcher stack", + false, + GObject.ParamFlags.READWRITE, + ), + }, + Signals: { + "bottom-bar-clicked": {}, + }, }, - }, this); + this, + ); } player: MuzikaPlayer; @@ -128,10 +131,11 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { old_child.unparent(); } - (list_model_to_array(stack.pages) as Adw.ViewStackPage[]) - .forEach((page, i) => { + (list_model_to_array(stack.pages) as Adw.ViewStackPage[]).forEach( + (page, i) => { this._switchers.append(this.construct_switcher(stack, i, page)); - }); + }, + ); } private _switcher_stack: Adw.ViewStack | null = null; @@ -166,10 +170,7 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { private activate_link_cb(_: Gtk.Label, uri: string) { if (uri && uri.startsWith("muzika:")) { - this.activate_action( - "navigator.visit", - GLib.Variant.new_string(uri), - ); + this.activate_action("navigator.visit", GLib.Variant.new_string(uri)); return true; } @@ -223,7 +224,7 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { const song = this.player.queue.current?.object; if (song) { - this.show_song(song!); + this.show_song(song); this.update_thumbnail(); } } @@ -258,9 +259,8 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { show_song(track: QueueTrack) { // thumbnail - this._video_counterpart.sensitive = - this._music_counterpart.sensitive = - !!track.counterpart; + this._video_counterpart.sensitive = this._music_counterpart.sensitive = + !!track.counterpart; this._overlay_box.visible = this.player.queue.current_is_video; @@ -276,9 +276,9 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { if (track.album) { this._title.set_markup( - `${ - escape_label(track.title) - }`, + `${escape_label( + track.title, + )}`, ); this._title.tooltip_text = track.title; } else { diff --git a/src/components/player/preview.ts b/src/components/player/preview.ts index 82bd4cec..e7676064 100644 --- a/src/components/player/preview.ts +++ b/src/components/player/preview.ts @@ -16,29 +16,29 @@ GObject.type_ensure(FixedRatioThumbnail.$gtype); export class PlayerPreview extends Gtk.Stack { static { - GObject.registerClass({ - GTypeName: "PlayerPreview", - Template: - "resource:///com/vixalien/muzika/ui/components/player/preview.ui", - InternalChildren: [ - "image", - "picture", - ], - Properties: { - size: GObject.ParamSpec.int( - "size", - "Size", - "Size", - GObject.ParamFlags.READWRITE, - 0, - GLib.MAXINT32, - 0, - ), + GObject.registerClass( + { + GTypeName: "PlayerPreview", + Template: + "resource:///com/vixalien/muzika/ui/components/player/preview.ui", + InternalChildren: ["image", "picture"], + Properties: { + size: GObject.ParamSpec.int( + "size", + "Size", + "Size", + GObject.ParamFlags.READWRITE, + 0, + GLib.MAXINT32, + 0, + ), + }, + Signals: { + activate: {}, + }, }, - Signals: { - activate: {}, - }, - }, this); + this, + ); } private _image!: Gtk.Image; diff --git a/src/components/player/progress.ts b/src/components/player/progress.ts index efe08fcc..10077252 100644 --- a/src/components/player/progress.ts +++ b/src/components/player/progress.ts @@ -4,44 +4,47 @@ import Adw from "gi://Adw"; export class PlayerProgressBar extends Gtk.ProgressBar { static { - GObject.registerClass({ - GTypeName: "PlayerProgressBar", - Properties: { - duration: GObject.ParamSpec.double( - "duration", - "Duration", - "Duration in nanoseconds", - GObject.ParamFlags.READABLE, - 0, - Number.MAX_SAFE_INTEGER, - 0, - ), - value: GObject.ParamSpec.double( - "value", - "Value", - "Value in nanoseconds", - GObject.ParamFlags.READWRITE, - 0, - Number.MAX_SAFE_INTEGER, - 0, - ), - buffering: GObject.ParamSpec.boolean( - "buffering", - "Buffering", - "Whether the player is buffering", - GObject.ParamFlags.READWRITE, - false, - ), - animation: GObject.ParamSpec.object( - "animation", - "Animation", - "The animation object", - GObject.ParamFlags.READWRITE, - Adw.TimedAnimation, - ), + GObject.registerClass( + { + GTypeName: "PlayerProgressBar", + Properties: { + duration: GObject.ParamSpec.double( + "duration", + "Duration", + "Duration in nanoseconds", + GObject.ParamFlags.READABLE, + 0, + Number.MAX_SAFE_INTEGER, + 0, + ), + value: GObject.ParamSpec.double( + "value", + "Value", + "Value in nanoseconds", + GObject.ParamFlags.READWRITE, + 0, + Number.MAX_SAFE_INTEGER, + 0, + ), + buffering: GObject.ParamSpec.boolean( + "buffering", + "Buffering", + "Whether the player is buffering", + GObject.ParamFlags.READWRITE, + false, + ), + animation: GObject.ParamSpec.object( + "animation", + "Animation", + "The animation object", + GObject.ParamFlags.READWRITE, + Adw.TimedAnimation, + ), + }, + Signals: {}, }, - Signals: {}, - }, this); + this, + ); } constructor() { diff --git a/src/components/player/queue.ts b/src/components/player/queue.ts index e6ffb80a..161d5c56 100644 --- a/src/components/player/queue.ts +++ b/src/components/player/queue.ts @@ -13,18 +13,22 @@ import { setup_link_label } from "src/util/label"; export class QueueView extends Gtk.Stack { static { - GObject.registerClass({ - GTypeName: "QueueView", - Template: "resource:///com/vixalien/muzika/ui/components/player/queue.ui", - InternalChildren: [ - "no_queue", - "list_view", - "queue_box", - "playlist_label", - "params", - "params_box", - ], - }, this); + GObject.registerClass( + { + GTypeName: "QueueView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/queue.ui", + InternalChildren: [ + "no_queue", + "list_view", + "queue_box", + "playlist_label", + "params", + "params_box", + ], + }, + this, + ); } private _list_view!: Gtk.ListView; @@ -85,9 +89,8 @@ export class QueueView extends Gtk.Stack { } update_visible_child() { - this.visible_child = this.player.queue.list.n_items > 0 - ? this._queue_box - : this._no_queue; + this.visible_child = + this.player.queue.list.n_items > 0 ? this._queue_box : this._no_queue; } update_settings() { @@ -96,8 +99,7 @@ export class QueueView extends Gtk.Stack { // radio playlists can't be visited if (settings?.playlistId && !settings.playlistId.startsWith("RDA")) { - this._playlist_label.label = - `${playlist_name}`; + this._playlist_label.label = `${playlist_name}`; } else { this._playlist_label.label = playlist_name; } @@ -108,7 +110,7 @@ export class QueueView extends Gtk.Stack { let first_param: Gtk.Widget | null = null; - while (first_param = this._params_box.get_first_child()) { + while ((first_param = this._params_box.get_first_child())) { this._params_box.remove(first_param); } @@ -144,7 +146,7 @@ export class QueueView extends Gtk.Stack { } bind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { - const container = list_item.get_item() as ObjectContainer; + const container = list_item.get_item(); const track = container.object; const card = new QueueItem(); diff --git a/src/components/player/queueitem.ts b/src/components/player/queueitem.ts index d03bdb4d..de93454f 100644 --- a/src/components/player/queueitem.ts +++ b/src/components/player/queueitem.ts @@ -9,17 +9,15 @@ import { setup_link_label } from "src/util/label.js"; export class QueueItem extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "QueueItem", - Template: - "resource:///com/vixalien/muzika/ui/components/player/queueitem.ui", - InternalChildren: [ - "image", - "title", - "explicit", - "subtitle", - ], - }, this); + GObject.registerClass( + { + GTypeName: "QueueItem", + Template: + "resource:///com/vixalien/muzika/ui/components/player/queueitem.ui", + InternalChildren: ["image", "title", "explicit", "subtitle"], + }, + this, + ); } item?: QueueTrack; diff --git a/src/components/player/related.ts b/src/components/player/related.ts index 5e5e94f5..08fe0ae5 100644 --- a/src/components/player/related.ts +++ b/src/components/player/related.ts @@ -15,17 +15,15 @@ export interface RelatedViewOptions { export class RelatedView extends Gtk.Stack { static { - GObject.registerClass({ - GTypeName: "RelatedView", - Template: - "resource:///com/vixalien/muzika/ui/components/player/related.ui", - InternalChildren: [ - "no_related", - "loading", - "related_window", - "box", - ], - }, this); + GObject.registerClass( + { + GTypeName: "RelatedView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/related.ui", + InternalChildren: ["no_related", "loading", "related_window", "box"], + }, + this, + ); } _no_related!: Adw.StatusPage; @@ -65,34 +63,37 @@ export class RelatedView extends Gtk.Stack { await get_song_related(new_related, { signal: this.controller.signal, - }).then((result) => { - let child: Gtk.Widget | null = null; - - while (child = this._box.get_first_child()) { - this._box.remove(child); - } - - for (const content of result) { - const carousel = new Carousel(); - carousel.show_content(content); - this._box.append(carousel); - - const spacer = new Gtk.Separator(); - spacer.add_css_class("spacer"); - this._box.append(spacer); - } - - this.loaded_related = new_related; - this.set_visible_child(this._related_window); - }).catch((err) => { - if (err.name === "AbortError") { - return; - } else { - throw err; - } - }).finally(() => { - this._loading.stop(); - }); + }) + .then((result) => { + let child: Gtk.Widget | null = null; + + while ((child = this._box.get_first_child())) { + this._box.remove(child); + } + + for (const content of result) { + const carousel = new Carousel(); + carousel.show_content(content); + this._box.append(carousel); + + const spacer = new Gtk.Separator(); + spacer.add_css_class("spacer"); + this._box.append(spacer); + } + + this.loaded_related = new_related; + this.set_visible_child(this._related_window); + }) + .catch((err) => { + if (err.name === "AbortError") { + return; + } else { + throw err; + } + }) + .finally(() => { + this._loading.stop(); + }); } else { this.loaded_related = null; this.set_visible_child(this._no_related); @@ -104,14 +105,10 @@ export class RelatedView extends Gtk.Stack { vfunc_map(): void { super.vfunc_map(); - this.listeners.connect( - this.player.queue, - "notify::current", - () => { - this._loading.start(); - this.set_visible_child(this._loading); - }, - ); + this.listeners.connect(this.player.queue, "notify::current", () => { + this._loading.start(); + this.set_visible_child(this._loading); + }); this.listeners.connect( this.player.queue, diff --git a/src/components/player/scale.ts b/src/components/player/scale.ts index 14e5f551..27f7308f 100644 --- a/src/components/player/scale.ts +++ b/src/components/player/scale.ts @@ -7,24 +7,27 @@ import { get_player } from "src/application"; export class PlayerScale extends Gtk.Scale { static { - GObject.registerClass({ - GTypeName: "PlayerScale", - Properties: { - buffering: GObject.ParamSpec.boolean( - "buffering", - "Buffering", - "Whether the player is buffering", - GObject.ParamFlags.READWRITE, - false, - ), - }, - Signals: { - // this signal is deprecated - "user-changed-value": { - param_types: [GObject.TYPE_DOUBLE], + GObject.registerClass( + { + GTypeName: "PlayerScale", + Properties: { + buffering: GObject.ParamSpec.boolean( + "buffering", + "Buffering", + "Whether the player is buffering", + GObject.ParamFlags.READWRITE, + false, + ), + }, + Signals: { + // this signal is deprecated + "user-changed-value": { + param_types: [GObject.TYPE_DOUBLE], + }, }, }, - }, this); + this, + ); } constructor() { diff --git a/src/components/player/video/controls.ts b/src/components/player/video/controls.ts index 8fb4314f..c52e4df1 100644 --- a/src/components/player/video/controls.ts +++ b/src/components/player/video/controls.ts @@ -11,32 +11,31 @@ GObject.type_ensure(FullVideoControls.$gtype); export class VideoControls extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "VideoControls", - Template: - "resource:///com/vixalien/muzika/ui/components/player/video/controls.ui", - InternalChildren: [ - "stack", - "mini", - "full", - ], - Properties: { - "show-mini": GObject.ParamSpec.boolean( - "show-mini", - "Show Mini", - "Show the minimal video player", - GObject.ParamFlags.READWRITE, - true, - ), - "inhibit-hide": GObject.ParamSpec.boolean( - "inhibit-hide", - "Inhibit Hide", - "Inhibit the hiding of the controls, for example when the mouse is over them.", - GObject.ParamFlags.READWRITE, - true, - ), + GObject.registerClass( + { + GTypeName: "VideoControls", + Template: + "resource:///com/vixalien/muzika/ui/components/player/video/controls.ui", + InternalChildren: ["stack", "mini", "full"], + Properties: { + "show-mini": GObject.ParamSpec.boolean( + "show-mini", + "Show Mini", + "Show the minimal video player", + GObject.ParamFlags.READWRITE, + true, + ), + "inhibit-hide": GObject.ParamSpec.boolean( + "inhibit-hide", + "Inhibit Hide", + "Inhibit the hiding of the controls, for example when the mouse is over them.", + GObject.ParamFlags.READWRITE, + true, + ), + }, }, - }, this); + this, + ); } private _stack!: Gtk.Stack; diff --git a/src/components/player/video/full.ts b/src/components/player/video/full.ts index fd315e5b..c0c5ec96 100644 --- a/src/components/player/video/full.ts +++ b/src/components/player/video/full.ts @@ -12,27 +12,30 @@ import { bind_play_icon } from "src/player/helpers"; export class FullVideoControls extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "FullVideoControls", - Template: - "resource:///com/vixalien/muzika/ui/components/player/video/full.ui", - InternalChildren: [ - "play_button", - "progress_label", - "duration_label", - "scale", - "menu_button", - ], - Properties: { - "inhibit-hide": GObject.ParamSpec.boolean( - "inhibit-hide", - "Inhibit Hide", - "Inhibit the hiding of the controls, for example when the mouse is over them.", - GObject.ParamFlags.READWRITE, - true, - ), + GObject.registerClass( + { + GTypeName: "FullVideoControls", + Template: + "resource:///com/vixalien/muzika/ui/components/player/video/full.ui", + InternalChildren: [ + "play_button", + "progress_label", + "duration_label", + "scale", + "menu_button", + ], + Properties: { + "inhibit-hide": GObject.ParamSpec.boolean( + "inhibit-hide", + "Inhibit Hide", + "Inhibit the hiding of the controls, for example when the mouse is over them.", + GObject.ParamFlags.READWRITE, + true, + ), + }, }, - }, this); + this, + ); } private _play_button!: Gtk.Button; @@ -55,7 +58,8 @@ export class FullVideoControls extends Adw.Bin { this._duration_label.label = track.duration_seconds ? seconds_to_string(track.duration_seconds) : track.duration ?? "00:00"; - {} + { + } } } @@ -95,39 +99,25 @@ export class FullVideoControls extends Adw.Bin { this.media_info_changed.bind(this), ); - this.listeners.add_bindings( - bind_play_icon(this._play_button), - ); + this.listeners.add_bindings(bind_play_icon(this._play_button)); this._duration_label.label = micro_to_string(player.duration); - this.listeners.connect( - player, - "notify::duration", - () => { - this._duration_label.label = micro_to_string(player.duration); - }, - ); + this.listeners.connect(player, "notify::duration", () => { + this._duration_label.label = micro_to_string(player.duration); + }); // buttons // this.setup_volume_button(); - this.listeners.connect( - player, - "notify::timestamp", - () => { - this._progress_label.label = micro_to_string(player.timestamp); - }, - ); + this.listeners.connect(player, "notify::timestamp", () => { + this._progress_label.label = micro_to_string(player.timestamp); + }); - this.listeners.connect( - this._menu_button, - "notify::active", - () => { - this.inhibit_hide = this._menu_button.active; - }, - ); + this.listeners.connect(this._menu_button, "notify::active", () => { + this.inhibit_hide = this._menu_button.active; + }); } clear_listeners() { diff --git a/src/components/player/video/languages.ts b/src/components/player/video/languages.ts index d95898ea..429f5192 100644 --- a/src/components/player/video/languages.ts +++ b/src/components/player/video/languages.ts @@ -1,502 +1,502 @@ export const languages = [ { - "code": "af", - "name": "Afrikaans", + code: "af", + name: "Afrikaans", }, { - "code": "ak", - "name": "Akan", + code: "ak", + name: "Akan", }, { - "code": "sq", - "name": "Albanian", + code: "sq", + name: "Albanian", }, { - "code": "am", - "name": "Amharic", + code: "am", + name: "Amharic", }, { - "code": "ar", - "name": "Arabic", + code: "ar", + name: "Arabic", }, { - "code": "hy", - "name": "Armenian", + code: "hy", + name: "Armenian", }, { - "code": "as", - "name": "Assamese", + code: "as", + name: "Assamese", }, { - "code": "ay", - "name": "Aymara", + code: "ay", + name: "Aymara", }, { - "code": "az", - "name": "Azerbaijani", + code: "az", + name: "Azerbaijani", }, { - "code": "bn", - "name": "Bangla", + code: "bn", + name: "Bangla", }, { - "code": "eu", - "name": "Basque", + code: "eu", + name: "Basque", }, { - "code": "be", - "name": "Belarusian", + code: "be", + name: "Belarusian", }, { - "code": "bho", - "name": "Bhojpuri", + code: "bho", + name: "Bhojpuri", }, { - "code": "bs", - "name": "Bosnian", + code: "bs", + name: "Bosnian", }, { - "code": "bg", - "name": "Bulgarian", + code: "bg", + name: "Bulgarian", }, { - "code": "my", - "name": "Burmese", + code: "my", + name: "Burmese", }, { - "code": "ca", - "name": "Catalan", + code: "ca", + name: "Catalan", }, { - "code": "ceb", - "name": "Cebuano", + code: "ceb", + name: "Cebuano", }, { - "code": "zh-Hans", - "name": "Chinese (Simplified)", + code: "zh-Hans", + name: "Chinese (Simplified)", }, { - "code": "zh-Hant", - "name": "Chinese (Traditional)", + code: "zh-Hant", + name: "Chinese (Traditional)", }, { - "code": "co", - "name": "Corsican", + code: "co", + name: "Corsican", }, { - "code": "hr", - "name": "Croatian", + code: "hr", + name: "Croatian", }, { - "code": "cs", - "name": "Czech", + code: "cs", + name: "Czech", }, { - "code": "da", - "name": "Danish", + code: "da", + name: "Danish", }, { - "code": "dv", - "name": "Divehi", + code: "dv", + name: "Divehi", }, { - "code": "nl", - "name": "Dutch", + code: "nl", + name: "Dutch", }, { - "code": "en", - "name": "English", + code: "en", + name: "English", }, { - "code": "eo", - "name": "Esperanto", + code: "eo", + name: "Esperanto", }, { - "code": "et", - "name": "Estonian", + code: "et", + name: "Estonian", }, { - "code": "ee", - "name": "Ewe", + code: "ee", + name: "Ewe", }, { - "code": "fil", - "name": "Filipino", + code: "fil", + name: "Filipino", }, { - "code": "fi", - "name": "Finnish", + code: "fi", + name: "Finnish", }, { - "code": "fr", - "name": "French", + code: "fr", + name: "French", }, { - "code": "gl", - "name": "Galician", + code: "gl", + name: "Galician", }, { - "code": "lg", - "name": "Ganda", + code: "lg", + name: "Ganda", }, { - "code": "ka", - "name": "Georgian", + code: "ka", + name: "Georgian", }, { - "code": "de", - "name": "German", + code: "de", + name: "German", }, { - "code": "el", - "name": "Greek", + code: "el", + name: "Greek", }, { - "code": "gn", - "name": "Guarani", + code: "gn", + name: "Guarani", }, { - "code": "gu", - "name": "Gujarati", + code: "gu", + name: "Gujarati", }, { - "code": "ht", - "name": "Haitian Creole", + code: "ht", + name: "Haitian Creole", }, { - "code": "ha", - "name": "Hausa", + code: "ha", + name: "Hausa", }, { - "code": "haw", - "name": "Hawaiian", + code: "haw", + name: "Hawaiian", }, { - "code": "iw", - "name": "Hebrew", + code: "iw", + name: "Hebrew", }, { - "code": "hi", - "name": "Hindi", + code: "hi", + name: "Hindi", }, { - "code": "hmn", - "name": "Hmong", + code: "hmn", + name: "Hmong", }, { - "code": "hu", - "name": "Hungarian", + code: "hu", + name: "Hungarian", }, { - "code": "is", - "name": "Icelandic", + code: "is", + name: "Icelandic", }, { - "code": "ig", - "name": "Igbo", + code: "ig", + name: "Igbo", }, { - "code": "id", - "name": "Indonesian", + code: "id", + name: "Indonesian", }, { - "code": "ga", - "name": "Irish", + code: "ga", + name: "Irish", }, { - "code": "it", - "name": "Italian", + code: "it", + name: "Italian", }, { - "code": "ja", - "name": "Japanese", + code: "ja", + name: "Japanese", }, { - "code": "jv", - "name": "Javanese", + code: "jv", + name: "Javanese", }, { - "code": "kn", - "name": "Kannada", + code: "kn", + name: "Kannada", }, { - "code": "kk", - "name": "Kazakh", + code: "kk", + name: "Kazakh", }, { - "code": "km", - "name": "Khmer", + code: "km", + name: "Khmer", }, { - "code": "rw", - "name": "Kinyarwanda", + code: "rw", + name: "Kinyarwanda", }, { - "code": "ko", - "name": "Korean", + code: "ko", + name: "Korean", }, { - "code": "kri", - "name": "Krio", + code: "kri", + name: "Krio", }, { - "code": "ku", - "name": "Kurdish", + code: "ku", + name: "Kurdish", }, { - "code": "ky", - "name": "Kyrgyz", + code: "ky", + name: "Kyrgyz", }, { - "code": "lo", - "name": "Lao", + code: "lo", + name: "Lao", }, { - "code": "la", - "name": "Latin", + code: "la", + name: "Latin", }, { - "code": "lv", - "name": "Latvian", + code: "lv", + name: "Latvian", }, { - "code": "ln", - "name": "Lingala", + code: "ln", + name: "Lingala", }, { - "code": "lt", - "name": "Lithuanian", + code: "lt", + name: "Lithuanian", }, { - "code": "lb", - "name": "Luxembourgish", + code: "lb", + name: "Luxembourgish", }, { - "code": "mk", - "name": "Macedonian", + code: "mk", + name: "Macedonian", }, { - "code": "mg", - "name": "Malagasy", + code: "mg", + name: "Malagasy", }, { - "code": "ms", - "name": "Malay", + code: "ms", + name: "Malay", }, { - "code": "ml", - "name": "Malayalam", + code: "ml", + name: "Malayalam", }, { - "code": "mt", - "name": "Maltese", + code: "mt", + name: "Maltese", }, { - "code": "mi", - "name": "Māori", + code: "mi", + name: "Māori", }, { - "code": "mr", - "name": "Marathi", + code: "mr", + name: "Marathi", }, { - "code": "mn", - "name": "Mongolian", + code: "mn", + name: "Mongolian", }, { - "code": "ne", - "name": "Nepali", + code: "ne", + name: "Nepali", }, { - "code": "nso", - "name": "Northern Sotho", + code: "nso", + name: "Northern Sotho", }, { - "code": "no", - "name": "Norwegian", + code: "no", + name: "Norwegian", }, { - "code": "ny", - "name": "Nyanja", + code: "ny", + name: "Nyanja", }, { - "code": "or", - "name": "Odia", + code: "or", + name: "Odia", }, { - "code": "om", - "name": "Oromo", + code: "om", + name: "Oromo", }, { - "code": "ps", - "name": "Pashto", + code: "ps", + name: "Pashto", }, { - "code": "fa", - "name": "Persian", + code: "fa", + name: "Persian", }, { - "code": "pl", - "name": "Polish", + code: "pl", + name: "Polish", }, { - "code": "pt", - "name": "Portuguese", + code: "pt", + name: "Portuguese", }, { - "code": "pa", - "name": "Punjabi", + code: "pa", + name: "Punjabi", }, { - "code": "qu", - "name": "Quechua", + code: "qu", + name: "Quechua", }, { - "code": "ro", - "name": "Romanian", + code: "ro", + name: "Romanian", }, { - "code": "ru", - "name": "Russian", + code: "ru", + name: "Russian", }, { - "code": "sm", - "name": "Samoan", + code: "sm", + name: "Samoan", }, { - "code": "sa", - "name": "Sanskrit", + code: "sa", + name: "Sanskrit", }, { - "code": "gd", - "name": "Scottish Gaelic", + code: "gd", + name: "Scottish Gaelic", }, { - "code": "sr", - "name": "Serbian", + code: "sr", + name: "Serbian", }, { - "code": "sn", - "name": "Shona", + code: "sn", + name: "Shona", }, { - "code": "sd", - "name": "Sindhi", + code: "sd", + name: "Sindhi", }, { - "code": "si", - "name": "Sinhala", + code: "si", + name: "Sinhala", }, { - "code": "sk", - "name": "Slovak", + code: "sk", + name: "Slovak", }, { - "code": "sl", - "name": "Slovenian", + code: "sl", + name: "Slovenian", }, { - "code": "so", - "name": "Somali", + code: "so", + name: "Somali", }, { - "code": "st", - "name": "Southern Sotho", + code: "st", + name: "Southern Sotho", }, { - "code": "es", - "name": "Spanish", + code: "es", + name: "Spanish", }, { - "code": "su", - "name": "Sundanese", + code: "su", + name: "Sundanese", }, { - "code": "sw", - "name": "Swahili", + code: "sw", + name: "Swahili", }, { - "code": "sv", - "name": "Swedish", + code: "sv", + name: "Swedish", }, { - "code": "tg", - "name": "Tajik", + code: "tg", + name: "Tajik", }, { - "code": "ta", - "name": "Tamil", + code: "ta", + name: "Tamil", }, { - "code": "tt", - "name": "Tatar", + code: "tt", + name: "Tatar", }, { - "code": "te", - "name": "Telugu", + code: "te", + name: "Telugu", }, { - "code": "th", - "name": "Thai", + code: "th", + name: "Thai", }, { - "code": "ti", - "name": "Tigrinya", + code: "ti", + name: "Tigrinya", }, { - "code": "ts", - "name": "Tsonga", + code: "ts", + name: "Tsonga", }, { - "code": "tr", - "name": "Turkish", + code: "tr", + name: "Turkish", }, { - "code": "tk", - "name": "Turkmen", + code: "tk", + name: "Turkmen", }, { - "code": "uk", - "name": "Ukrainian", + code: "uk", + name: "Ukrainian", }, { - "code": "ur", - "name": "Urdu", + code: "ur", + name: "Urdu", }, { - "code": "ug", - "name": "Uyghur", + code: "ug", + name: "Uyghur", }, { - "code": "uz", - "name": "Uzbek", + code: "uz", + name: "Uzbek", }, { - "code": "vi", - "name": "Vietnamese", + code: "vi", + name: "Vietnamese", }, { - "code": "cy", - "name": "Welsh", + code: "cy", + name: "Welsh", }, { - "code": "fy", - "name": "Western Frisian", + code: "fy", + name: "Western Frisian", }, { - "code": "xh", - "name": "Xhosa", + code: "xh", + name: "Xhosa", }, { - "code": "yi", - "name": "Yiddish", + code: "yi", + name: "Yiddish", }, { - "code": "yo", - "name": "Yoruba", + code: "yo", + name: "Yoruba", }, { - "code": "zu", - "name": "Zulu", + code: "zu", + name: "Zulu", }, ]; diff --git a/src/components/player/video/mini.ts b/src/components/player/video/mini.ts index fd37867e..e5838862 100644 --- a/src/components/player/video/mini.ts +++ b/src/components/player/video/mini.ts @@ -11,26 +11,29 @@ import { bind_play_icon } from "src/player/helpers"; export class MiniVideoControls extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "MiniVideoControls", - Template: - "resource:///com/vixalien/muzika/ui/components/player/video/mini.ui", - InternalChildren: [ - "play_button", - "progress_label", - "duration_label", - "menu_button", - ], - Properties: { - "inhibit-hide": GObject.ParamSpec.boolean( - "inhibit-hide", - "Inhibit Hide", - "Inhibit the hiding of the controls, for example when the mouse is over them.", - GObject.ParamFlags.READWRITE, - true, - ), + GObject.registerClass( + { + GTypeName: "MiniVideoControls", + Template: + "resource:///com/vixalien/muzika/ui/components/player/video/mini.ui", + InternalChildren: [ + "play_button", + "progress_label", + "duration_label", + "menu_button", + ], + Properties: { + "inhibit-hide": GObject.ParamSpec.boolean( + "inhibit-hide", + "Inhibit Hide", + "Inhibit the hiding of the controls, for example when the mouse is over them.", + GObject.ParamFlags.READWRITE, + true, + ), + }, }, - }, this); + this, + ); } private _play_button!: Gtk.Button; @@ -53,7 +56,8 @@ export class MiniVideoControls extends Adw.Bin { this._duration_label.label = track.duration_seconds ? seconds_to_string(track.duration_seconds) : track.duration ?? "00:00"; - {} + { + } } } @@ -93,39 +97,25 @@ export class MiniVideoControls extends Adw.Bin { this.media_info_changed.bind(this), ); - this.listeners.add_bindings( - bind_play_icon(this._play_button), - ); + this.listeners.add_bindings(bind_play_icon(this._play_button)); this._duration_label.label = micro_to_string(player.duration); - this.listeners.connect( - player, - "notify::duration", - () => { - this._duration_label.label = micro_to_string(player.duration); - }, - ); + this.listeners.connect(player, "notify::duration", () => { + this._duration_label.label = micro_to_string(player.duration); + }); // buttons // this.setup_volume_button(); - this.listeners.connect( - player, - "notify::timestamp", - () => { - this._progress_label.label = micro_to_string(player.timestamp); - }, - ); + this.listeners.connect(player, "notify::timestamp", () => { + this._progress_label.label = micro_to_string(player.timestamp); + }); - this.listeners.connect( - this._menu_button, - "notify::active", - () => { - this.inhibit_hide = this._menu_button.active; - }, - ); + this.listeners.connect(this._menu_button, "notify::active", () => { + this.inhibit_hide = this._menu_button.active; + }); } clear_listeners() { diff --git a/src/components/player/video/util.ts b/src/components/player/video/util.ts index 1a029ee0..9c4a9d8a 100644 --- a/src/components/player/video/util.ts +++ b/src/components/player/video/util.ts @@ -54,30 +54,24 @@ export function generate_subtitles_menu( } export function generate_video_menu(song: Song) { - const all_video_formats = [...song.formats, ...song.adaptive_formats] - .filter(format_has_video); + const all_video_formats = [...song.formats, ...song.adaptive_formats].filter( + format_has_video, + ); if (all_video_formats.length === 0) return null; - const qualities = VideoQualities - .filter((quality) => { - return all_video_formats.some((format) => - format.video_quality === quality.value - ); - }); + const qualities = VideoQualities.filter((quality) => { + return all_video_formats.some( + (format) => format.video_quality === quality.value, + ); + }); const menu = Gio.Menu.new(); - menu.append( - _("Auto"), - `player.video-quality("auto")`, - ); + menu.append(_("Auto"), `player.video-quality("auto")`); qualities.forEach((quality) => { - menu.append( - quality.name, - `player.video-quality("${quality.value}")`, - ); + menu.append(quality.name, `player.video-quality("${quality.value}")`); }); return menu; diff --git a/src/components/player/video/view.ts b/src/components/player/video/view.ts index 37525e27..f8a7836b 100644 --- a/src/components/player/video/view.ts +++ b/src/components/player/video/view.ts @@ -10,18 +10,21 @@ GObject.type_ensure(VideoControls.$gtype); export class VideoPlayerView extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "VideoPlayerView", - Template: - "resource:///com/vixalien/muzika/ui/components/player/video/view.ui", - InternalChildren: [ - "picture", - "fullscreen", - "toolbar_view", - "window_title", - "controls", - ], - }, this); + GObject.registerClass( + { + GTypeName: "VideoPlayerView", + Template: + "resource:///com/vixalien/muzika/ui/components/player/video/view.ui", + InternalChildren: [ + "picture", + "fullscreen", + "toolbar_view", + "window_title", + "controls", + ], + }, + this, + ); } private _picture!: Gtk.Picture; @@ -163,24 +166,21 @@ export class VideoPlayerView extends Adw.Bin { private hide_ui() { this.remove_timeout(); - this._toolbar_view.reveal_top_bars = - this._toolbar_view.reveal_bottom_bars = - false; + this._toolbar_view.reveal_top_bars = this._toolbar_view.reveal_bottom_bars = + false; } private show_ui() { this.remove_timeout(); - this._toolbar_view.reveal_top_bars = - this._toolbar_view.reveal_bottom_bars = - true; + this._toolbar_view.reveal_top_bars = this._toolbar_view.reveal_bottom_bars = + true; } private toggle_ui() { this.remove_timeout(); - this._toolbar_view.reveal_top_bars = - this._toolbar_view.reveal_bottom_bars = - !this._toolbar_view.reveal_top_bars; + this._toolbar_view.reveal_top_bars = this._toolbar_view.reveal_bottom_bars = + !this._toolbar_view.reveal_top_bars; } } diff --git a/src/components/player/video/volume-controls.ts b/src/components/player/video/volume-controls.ts index 331dd8d6..be79ac13 100644 --- a/src/components/player/video/volume-controls.ts +++ b/src/components/player/video/volume-controls.ts @@ -6,12 +6,15 @@ import { get_player } from "src/application"; export class VolumeControls extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "VolumeControls", - Template: - "resource:///com/vixalien/muzika/ui/components/player/video/volume-controls.ui", - InternalChildren: ["button", "adjustment", "scale"], - }, this); + GObject.registerClass( + { + GTypeName: "VolumeControls", + Template: + "resource:///com/vixalien/muzika/ui/components/player/video/volume-controls.ui", + InternalChildren: ["button", "adjustment", "scale"], + }, + this, + ); } private _button!: Gtk.ToggleButton; diff --git a/src/components/player/view.ts b/src/components/player/view.ts index e306d59c..bbe9ae46 100644 --- a/src/components/player/view.ts +++ b/src/components/player/view.ts @@ -13,9 +13,12 @@ export interface PlayerViewOptions { export class PlayerView extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "PlayerView", - }, this); + GObject.registerClass( + { + GTypeName: "PlayerView", + }, + this, + ); } squeezer: Adw.Squeezer; diff --git a/src/components/playlist/add-to-playlist-item.ts b/src/components/playlist/add-to-playlist-item.ts index 9390c7de..e5295c8a 100644 --- a/src/components/playlist/add-to-playlist-item.ts +++ b/src/components/playlist/add-to-playlist-item.ts @@ -7,16 +7,15 @@ import { load_thumbnails } from "../webimage.js"; export class AddToPlaylistItemCard extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "AddToPlaylistItemCard", - Template: - "resource:///com/vixalien/muzika/ui/components/playlist/add-to-playlist-item.ui", - InternalChildren: [ - "title", - "subtitle", - "image", - ], - }, this); + GObject.registerClass( + { + GTypeName: "AddToPlaylistItemCard", + Template: + "resource:///com/vixalien/muzika/ui/components/playlist/add-to-playlist-item.ui", + InternalChildren: ["title", "subtitle", "image"], + }, + this, + ); } item?: AddToPlaylistItem; diff --git a/src/components/playlist/bar.ts b/src/components/playlist/bar.ts index b47f3772..471176eb 100644 --- a/src/components/playlist/bar.ts +++ b/src/components/playlist/bar.ts @@ -15,41 +15,45 @@ const vprintf = imports.format.vprintf; export class PlaylistBar extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "PlaylistBar", - Template: "resource:///com/vixalien/muzika/ui/components/playlist/bar.ui", - InternalChildren: ["select_all", "label", "more", "delete", "revealer"], - Properties: { - "selection-mode": GObject.param_spec_boolean( - "selection-mode", - "Selection Mode", - "Whether this bar is in selection mode", - false, - GObject.ParamFlags.READWRITE, - ), - editable: GObject.param_spec_boolean( - "editable", - "Editable", - "Whether the playlist is editable", - false, - GObject.ParamFlags.READWRITE, - ), - model: GObject.param_spec_object( - "model", - "Model", - "The list model this bar is displaying", - Gtk.SelectionModel.$gtype, - GObject.ParamFlags.READWRITE, - ), - revealed: GObject.param_spec_boolean( - "revealed", - "Revealed", - "Whether this bar is revealed", - false, - GObject.ParamFlags.READWRITE, - ), + GObject.registerClass( + { + GTypeName: "PlaylistBar", + Template: + "resource:///com/vixalien/muzika/ui/components/playlist/bar.ui", + InternalChildren: ["select_all", "label", "more", "delete", "revealer"], + Properties: { + "selection-mode": GObject.param_spec_boolean( + "selection-mode", + "Selection Mode", + "Whether this bar is in selection mode", + false, + GObject.ParamFlags.READWRITE, + ), + editable: GObject.param_spec_boolean( + "editable", + "Editable", + "Whether the playlist is editable", + false, + GObject.ParamFlags.READWRITE, + ), + model: GObject.param_spec_object( + "model", + "Model", + "The list model this bar is displaying", + Gtk.SelectionModel.$gtype, + GObject.ParamFlags.READWRITE, + ), + revealed: GObject.param_spec_boolean( + "revealed", + "Revealed", + "Whether this bar is revealed", + false, + GObject.ParamFlags.READWRITE, + ), + }, }, - }, this); + this, + ); } private _select_all!: Gtk.ToggleButton; @@ -114,8 +118,8 @@ export class PlaylistBar extends Adw.Bin { // property: model - private _model: Gtk.SelectionModel> = Gtk - .NoSelection.new( + private _model: Gtk.SelectionModel> = + Gtk.NoSelection.new( Gio.ListStore.new(Gtk.Widget.$gtype), ) as Gtk.NoSelection>; @@ -172,11 +176,14 @@ export class PlaylistBar extends Adw.Bin { if (items > 1 || this.selection_mode) { this.revealed = true; - this._label.label = items === 0 ? _("No song selected") : ngettext( - vprintf(_("%d song selected"), [items]), - vprintf(_("%d songs selected"), [items]), - items, - ); + this._label.label = + items === 0 + ? _("No song selected") + : ngettext( + vprintf(_("%d song selected"), [items]), + vprintf(_("%d songs selected"), [items]), + items, + ); this.update_model(); } else { diff --git a/src/components/playlist/columnview.ts b/src/components/playlist/columnview.ts index 4dad6f71..26412e43 100644 --- a/src/components/playlist/columnview.ts +++ b/src/components/playlist/columnview.ts @@ -16,14 +16,17 @@ import { setup_link_label } from "src/util/label"; class ImageColumn extends Gtk.ColumnViewColumn { static { - GObject.registerClass({ - GTypeName: "ImageColumn", - Signals: { - "selection-mode-toggled": { - param_types: [GObject.TYPE_UINT64, GObject.TYPE_BOOLEAN], + GObject.registerClass( + { + GTypeName: "ImageColumn", + Signals: { + "selection-mode-toggled": { + param_types: [GObject.TYPE_UINT64, GObject.TYPE_BOOLEAN], + }, }, }, - }, this); + this, + ); } album = false; @@ -60,16 +63,13 @@ class ImageColumn extends Gtk.ColumnViewColumn { const playlist_item = container.object; - dynamic_image.connect( - "notify::selected", - (dynamic_image: DynamicImage) => { - this.emit( - "selection-mode-toggled", - list_item.position, - dynamic_image.selected, - ); - }, - ); + dynamic_image.connect("notify::selected", (dynamic_image: DynamicImage) => { + this.emit( + "selection-mode-toggled", + list_item.position, + dynamic_image.selected, + ); + }); container.connect("notify::state", () => { dynamic_image.state = container.state; @@ -334,9 +334,9 @@ class AlbumColumn extends Gtk.ColumnViewColumn { if (playlist_item.album) { if (playlist_item.album.id) { label.set_markup( - `${ - escape_label(playlist_item.album.name) - }`, + `${escape_label( + playlist_item.album.name, + )}`, ); } else { label.use_markup = false; @@ -392,12 +392,15 @@ interface AddColumnButton extends Gtk.Button { class AddColumn extends Gtk.ColumnViewColumn { static { - GObject.registerClass({ - GTypeName: "AddColumn", - Signals: { - "add": { param_types: [GObject.TYPE_INT] }, + GObject.registerClass( + { + GTypeName: "AddColumn", + Signals: { + add: { param_types: [GObject.TYPE_INT] }, + }, }, - }, this); + this, + ); } constructor() { @@ -442,9 +445,12 @@ class AddColumn extends Gtk.ColumnViewColumn { class ExtraMenuButtons extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "MenuButtons", - }, this); + GObject.registerClass( + { + GTypeName: "MenuButtons", + }, + this, + ); } private item?: PlaylistItem; @@ -508,21 +514,21 @@ class ExtraMenuButtons extends Adw.Bin { [_("Save to playlist"), `win.add-to-playlist("${this.item.videoId}")`], this.position > 0 ? [ - _("Remove from playlist"), - `playlist.remove-tracks([${this.position}])`, - ] + _("Remove from playlist"), + `playlist.remove-tracks([${this.position}])`, + ] : null, this.item.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${this.item.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${this.item.album.id}")`, + ] : null, this.item.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${this.item.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${this.item.artists[0].id}")`, + ] : null, ]); } @@ -550,9 +556,8 @@ class ExtraMenuButtons extends Adw.Bin { if (like) { newStatus = this.item.likeStatus === "LIKE" ? "INDIFFERENT" : "LIKE"; } else { - newStatus = this.item.likeStatus === "DISLIKE" - ? "INDIFFERENT" - : "DISLIKE"; + newStatus = + this.item.likeStatus === "DISLIKE" ? "INDIFFERENT" : "DISLIKE"; } if (newStatus === this.item.likeStatus) return; @@ -574,9 +579,12 @@ class ExtraMenuButtons extends Adw.Bin { class MenuColumn extends Gtk.ColumnViewColumn { static { - GObject.registerClass({ - GTypeName: "MenuColumn", - }, this); + GObject.registerClass( + { + GTypeName: "MenuColumn", + }, + this, + ); } editable = false; @@ -614,72 +622,75 @@ class MenuColumn extends Gtk.ColumnViewColumn { export class PlaylistColumnView extends Gtk.ColumnView { static { - GObject.registerClass({ - GTypeName: "PlaylistColumnView", - Properties: { - "show-rank": GObject.param_spec_boolean( - "show-rank", - "Show Rank", - "Whether to show chart rank and trend change", - false, - GObject.ParamFlags.READWRITE, - ), - "show-artists": GObject.ParamSpec.boolean( - "show-artists", - "Show Artists", - "Whether to show the artists of each track", - GObject.ParamFlags.READWRITE, - true, - ), - "show-time": GObject.ParamSpec.boolean( - "show-time", - "Show Time", - "Whether to show the duration of each track", - GObject.ParamFlags.READWRITE, - true, - ), - playlistId: GObject.param_spec_string( - "playlist-id", - "Playlist ID", - "The playlist ID", - null as any, - GObject.ParamFlags.READWRITE, - ), - album: GObject.param_spec_boolean( - "album", - "Album", - "Whether this is currently displaying an album", - false, - GObject.ParamFlags.READWRITE, - ), - show_add: GObject.param_spec_boolean( - "show-add", - "Show Add", - "Show the Save to playlist button", - false, - GObject.ParamFlags.READWRITE, - ), - selection_mode: GObject.param_spec_boolean( - "selection-mode", - "Selection Mode", - "Whether the selection mode is toggled on", - false, - GObject.ParamFlags.READWRITE, - ), - editable: GObject.param_spec_boolean( - "editable", - "Editable", - "Whether the playlist items can be edited", - false, - GObject.ParamFlags.READWRITE, - ), - }, - Signals: { - "add": { - param_types: [GObject.TYPE_INT], + GObject.registerClass( + { + GTypeName: "PlaylistColumnView", + Properties: { + "show-rank": GObject.param_spec_boolean( + "show-rank", + "Show Rank", + "Whether to show chart rank and trend change", + false, + GObject.ParamFlags.READWRITE, + ), + "show-artists": GObject.ParamSpec.boolean( + "show-artists", + "Show Artists", + "Whether to show the artists of each track", + GObject.ParamFlags.READWRITE, + true, + ), + "show-time": GObject.ParamSpec.boolean( + "show-time", + "Show Time", + "Whether to show the duration of each track", + GObject.ParamFlags.READWRITE, + true, + ), + playlistId: GObject.param_spec_string( + "playlist-id", + "Playlist ID", + "The playlist ID", + null as any, + GObject.ParamFlags.READWRITE, + ), + album: GObject.param_spec_boolean( + "album", + "Album", + "Whether this is currently displaying an album", + false, + GObject.ParamFlags.READWRITE, + ), + show_add: GObject.param_spec_boolean( + "show-add", + "Show Add", + "Show the Save to playlist button", + false, + GObject.ParamFlags.READWRITE, + ), + selection_mode: GObject.param_spec_boolean( + "selection-mode", + "Selection Mode", + "Whether the selection mode is toggled on", + false, + GObject.ParamFlags.READWRITE, + ), + editable: GObject.param_spec_boolean( + "editable", + "Editable", + "Whether the playlist items can be edited", + false, + GObject.ParamFlags.READWRITE, + ), + }, + Signals: { + add: { + param_types: [GObject.TYPE_INT], + }, }, }, - }, this); + this, + ); } private _image_column = new ImageColumn(); @@ -780,21 +791,17 @@ export class PlaylistColumnView extends Gtk.ColumnView { this._menu_column.editable = value; } - constructor( - { - selection_mode, - show_rank, - show_add, - show_artists, - album, - playlistId, - show_time, - editable, - ...options - }: Partial< - PlaylistColumnViewOptions - > = {}, - ) { + constructor({ + selection_mode, + show_rank, + show_add, + show_artists, + album, + playlistId, + show_time, + editable, + ...options + }: Partial = {}) { super(options); if (playlistId != null) { @@ -832,7 +839,7 @@ export class PlaylistColumnView extends Gtk.ColumnView { this._image_column.connect( "selection-mode-toggled", (_, position: number, value: boolean) => { - const selection_model = this.model as Gtk.SelectionModel; + const selection_model = this.model; if (value) { selection_model.select_item(position, false); @@ -858,9 +865,9 @@ export class PlaylistColumnView extends Gtk.ColumnView { }); this.connect("activate", (_, position) => { - const container = this.model.get_item(position) as ObjectContainer< - PlaylistItem - >; + const container = this.model.get_item( + position, + ) as ObjectContainer; if (this.playlistId) { this.activate_action( diff --git a/src/components/playlist/edit.ts b/src/components/playlist/edit.ts index 25e0b0dc..8ef5270d 100644 --- a/src/components/playlist/edit.ts +++ b/src/components/playlist/edit.ts @@ -11,32 +11,35 @@ import { add_toast } from "src/util/window"; export class PrivacyStatus extends GObject.Object { static { - GObject.registerClass({ - GTypeName: "PrivacyStatus", - Properties: { - id: GObject.ParamSpec.string( - "id", - "ID", - "The unique ID of the privacy status", - GObject.ParamFlags.READWRITE, - "", - ), - name: GObject.ParamSpec.string( - "name", - "Name", - "Translated name of the privacy status", - GObject.ParamFlags.READWRITE, - "", - ), - description: GObject.ParamSpec.string( - "description", - "description", - "Translated description of the privacy status", - GObject.ParamFlags.READWRITE, - "", - ), + GObject.registerClass( + { + GTypeName: "PrivacyStatus", + Properties: { + id: GObject.ParamSpec.string( + "id", + "ID", + "The unique ID of the privacy status", + GObject.ParamFlags.READWRITE, + "", + ), + name: GObject.ParamSpec.string( + "name", + "Name", + "Translated name of the privacy status", + GObject.ParamFlags.READWRITE, + "", + ), + description: GObject.ParamSpec.string( + "description", + "description", + "Translated description of the privacy status", + GObject.ParamFlags.READWRITE, + "", + ), + }, }, - }, this); + this, + ); } constructor( @@ -63,11 +66,7 @@ export interface EditedValues { const privacy_model = new Gio.ListStore(); privacy_model.append( - new PrivacyStatus( - "PUBLIC", - _("Public"), - _("Anyone can search for and view"), - ), + new PrivacyStatus("PUBLIC", _("Public"), _("Anyone can search for and view")), ); privacy_model.append( @@ -79,31 +78,25 @@ privacy_model.append( ); privacy_model.append( - new PrivacyStatus( - "PRIVATE", - _("Private"), - _("Only you can view"), - ), + new PrivacyStatus("PRIVATE", _("Private"), _("Only you can view")), ); export class EditPlaylistDialog extends Adw.PreferencesDialog { static { - GObject.registerClass({ - GTypeName: "EditPlaylistDialog", - Template: - "resource:///com/vixalien/muzika/ui/components/playlist/edit.ui", - InternalChildren: [ - "title", - "description", - "privacy", - "save", - ], - Signals: { - saved: { - param_types: [GObject.TYPE_OBJECT], + GObject.registerClass( + { + GTypeName: "EditPlaylistDialog", + Template: + "resource:///com/vixalien/muzika/ui/components/playlist/edit.ui", + InternalChildren: ["title", "description", "privacy", "save"], + Signals: { + saved: { + param_types: [GObject.TYPE_OBJECT], + }, }, }, - }, this); + this, + ); } private _title!: Adw.EntryRow; @@ -207,9 +200,12 @@ export class EditPlaylistDialog extends Adw.PreferencesDialog { class PrivacyBox extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "PrivacyBox", - }, this); + GObject.registerClass( + { + GTypeName: "PrivacyBox", + }, + this, + ); } title!: Gtk.Label; diff --git a/src/components/playlist/header.ts b/src/components/playlist/header.ts index 9da38978..2fdd0190 100644 --- a/src/components/playlist/header.ts +++ b/src/components/playlist/header.ts @@ -10,54 +10,57 @@ import { setup_link_label } from "src/util/label.js"; export class PlaylistHeader extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "PlaylistHeader", - Template: - "resource:///com/vixalien/muzika/ui/components/playlist/header.ui", - Implements: [Gtk.Buildable], - Properties: { - "show-large-header": GObject.ParamSpec.boolean( - "show-large-header", - "Show Large Header", - "Whether to show the larger header", - GObject.ParamFlags.READWRITE, - true, - ), - "show-avatar": GObject.ParamSpec.boolean( - "show-avatar", - "Show Avatar", - "Whether to show the avatar or image", - GObject.ParamFlags.READWRITE, - false, - ), - "show-meta": GObject.ParamSpec.boolean( - "show-meta", - "Show Meta", - "Whether to show the metadata like genre & year", - GObject.ParamFlags.READWRITE, - false, - ), + GObject.registerClass( + { + GTypeName: "PlaylistHeader", + Template: + "resource:///com/vixalien/muzika/ui/components/playlist/header.ui", + Implements: [Gtk.Buildable], + Properties: { + "show-large-header": GObject.ParamSpec.boolean( + "show-large-header", + "Show Large Header", + "Whether to show the larger header", + GObject.ParamFlags.READWRITE, + true, + ), + "show-avatar": GObject.ParamSpec.boolean( + "show-avatar", + "Show Avatar", + "Whether to show the avatar or image", + GObject.ParamFlags.READWRITE, + false, + ), + "show-meta": GObject.ParamSpec.boolean( + "show-meta", + "Show Meta", + "Whether to show the metadata like genre & year", + GObject.ParamFlags.READWRITE, + false, + ), + }, + InternalChildren: [ + "stack", + "title", + "subtitle", + "submeta", + "description_stack", + "more", + "description", + "description_long", + "year", + "genre", + "subtitle_separator", + "image", + "explicit", + "avatar", + "primary_buttons", + "secondary_buttons", + "buttons", + ], }, - InternalChildren: [ - "stack", - "title", - "subtitle", - "submeta", - "description_stack", - "more", - "description", - "description_long", - "year", - "genre", - "subtitle_separator", - "image", - "explicit", - "avatar", - "primary_buttons", - "secondary_buttons", - "buttons", - ], - }, this); + this, + ); } private _stack!: Gtk.Stack; diff --git a/src/components/playlist/itemview.ts b/src/components/playlist/itemview.ts index a27aa638..cd57d227 100644 --- a/src/components/playlist/itemview.ts +++ b/src/components/playlist/itemview.ts @@ -11,72 +11,75 @@ import { SignalListeners } from "src/util/signal-listener"; export class PlaylistItemView extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "PlaylistItemView", - Properties: { - model: GObject.ParamSpec.object( - "model", - "Model", - "The list model this view is displaying", - GObject.ParamFlags.READWRITE, - Gio.ListModel.$gtype, - ), - "show-rank": GObject.ParamSpec.boolean( - "show-rank", - "Show Rank", - "Whether to show the rank of the playlist item", - GObject.ParamFlags.READWRITE, - false, - ), - "show-artists": GObject.ParamSpec.boolean( - "show-artists", - "Show Artists", - "Whether to show the artists of each track", - GObject.ParamFlags.READWRITE, - true, - ), - "show-time": GObject.ParamSpec.boolean( - "show-time", - "Show Time", - "Whether to show the duration of each track", - GObject.ParamFlags.READWRITE, - true, - ), - "show-column": GObject.ParamSpec.boolean( - "show-column", - "Show Column", - "Whether to show the column view", - GObject.ParamFlags.READWRITE, - false, - ), - album: GObject.ParamSpec.boolean( - "album", - "Album", - "Whether this view is displaying an album", - GObject.ParamFlags.READWRITE, - false, - ), - "selection-mode": GObject.ParamSpec.boolean( - "selection-mode", - "Selection Mode", - "Whether this view is in selection mode", - GObject.ParamFlags.READWRITE, - false, - ), - "show-add": GObject.param_spec_boolean( - "show-add", - "Show Add", - "Show Add button", - true, - GObject.ParamFlags.READWRITE, - ), - }, - Signals: { - "add": { - param_types: [GObject.TYPE_OBJECT], + GObject.registerClass( + { + GTypeName: "PlaylistItemView", + Properties: { + model: GObject.ParamSpec.object( + "model", + "Model", + "The list model this view is displaying", + GObject.ParamFlags.READWRITE, + Gio.ListModel.$gtype, + ), + "show-rank": GObject.ParamSpec.boolean( + "show-rank", + "Show Rank", + "Whether to show the rank of the playlist item", + GObject.ParamFlags.READWRITE, + false, + ), + "show-artists": GObject.ParamSpec.boolean( + "show-artists", + "Show Artists", + "Whether to show the artists of each track", + GObject.ParamFlags.READWRITE, + true, + ), + "show-time": GObject.ParamSpec.boolean( + "show-time", + "Show Time", + "Whether to show the duration of each track", + GObject.ParamFlags.READWRITE, + true, + ), + "show-column": GObject.ParamSpec.boolean( + "show-column", + "Show Column", + "Whether to show the column view", + GObject.ParamFlags.READWRITE, + false, + ), + album: GObject.ParamSpec.boolean( + "album", + "Album", + "Whether this view is displaying an album", + GObject.ParamFlags.READWRITE, + false, + ), + "selection-mode": GObject.ParamSpec.boolean( + "selection-mode", + "Selection Mode", + "Whether this view is in selection mode", + GObject.ParamFlags.READWRITE, + false, + ), + "show-add": GObject.param_spec_boolean( + "show-add", + "Show Add", + "Show Add button", + true, + GObject.ParamFlags.READWRITE, + ), + }, + Signals: { + add: { + param_types: [GObject.TYPE_OBJECT], + }, }, }, - }, this); + this, + ); } private get_current_child() { @@ -91,7 +94,7 @@ export class PlaylistItemView extends Adw.Bin { property: Key, value: CurrentChild[Key], ) { - return this.get_current_child()[property] = value; + return (this.get_current_child()[property] = value); } // property: selection-mode @@ -158,7 +161,7 @@ export class PlaylistItemView extends Adw.Bin { model: model as any, }); - this.set_current_property("model", this.multi_selection_model!); + this.set_current_property("model", this.multi_selection_model); this.setup_listeners(); } @@ -229,12 +232,12 @@ export class PlaylistItemView extends Adw.Bin { } const props = { - header_factory: this.header_factory ?? null as any, + header_factory: this.header_factory ?? (null as any), model: this.multi_selection_model!, selection_mode: this.selection_mode, album: this.album, show_add: this.show_add, - playlistId: this.playlistId ?? null as any, + playlistId: this.playlistId ?? (null as any), editable: this.editable, }; @@ -246,9 +249,7 @@ export class PlaylistItemView extends Adw.Bin { show_time: this.show_time, }); } else { - this.child = new PlaylistListView( - props, - ); + this.child = new PlaylistListView(props); } this.child.connect("add", (_list, index) => { diff --git a/src/components/playlist/listitem.ts b/src/components/playlist/listitem.ts index 76ba3815..0d8e1c7f 100644 --- a/src/components/playlist/listitem.ts +++ b/src/components/playlist/listitem.ts @@ -13,35 +13,36 @@ import { setup_link_label } from "src/util/label.js"; export class PlaylistListItem extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "PlaylistListItem", - Template: - "resource:///com/vixalien/muzika/ui/components/playlist/listitem.ui", - InternalChildren: [ - "title", - "explicit", - "subtitle", - "chart_rank", - "rank", - "change", - "add", - ], - Children: [ - "dynamic_image", - ], - Properties: { - "show-add": GObject.param_spec_boolean( - "show-add", - "Show Add", - "Show Add button", - true, - GObject.ParamFlags.READWRITE, - ), - }, - Signals: { - "add": {}, + GObject.registerClass( + { + GTypeName: "PlaylistListItem", + Template: + "resource:///com/vixalien/muzika/ui/components/playlist/listitem.ui", + InternalChildren: [ + "title", + "explicit", + "subtitle", + "chart_rank", + "rank", + "change", + "add", + ], + Children: ["dynamic_image"], + Properties: { + "show-add": GObject.param_spec_boolean( + "show-add", + "Show Add", + "Show Add button", + true, + GObject.ParamFlags.READWRITE, + ), + }, + Signals: { + add: {}, + }, }, - }, this); + this, + ); } item?: PlaylistItem; @@ -124,7 +125,7 @@ export class PlaylistListItem extends Gtk.Box { menuLikeRow( item.likeStatus, item.videoId, - (likeStatus) => item.likeStatus = likeStatus, + (likeStatus) => (item.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${item.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${item.videoId}?next=true")`], @@ -135,15 +136,15 @@ export class PlaylistListItem extends Gtk.Box { : null, item.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${item.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${item.album.id}")`, + ] : null, item.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${item.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${item.artists[0].id}")`, + ] : null, ]; }); diff --git a/src/components/playlist/listview.ts b/src/components/playlist/listview.ts index 9ecb6063..95526ca6 100644 --- a/src/components/playlist/listview.ts +++ b/src/components/playlist/listview.ts @@ -16,58 +16,61 @@ interface PlaylistListItemWithSignals extends PlaylistListItem { export class PlaylistListView extends Gtk.ListView { static { - GObject.registerClass({ - GTypeName: "PlaylistListView", - Properties: { - "show-rank": GObject.param_spec_boolean( - "show-rank", - "Show Rank", - "Whether to show chart rank and trend change", - false, - GObject.ParamFlags.READWRITE, - ), - playlistId: GObject.param_spec_string( - "playlist-id", - "Playlist ID", - "The playlist ID", - null as any, - GObject.ParamFlags.READWRITE, - ), - album: GObject.param_spec_boolean( - "album", - "Album", - "Whether this is currently displaying an album", - false, - GObject.ParamFlags.READWRITE, - ), - show_add: GObject.param_spec_boolean( - "show-add", - "Show Add", - "Show the Save to playlist button", - false, - GObject.ParamFlags.READWRITE, - ), - selection_mode: GObject.param_spec_boolean( - "selection-mode", - "Selection Mode", - "Whether the selection mode is toggled on", - false, - GObject.ParamFlags.READWRITE, - ), - editable: GObject.param_spec_boolean( - "editable", - "Editable", - "Whether the playlist items can be edited", - false, - GObject.ParamFlags.READWRITE, - ), - }, - Signals: { - "add": { - param_types: [GObject.TYPE_INT], + GObject.registerClass( + { + GTypeName: "PlaylistListView", + Properties: { + "show-rank": GObject.param_spec_boolean( + "show-rank", + "Show Rank", + "Whether to show chart rank and trend change", + false, + GObject.ParamFlags.READWRITE, + ), + playlistId: GObject.param_spec_string( + "playlist-id", + "Playlist ID", + "The playlist ID", + null as any, + GObject.ParamFlags.READWRITE, + ), + album: GObject.param_spec_boolean( + "album", + "Album", + "Whether this is currently displaying an album", + false, + GObject.ParamFlags.READWRITE, + ), + show_add: GObject.param_spec_boolean( + "show-add", + "Show Add", + "Show the Save to playlist button", + false, + GObject.ParamFlags.READWRITE, + ), + selection_mode: GObject.param_spec_boolean( + "selection-mode", + "Selection Mode", + "Whether the selection mode is toggled on", + false, + GObject.ParamFlags.READWRITE, + ), + editable: GObject.param_spec_boolean( + "editable", + "Editable", + "Whether the playlist items can be edited", + false, + GObject.ParamFlags.READWRITE, + ), + }, + Signals: { + add: { + param_types: [GObject.TYPE_INT], + }, }, }, - }, this); + this, + ); } album = false; @@ -75,11 +78,14 @@ export class PlaylistListView extends Gtk.ListView { playlistId?: string; editable = false; - constructor( - { model, album, selection_mode, show_add, editable, ...props }: Partial< - Gtk.ListView.ConstructorProperties - > = {}, - ) { + constructor({ + model, + album, + selection_mode, + show_add, + editable, + ...props + }: Partial = {}) { super({ single_click_activate: true, ...props }); if (album != null) this.album = album; @@ -102,9 +108,9 @@ export class PlaylistListView extends Gtk.ListView { this.factory = factory; this.connect("activate", (_, position) => { - const container = this.model.get_item(position) as ObjectContainer< - PlaylistItem - >; + const container = this.model.get_item( + position, + ) as ObjectContainer; if (this.playlistId) { this.activate_action( @@ -156,10 +162,7 @@ export class PlaylistListView extends Gtk.ListView { item.dynamic_image, "notify::selected", (dynamic_image: DynamicImage) => { - this.selection_mode_toggled( - list_item.position, - dynamic_image.selected, - ); + this.selection_mode_toggled(list_item.position, dynamic_image.selected); }, ); diff --git a/src/components/playlist/save-to-playlist.ts b/src/components/playlist/save-to-playlist.ts index e23c60bb..ebe5191c 100644 --- a/src/components/playlist/save-to-playlist.ts +++ b/src/components/playlist/save-to-playlist.ts @@ -22,19 +22,21 @@ export type AddToPlaylistItemWithTitle = AddToPlaylistItem & { }; class AddToPlaylistListStore extends Gio.ListStore< - ObjectContainer< - AddToPlaylistItemWithTitle - > + ObjectContainer > { static { - GObject.registerClass({ - GTypeName: "AddToPlaylistListStore", - Implements: [Gtk.SectionModel], - }, this); + GObject.registerClass( + { + GTypeName: "AddToPlaylistListStore", + Implements: [Gtk.SectionModel], + }, + this, + ); } vfunc_get_section(position: number) { - let start = -1, end = -1; + let start = -1, + end = -1; for (let i = position; i >= 0; i--) { if (this.get_item(i)?.object.section_title != null) { @@ -71,14 +73,15 @@ export interface GetAddToPlaylistOptions { export class SaveToPlaylistDialog extends Adw.Dialog { static { - GObject.registerClass({ - GTypeName: "SaveToPlaylistDialog", - Template: - "resource:///com/vixalien/muzika/ui/components/playlist/save-to-playlist.ui", - InternalChildren: [ - "list_view", - ], - }, this); + GObject.registerClass( + { + GTypeName: "SaveToPlaylistDialog", + Template: + "resource:///com/vixalien/muzika/ui/components/playlist/save-to-playlist.ui", + InternalChildren: ["list_view"], + }, + this, + ); } private _list_view!: Gtk.ListView; @@ -112,10 +115,9 @@ export class SaveToPlaylistDialog extends Adw.Dialog { .then((result) => { this.show_add_to_playlist(result); this.present(get_window()); - }).catch(() => { - add_toast( - _("Couldn't get your playlists. Please try again later."), - ); + }) + .catch(() => { + add_toast(_("Couldn't get your playlists. Please try again later.")); }); } @@ -133,9 +135,8 @@ export class SaveToPlaylistDialog extends Adw.Dialog { list_item: Gtk.ListItem, ) { const card = list_item.child as AddToPlaylistItemCard; - const container = list_item.item as ObjectContainer< - AddToPlaylistItemWithTitle - >; + const container = + list_item.item as ObjectContainer; const item = container.object; @@ -159,9 +160,8 @@ export class SaveToPlaylistDialog extends Adw.Dialog { list_item: Gtk.ListHeader, ) { const title = list_item.child as Gtk.Label; - const container = list_item.item as ObjectContainer< - AddToPlaylistItemWithTitle - >; + const container = + list_item.item as ObjectContainer; const label = container.object?.section_title; @@ -179,44 +179,47 @@ export class SaveToPlaylistDialog extends Adw.Dialog { add_videos: this.videoIds ?? undefined, add_source_playlists: this.playlistId ? [this.playlistId] : undefined, dedupe: "check", - }).then(async (result) => { - if (result.status === "STATUS_SUCCEEDED") { - this.success_toast(playlist); - } else { - // try to provide an option to dedupe or add anyways - if (this.playlistId || this.videoIds && this.videoIds.length > 1) { - const dialog = Adw.AlertDialog.new( - _("Duplicates"), - _("One or more of the songs are already in your playlist"), - ); - - dialog.add_response("drop_duplicate", _("Skip duplicates")); - dialog.add_response("skip", _("Add anyway")); - - const response = await dialog.choose(window, null) - .catch(console.error); - - this.add_to_playlist_with_dedupe( - playlist, - response as EditPlaylistOptions["dedupe"], - ); + }) + .then(async (result) => { + if (result.status === "STATUS_SUCCEEDED") { + this.success_toast(playlist); } else { - const toast = new Adw.Toast({ - title: _("This song is already in the playlist"), - button_label: _("Add anyway"), - }); - - toast.connect("button-clicked", (toast) => { - toast.dismiss(); - this.add_to_playlist_with_dedupe(playlist, "skip"); - }); - - window.add_toast_full(toast); + // try to provide an option to dedupe or add anyways + if (this.playlistId || (this.videoIds && this.videoIds.length > 1)) { + const dialog = Adw.AlertDialog.new( + _("Duplicates"), + _("One or more of the songs are already in your playlist"), + ); + + dialog.add_response("drop_duplicate", _("Skip duplicates")); + dialog.add_response("skip", _("Add anyway")); + + const response = await dialog + .choose(window, null) + .catch(console.error); + + this.add_to_playlist_with_dedupe( + playlist, + response as EditPlaylistOptions["dedupe"], + ); + } else { + const toast = new Adw.Toast({ + title: _("This song is already in the playlist"), + button_label: _("Add anyway"), + }); + + toast.connect("button-clicked", (toast) => { + toast.dismiss(); + this.add_to_playlist_with_dedupe(playlist, "skip"); + }); + + window.add_toast_full(toast); + } } - } - }).catch(() => { - this.error_toast(playlist); - }); + }) + .catch(() => { + this.error_toast(playlist); + }); this.close(); } @@ -229,15 +232,17 @@ export class SaveToPlaylistDialog extends Adw.Dialog { add_videos: this.videoIds ?? undefined, add_source_playlists: this.playlistId ? [this.playlistId] : undefined, dedupe, - }).then((result) => { - if (result.status === "STATUS_SUCCEEDED") { - this.success_toast(playlist); - } else { + }) + .then((result) => { + if (result.status === "STATUS_SUCCEEDED") { + this.success_toast(playlist); + } else { + this.error_toast(playlist); + } + }) + .catch(() => { this.error_toast(playlist); - } - }).catch(() => { - this.error_toast(playlist); - }); + }); } show_add_to_playlist(add: AddToPlaylist) { @@ -277,15 +282,15 @@ export class SaveToPlaylistDialog extends Adw.Dialog { get_window().add_toast_full( new Adw.Toast({ title: this.playlistId - // Translators: %s is a playlist name - ? vprintf(_("Couldn't add playlist to %s"), [playlist.title]) - // Translators: %s is a playlist name - : vprintf( - this.videoIds && this.videoIds.length > 1 - ? _("Couldn't add songs to %s") - : _("Couldn't add song to %s"), - [playlist.title], - ), + ? // Translators: %s is a playlist name + vprintf(_("Couldn't add playlist to %s"), [playlist.title]) + : // Translators: %s is a playlist name + vprintf( + this.videoIds && this.videoIds.length > 1 + ? _("Couldn't add songs to %s") + : _("Couldn't add song to %s"), + [playlist.title], + ), }), ); } diff --git a/src/components/search/section.ts b/src/components/search/section.ts index 9f0b96b4..52e30a04 100644 --- a/src/components/search/section.ts +++ b/src/components/search/section.ts @@ -13,12 +13,15 @@ GObject.type_ensure(FlatListView.$gtype); export class SearchSection extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "SearchSection", - Template: - "resource:///com/vixalien/muzika/ui/components/search/section.ui", - InternalChildren: ["title", "more", "card_view"], - }, this); + GObject.registerClass( + { + GTypeName: "SearchSection", + Template: + "resource:///com/vixalien/muzika/ui/components/search/section.ui", + InternalChildren: ["title", "more", "card_view"], + }, + this, + ); } private _title!: Gtk.Label; @@ -29,13 +32,11 @@ export class SearchSection extends Gtk.Box { show_more: boolean; show_type: boolean; - constructor( - options: { - args: Parameters; - show_more?: boolean; - show_type?: boolean; - }, - ) { + constructor(options: { + args: Parameters; + show_more?: boolean; + show_type?: boolean; + }) { super(); this.args = options.args; @@ -47,23 +48,19 @@ export class SearchSection extends Gtk.Box { this._title.label = category.title || _("Results"); if ( - category.results.length >= 0 && this.show_more && category.filter && + category.results.length >= 0 && + this.show_more && + category.filter && filters.includes(category.filter) ) { - const url = search_args_to_url( - this.args[0], - { - filter: category.filter ?? undefined, - ...this.args[1], - }, - ); + const url = search_args_to_url(this.args[0], { + filter: category.filter ?? undefined, + ...this.args[1], + }); this._more.visible = true; this._more.action_name = "navigator.visit"; - this._more.action_target = GLib.Variant.new( - "s", - url, - ); + this._more.action_target = GLib.Variant.new("s", url); } this.add_search_contents(category.results); diff --git a/src/components/search/topresultcard.ts b/src/components/search/topresultcard.ts index 72225f3c..dff83f8d 100644 --- a/src/components/search/topresultcard.ts +++ b/src/components/search/topresultcard.ts @@ -25,28 +25,29 @@ GObject.type_ensure(DynamicImage.$gtype); export class TopResultCard extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "TopResultCard", - Template: - "resource:///com/vixalien/muzika/ui/components/search/topresult.ui", - InternalChildren: [ - "avatar", - "title", - "explicit", - "subtitle", - "primary", - "primary_content", - "secondary", - "secondary_content", - "image_stack", - "actions", - "meta", - "grid", - ], - Children: [ - "dynamic_image", - ], - }, this); + GObject.registerClass( + { + GTypeName: "TopResultCard", + Template: + "resource:///com/vixalien/muzika/ui/components/search/topresult.ui", + InternalChildren: [ + "avatar", + "title", + "explicit", + "subtitle", + "primary", + "primary_content", + "secondary", + "secondary_content", + "image_stack", + "actions", + "meta", + "grid", + ], + Children: ["dynamic_image"], + }, + this, + ); } private _avatar!: Adw.Avatar; @@ -120,9 +121,7 @@ export class TopResultCard extends Adw.Bin { this.dynamic_image.state = DynamicActionState.LOADING; this.activate_action( "queue.play-song", - GLib.Variant.new_string( - this.result.videoId, - ), + GLib.Variant.new_string(this.result.videoId), ); } break; @@ -227,7 +226,7 @@ export class TopResultCard extends Adw.Bin { menuLikeRow( song.likeStatus, song.videoId, - (likeStatus) => song.likeStatus = likeStatus, + (likeStatus) => (song.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${song.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${song.videoId}?next=true")`], @@ -235,15 +234,15 @@ export class TopResultCard extends Adw.Bin { [_("Save to playlist"), `win.add-to-playlist("${song.videoId}")`], song.album ? [ - _("Go to album"), - `navigator.visit("muzika:album:${song.album.id}")`, - ] + _("Go to album"), + `navigator.visit("muzika:album:${song.album.id}")`, + ] : null, song.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${song.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${song.artists[0].id}")`, + ] : null, ]; }); @@ -260,7 +259,7 @@ export class TopResultCard extends Adw.Bin { menuLikeRow( video.likeStatus, video.videoId, - (likeStatus) => video.likeStatus = likeStatus, + (likeStatus) => (video.likeStatus = likeStatus), ), [_("Start radio"), `queue.play-song("${video.videoId}?radio=true")`], [_("Play next"), `queue.add-song("${video.videoId}?next=true")`], @@ -268,9 +267,9 @@ export class TopResultCard extends Adw.Bin { [_("Save to playlist"), `win.add-to-playlist("${video.videoId}")`], video.artists && video.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${video.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${video.artists[0].id}")`, + ] : null, ]; }); @@ -292,15 +291,15 @@ export class TopResultCard extends Adw.Bin { this.menu_helper.props = [ album.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${album.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${album.shuffleId}?next=true")`, + ] : null, album.radioId ? [ - _("Start radio"), - `queue.play-playlist("${album.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${album.radioId}?next=true")`, + ] : null, // TODO: get album audioPlaylistId // [ @@ -314,9 +313,9 @@ export class TopResultCard extends Adw.Bin { // ], album.artists.length > 1 ? [ - _("Go to artist"), - `navigator.visit("muzika:artist:${album.artists[0].id}")`, - ] + _("Go to artist"), + `navigator.visit("muzika:artist:${album.artists[0].id}")`, + ] : null, ]; } @@ -356,15 +355,15 @@ export class TopResultCard extends Adw.Bin { this.menu_helper.props = [ artist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${artist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${artist.shuffleId}?next=true")`, + ] : null, artist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${artist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${artist.radioId}?next=true")`, + ] : null, ]; } @@ -402,20 +401,17 @@ export class TopResultCard extends Adw.Bin { this.menu_helper.props = [ playlist.shuffleId ? [ - _("Shuffle play"), - `queue.play-playlist("${playlist.shuffleId}?next=true")`, - ] + _("Shuffle play"), + `queue.play-playlist("${playlist.shuffleId}?next=true")`, + ] : null, playlist.radioId ? [ - _("Start radio"), - `queue.play-playlist("${playlist.radioId}?next=true")`, - ] + _("Start radio"), + `queue.play-playlist("${playlist.radioId}?next=true")`, + ] : null, - [ - _("Play next"), - `queue.add-playlist("${playlist.browseId}?next=true")`, - ], + [_("Play next"), `queue.add-playlist("${playlist.browseId}?next=true")`], [_("Add to queue"), `queue.add-playlist("${playlist.browseId}")`], [ _("Save to playlist"), @@ -456,36 +452,37 @@ export class TopResultCard extends Adw.Bin { // TODO: get album audioPlayistId const item = { - playlist_id: this.result.type == "playlist" - ? this.result.browseId - : undefined, - video_id: this.result.type == "song" || this.result.type == "video" - ? this.result.videoId - : undefined, + playlist_id: + this.result.type == "playlist" ? this.result.browseId : undefined, + video_id: + this.result.type == "song" || this.result.type == "video" + ? this.result.videoId + : undefined, is_playlist: false, }; item.is_playlist = item.playlist_id != null; if (item.is_playlist) { - this.dynamic_image.state = (item.playlist_id && - player.now_playing?.object.settings.playlistId == - item.playlist_id) - ? player.playing - ? DynamicActionState.PLAYING - : DynamicActionState.PAUSED - : item.video_id && player.loading_track == item.video_id - ? DynamicActionState.LOADING - : DynamicActionState.DEFAULT; + this.dynamic_image.state = + item.playlist_id && + player.now_playing?.object.settings.playlistId == item.playlist_id + ? player.playing + ? DynamicActionState.PLAYING + : DynamicActionState.PAUSED + : item.video_id && player.loading_track == item.video_id + ? DynamicActionState.LOADING + : DynamicActionState.DEFAULT; } else { - this.dynamic_image.state = (item.video_id && - player.now_playing?.object.track.videoId == item.video_id) - ? player.playing - ? DynamicActionState.PLAYING - : DynamicActionState.PAUSED - : player.loading_track == item.video_id - ? DynamicActionState.LOADING - : DynamicActionState.DEFAULT; + this.dynamic_image.state = + item.video_id && + player.now_playing?.object.track.videoId == item.video_id + ? player.playing + ? DynamicActionState.PLAYING + : DynamicActionState.PAUSED + : player.loading_track == item.video_id + ? DynamicActionState.LOADING + : DynamicActionState.DEFAULT; } } @@ -496,14 +493,11 @@ export class TopResultCard extends Adw.Bin { if (!this.result) return; - this.listeners.add( - player, - [ - player.connect("notify::now-playing", this.reload_state.bind(this)), - player.connect("notify::playing", this.reload_state.bind(this)), - player.connect("notify::loading-track", this.reload_state.bind(this)), - ], - ); + this.listeners.add(player, [ + player.connect("notify::now-playing", this.reload_state.bind(this)), + player.connect("notify::playing", this.reload_state.bind(this)), + player.connect("notify::loading-track", this.reload_state.bind(this)), + ]); this.reload_state(); } diff --git a/src/components/search/topresultsection.ts b/src/components/search/topresultsection.ts index 4eae0fdd..b0678d88 100644 --- a/src/components/search/topresultsection.ts +++ b/src/components/search/topresultsection.ts @@ -13,12 +13,15 @@ GObject.type_ensure(TopResultCard.$gtype); export class TopResultSection extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "TopResultSection", - Template: - "resource:///com/vixalien/muzika/ui/components/search/topresultsection.ui", - InternalChildren: ["box", "card", "list_view"], - }, this); + GObject.registerClass( + { + GTypeName: "TopResultSection", + Template: + "resource:///com/vixalien/muzika/ui/components/search/topresultsection.ui", + InternalChildren: ["box", "card", "list_view"], + }, + this, + ); } private _box!: Gtk.Box; @@ -93,9 +96,7 @@ export class TopResultSection extends Gtk.Box { // row.dynamic_image.state = DynamicActionState.LOADING; this.activate_action( "queue.play-song", - GLib.Variant.new_string( - content.videoId, - ), + GLib.Variant.new_string(content.videoId), ); break; } diff --git a/src/components/webimage.ts b/src/components/webimage.ts index 78d2ec4c..e6429871 100644 --- a/src/components/webimage.ts +++ b/src/components/webimage.ts @@ -21,11 +21,11 @@ export function get_thumbnail_with_size( `=w${required_width}-h${required_height}`, ); - return ({ + return { url: new_url, width: required_width, height: required_height, - }); + }; } else { return thumbnail; } @@ -131,10 +131,7 @@ export interface LoadOptions { const thumbnails_map = new Map(); -export function fetch_image( - href: string, - options: LoadOptions, -) { +export function fetch_image(href: string, options: LoadOptions) { const cache_key = JSON.stringify({ href, options }); if (thumbnails_map.has(cache_key)) { @@ -146,37 +143,35 @@ export function fetch_image( return fetch(url, { method: "GET", signal: options.signal, - }).then(async (response) => { - const buffer = await response.arrayBuffer(); - - const texture = Gdk.Texture.new_from_bytes(new Uint8Array(buffer)); - - if (options.width && options.height) { - // pixbuf = pixbuf?.scale_simple( - // options.width, - // options.height, - // // crop - // GdkPixbuf.InterpType.HYPER, - // )!; - } + }) + .then(async (response) => { + const buffer = await response.arrayBuffer(); + + const texture = Gdk.Texture.new_from_bytes(new Uint8Array(buffer)); + + if (options.width && options.height) { + // pixbuf = pixbuf?.scale_simple( + // options.width, + // options.height, + // // crop + // GdkPixbuf.InterpType.HYPER, + // )!; + } - thumbnails_map.set(cache_key, texture); + thumbnails_map.set(cache_key, texture); - return texture; - }).catch((e) => { - if (e.name !== "AbortError") { - console.error("Couldn't load thumbnail:", e); - } - return null; - }); + return texture; + }) + .catch((e) => { + if (e.name !== "AbortError") { + console.error("Couldn't load thumbnail:", e); + } + return null; + }); } export async function load_image( - image: - | Gtk.Image - | Gtk.Picture - | Adw.Avatar - | FixedRatioThumbnail, + image: Gtk.Image | Gtk.Picture | Adw.Avatar | FixedRatioThumbnail, href: string, options: LoadOptions, ) { diff --git a/src/mpris.ts b/src/mpris.ts index beb1e11b..07c5197a 100644 --- a/src/mpris.ts +++ b/src/mpris.ts @@ -133,8 +133,7 @@ export class DBusInterface { for (const method of iface.methods) { this.method_outargs.set( method.name, - `(` + method.out_args.map((arg) => arg.signature).join("") + - `)`, + `(` + method.out_args.map((arg) => arg.signature).join("") + `)`, ); this.method_inargs.set( @@ -181,9 +180,7 @@ export class DBusInterface { } }); - const method_snake_name = DBusInterface._camel_to_snake( - method_name, - ); + const method_snake_name = DBusInterface._camel_to_snake(method_name); let result; @@ -268,53 +265,42 @@ export class MPRIS extends DBusInterface { this._on_shuffle_changed.bind(this), ), - this.player.queue.connect( - "notify::can-play-next", - () => { - this._properties_changed( - this.MEDIA_PLAYER2_PLAYER_IFACE, - { - CanGoNext: GLib.Variant.new_boolean( - this.player.queue.can_play_next, - ), - }, - [], - ); - }, - ), - - this.player.queue.connect( - "notify::can-play-previous", - () => { - this._properties_changed( - this.MEDIA_PLAYER2_PLAYER_IFACE, - { - CanGoPrevious: GLib.Variant.new_boolean( - this.player.queue.can_play_previous, - ), - }, - [], - ); - }, - ), + this.player.queue.connect("notify::can-play-next", () => { + this._properties_changed( + this.MEDIA_PLAYER2_PLAYER_IFACE, + { + CanGoNext: GLib.Variant.new_boolean( + this.player.queue.can_play_next, + ), + }, + [], + ); + }), + + this.player.queue.connect("notify::can-play-previous", () => { + this._properties_changed( + this.MEDIA_PLAYER2_PLAYER_IFACE, + { + CanGoPrevious: GLib.Variant.new_boolean( + this.player.queue.can_play_previous, + ), + }, + [], + ); + }), - this.player.connect( - "notify::seeking", - () => { - if (!this.player.seeking) { - this._on_seek_finished(this as any, this.player.timestamp); - } - }, - ), + this.player.connect("notify::seeking", () => { + if (!this.player.seeking) { + this._on_seek_finished(this as any, this.player.timestamp); + } + }), ]); } _get_playback_status() { if (this.player.playing) { return "Playing"; - } else if ( - this.player.state === GstPlay.PlayState.PAUSED - ) { + } else if (this.player.state === GstPlay.PlayState.PAUSED) { return "Paused"; } else { return "Stopped"; @@ -355,8 +341,9 @@ export class MPRIS extends DBusInterface { .map((artist) => artist.name) .map((artist) => GLib.Variant.new_string(artist)); - const largest_thumbnail = track.thumbnails - .sort((a, b) => b.width - a.width)[0]; + const largest_thumbnail = track.thumbnails.sort( + (a, b) => b.width - a.width, + )[0]; const metadata = { "mpris:trackid": GLib.Variant.new_object_path(song_dbus_path), @@ -385,9 +372,9 @@ export class MPRIS extends DBusInterface { if (!this.player.queue.current?.object) { return "/org/mpris/MediaPlayer2/TrackList/NoTrack"; } else { - return `/com/vixalien/muzika/TrackList/${ - hex_encode(this.player.queue.current.object.videoId.replace(/-/g, "_")) - }`; + return `/com/vixalien/muzika/TrackList/${hex_encode( + this.player.queue.current.object.videoId.replace(/-/g, "_"), + )}`; } } @@ -581,12 +568,9 @@ export class MPRIS extends DBusInterface { */ _seeked(position: number) { // TODO: this doesn't work for some reason - this._dbus_emit_signal( - "Seeked", - { - Position: position, - }, - ); + this._dbus_emit_signal("Seeked", { + Position: position, + }); } _get>( @@ -710,9 +694,9 @@ export class MPRIS extends DBusInterface { invalidated_properties: string[], ) { this._dbus_emit_signal("PropertiesChanged", { - "interface_name": interface_name, - "changed_properties": changed_properties, - "invalidated_properties": invalidated_properties, + interface_name: interface_name, + changed_properties: changed_properties, + invalidated_properties: invalidated_properties, }); } @@ -726,9 +710,9 @@ export class MPRIS extends DBusInterface { } function hex_encode(string: string) { - var hex, i; + let hex, i; - var result = ""; + let result = ""; for (i = 0; i < string.length; i++) { hex = string.charCodeAt(i).toString(16); result += ("000" + hex).slice(-4); diff --git a/src/muse.ts b/src/muse.ts index 32d56090..bf9d431a 100644 --- a/src/muse.ts +++ b/src/muse.ts @@ -53,18 +53,15 @@ class CustomFetch extends FetchClient { console.debug("REQUEST", options.method, path); // caching - const cache_name = `${ - hash( - JSON.stringify({ ...options.data, ...options.params, path } || {}), - ) - }.json`; + const cache_name = `${hash( + JSON.stringify({ ...options.data, ...options.params, path } || {}), + )}.json`; const cache = this.CACHE && !path.startsWith("like/"); - const cached_file = Gio.file_new_for_path(GLib.build_filenamev([ - this.cache_dir.get_path()!, - cache_name, - ])); + const cached_file = Gio.file_new_for_path( + GLib.build_filenamev([this.cache_dir.get_path()!, cache_name]), + ); try { const cached_contents = decoder.decode( @@ -96,11 +93,7 @@ class CustomFetch extends FetchClient { // ); cached_file.replace_contents( - JSON.stringify( - await response.clone().json(), - null, - 2, - ), + JSON.stringify(await response.clone().json(), null, 2), null, false, Gio.FileCreateFlags.NONE, diff --git a/src/navigation.ts b/src/navigation.ts index 590573cf..bb33c7b0 100644 --- a/src/navigation.ts +++ b/src/navigation.ts @@ -44,32 +44,35 @@ export class Navigator extends GObject.Object { loading = false; static { - GObject.registerClass({ - Signals: { - navigate: {}, - "load-start": {}, - "load-end": {}, - "search-changed": { - param_types: [GObject.TYPE_STRING], + GObject.registerClass( + { + Signals: { + navigate: {}, + "load-start": {}, + "load-end": {}, + "search-changed": { + param_types: [GObject.TYPE_STRING], + }, + }, + Properties: { + loading: GObject.ParamSpec.boolean( + "loading", + "Loading", + "Whether something is loading currently", + GObject.ParamFlags.READWRITE, + false, + ), + current_uri: GObject.ParamSpec.string( + "current-uri", + "Current URI", + "The current URI", + GObject.ParamFlags.READABLE, + "", + ), }, }, - Properties: { - loading: GObject.ParamSpec.boolean( - "loading", - "Loading", - "Whether something is loading currently", - GObject.ParamFlags.READWRITE, - false, - ), - current_uri: GObject.ParamSpec.string( - "current-uri", - "Current URI", - "The current URI", - GObject.ParamFlags.READABLE, - "", - ), - }, - }, this); + this, + ); } private _visible_page_signal: number; @@ -187,7 +190,8 @@ export class Navigator extends GObject.Object { this.abort_current(); - return page.reload(this.abort_controller!.signal) + return page + .reload(this.abort_controller!.signal) ?.catch((error) => { if (error instanceof DOMException && error.name == "AbortError") return; page.show_error(error); @@ -206,7 +210,8 @@ export class Navigator extends GObject.Object { const page = new Page(meta); this._view.push(page); - page.load(uri, match, this.abort_controller!.signal) + page + .load(uri, match, this.abort_controller!.signal) .then(() => { this.reset_abort_controller(); }) @@ -303,14 +308,12 @@ export class Navigator extends GObject.Object { if (match) { page.load; - return page.load( - uri, - match.match, - this.abort_controller!.signal, - ) + return page + .load(uri, match.match, this.abort_controller!.signal) ?.then(() => { this.reset_abort_controller(); - }).catch((error) => { + }) + .catch((error) => { if (error instanceof DOMException && error.name == "AbortError") { return; } @@ -352,7 +355,7 @@ export class Navigator extends GObject.Object { } export function get_navigator(widget?: Gtk.Widget) { - const window = ((widget?.root) || get_window()) as Window; + const window = (widget?.root || get_window()) as Window; return window.navigator; } diff --git a/src/pages/album.ts b/src/pages/album.ts index 7a0a2827..6be4c0ed 100644 --- a/src/pages/album.ts +++ b/src/pages/album.ts @@ -27,25 +27,30 @@ interface AlbumProps { interface AlbumState extends VScrollState, AlbumProps {} -export class AlbumPage extends Adw.Bin - implements MuzikaPageWidget { +export class AlbumPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "AlbumPage", - Template: "resource:///com/vixalien/muzika/ui/pages/album.ui", - InternalChildren: [ - "trackCount", - "duration", - "insights_clamp", - "insights", - "playlist_item_view", - "header", - "menu", - "scrolled", - "play_button", - "shuffle_button", - ], - }, this); + GObject.registerClass( + { + GTypeName: "AlbumPage", + Template: "resource:///com/vixalien/muzika/ui/pages/album.ui", + InternalChildren: [ + "trackCount", + "duration", + "insights_clamp", + "insights", + "playlist_item_view", + "header", + "menu", + "scrolled", + "play_button", + "shuffle_button", + ], + }, + this, + ); } album?: AlbumResult; @@ -108,8 +113,8 @@ export class AlbumPage extends Adw.Bin this.album = album; this._playlist_item_view.playlistId = album.audioPlaylistId ?? undefined; - this._playlist_item_view.show_artists = album.tracks.some((track) => - track.artists.length > 0 + this._playlist_item_view.show_artists = album.tracks.some( + (track) => track.artists.length > 0, ); this._header.load_thumbnails(album.thumbnails); diff --git a/src/pages/artist-albums.ts b/src/pages/artist-albums.ts index c866b922..359cfa00 100644 --- a/src/pages/artist-albums.ts +++ b/src/pages/artist-albums.ts @@ -21,14 +21,19 @@ interface ArtistAlbumsState extends VScrollState { GObject.type_ensure(CarouselGridView.$gtype); -export class ArtistAlbumsPage extends Adw.Bin - implements MuzikaPageWidget { +export class ArtistAlbumsPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "ArtistAlbumsPage", - Template: "resource:///com/vixalien/muzika/ui/pages/artist-albums.ui", - InternalChildren: ["view", "scrolled"], - }, this); + GObject.registerClass( + { + GTypeName: "ArtistAlbumsPage", + Template: "resource:///com/vixalien/muzika/ui/pages/artist-albums.ui", + InternalChildren: ["view", "scrolled"], + }, + this, + ); } private _view!: CarouselGridView; @@ -68,9 +73,7 @@ export class ArtistAlbumsPage extends Adw.Bin if (item.videoId) { this.activate_action( "queue.play-song", - GLib.Variant.new_string( - item.videoId, - ), + GLib.Variant.new_string(item.videoId), ); } break; diff --git a/src/pages/artist.ts b/src/pages/artist.ts index e8b1d78d..dc28c809 100644 --- a/src/pages/artist.ts +++ b/src/pages/artist.ts @@ -34,8 +34,10 @@ interface ArtistState extends VScrollState { GObject.type_ensure(PlaylistHeader.$gtype); GObject.type_ensure(PlaylistListView.$gtype); -export class ArtistPage extends Adw.Bin - implements MuzikaPageWidget { +export class ArtistPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { GObject.registerClass( { @@ -100,7 +102,7 @@ export class ArtistPage extends Adw.Bin n > 0 ? n - 1 : 0, 0, songs.results.map((track) => - PlayableContainer.new_from_playlist_item(track) + PlayableContainer.new_from_playlist_item(track), ), ); } else { @@ -190,7 +192,7 @@ export class ArtistPage extends Adw.Bin this.subscribe_controller = new AbortController(); - const old_subscribed = this.artist!.subscribed; + const old_subscribed = this.artist.subscribed; const options = [ [this.artist.channelId], @@ -207,7 +209,7 @@ export class ArtistPage extends Adw.Bin } // being optimistic... - this.artist!.subscribed = !old_subscribed; + this.artist.subscribed = !old_subscribed; this.update_subscribe_button(); const vprint_artist = (string: string) => { diff --git a/src/pages/authentication-error.ts b/src/pages/authentication-error.ts index 12243de5..1d33c985 100644 --- a/src/pages/authentication-error.ts +++ b/src/pages/authentication-error.ts @@ -9,17 +9,15 @@ import { error_to_string, ErrorPageOptions } from "./error.js"; export class AuthenticationErrorPage extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "AuthenticationErrorPage", - Template: - "resource:///com/vixalien/muzika/ui/pages/authentication-error.ui", - InternalChildren: [ - "status", - "more", - "text_view", - "home_button", - ], - }, this); + GObject.registerClass( + { + GTypeName: "AuthenticationErrorPage", + Template: + "resource:///com/vixalien/muzika/ui/pages/authentication-error.ui", + InternalChildren: ["status", "more", "text_view", "home_button"], + }, + this, + ); } _status!: Adw.StatusPage; @@ -69,7 +67,9 @@ export class AuthenticationErrorPage extends Adw.Bin { if (get_option("auth").has_token()) { this._status.set_description( - _("Your authentication details have expired. Please log in again or go to home."), + _( + "Your authentication details have expired. Please log in again or go to home.", + ), ); } else { this._status.set_description( diff --git a/src/pages/channel-playlists.ts b/src/pages/channel-playlists.ts index 5fc77f74..c5093575 100644 --- a/src/pages/channel-playlists.ts +++ b/src/pages/channel-playlists.ts @@ -21,14 +21,20 @@ interface ChannelPlaylistsState extends VScrollState { GObject.type_ensure(CarouselGridView.$gtype); -export class ChannelPlaylistsPage extends Adw.Bin - implements MuzikaPageWidget { +export class ChannelPlaylistsPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "ChannelPlaylistsPage", - Template: "resource:///com/vixalien/muzika/ui/pages/channel-playlists.ui", - InternalChildren: ["view", "scrolled"], - }, this); + GObject.registerClass( + { + GTypeName: "ChannelPlaylistsPage", + Template: + "resource:///com/vixalien/muzika/ui/pages/channel-playlists.ui", + InternalChildren: ["view", "scrolled"], + }, + this, + ); } private _view!: CarouselGridView; @@ -68,9 +74,7 @@ export class ChannelPlaylistsPage extends Adw.Bin if (item.videoId) { this.activate_action( "queue.play-song", - GLib.Variant.new_string( - item.videoId, - ), + GLib.Variant.new_string(item.videoId), ); } break; diff --git a/src/pages/channel.ts b/src/pages/channel.ts index 20fcd6f1..f302fa7a 100644 --- a/src/pages/channel.ts +++ b/src/pages/channel.ts @@ -24,21 +24,26 @@ interface ChannelState extends VScrollState { GObject.type_ensure(PlaylistHeader.$gtype); GObject.type_ensure(PlaylistListView.$gtype); -export class ChannelPage extends Adw.Bin - implements MuzikaPageWidget { +export class ChannelPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "ChannelPage", - Template: "resource:///com/vixalien/muzika/ui/pages/channel.ui", - InternalChildren: [ - "songs_on_repeat", - "playlist_item_view", - "header", - "carousels", - "menu", - "scrolled", - ], - }, this); + GObject.registerClass( + { + GTypeName: "ChannelPage", + Template: "resource:///com/vixalien/muzika/ui/pages/channel.ui", + InternalChildren: [ + "songs_on_repeat", + "playlist_item_view", + "header", + "carousels", + "menu", + "scrolled", + ], + }, + this, + ); } channel?: Channel; @@ -137,7 +142,7 @@ export class ChannelPage extends Adw.Bin const carousel = new Carousel(); carousel.setup_more_button( - (show_more_button && data.browseId != null && data.params != null) + show_more_button && data.browseId != null && data.params != null ? `navigator.visit("muzika:channel-playlists:${data.browseId}:${data.params}")` : null, ); diff --git a/src/pages/charts.ts b/src/pages/charts.ts index aec1f631..6fb919ba 100644 --- a/src/pages/charts.ts +++ b/src/pages/charts.ts @@ -21,14 +21,19 @@ export interface ChartsPageState extends VScrollState { contents: Charts; } -export class ChartsPage extends Adw.Bin - implements MuzikaPageWidget { +export class ChartsPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "ChartsPage", - Template: "resource:///com/vixalien/muzika/ui/pages/charts.ui", - InternalChildren: ["scrolled", "box", "drop_down"], - }, this); + GObject.registerClass( + { + GTypeName: "ChartsPage", + Template: "resource:///com/vixalien/muzika/ui/pages/charts.ui", + InternalChildren: ["scrolled", "box", "drop_down"], + }, + this, + ); } private _scrolled!: Gtk.ScrolledWindow; @@ -49,9 +54,7 @@ export class ChartsPage extends Adw.Bin this.activate_action( `navigator.replace`, - GLib.Variant.new_string( - `muzika:charts?country=${country.code}`, - ), + GLib.Variant.new_string(`muzika:charts?country=${country.code}`), ); }); } @@ -121,7 +124,7 @@ export class ChartsPage extends Adw.Bin const carousel = new Carousel(); carousel.setup_more_button( - (show_more_button && data.browseId != null) + show_more_button && data.browseId != null ? data.params != null ? `navigator.visit("muzika:artist-albums:${data.browseId}:${data.params}")` : `navigator.visit("muzika:playlist:${data.browseId}")` @@ -147,7 +150,7 @@ export class ChartsPage extends Adw.Bin const carousel = new Carousel(); carousel.setup_more_button( - (show_more_button && data.browseId != null) + show_more_button && data.browseId != null ? data.params != null ? `navigator.visit("muzika:artist-albums:${data.browseId}:${data.params}")` : `navigator.visit("muzika:playlist:${data.browseId}")` diff --git a/src/pages/error.ts b/src/pages/error.ts index fab5443c..7a8a7c87 100644 --- a/src/pages/error.ts +++ b/src/pages/error.ts @@ -8,9 +8,9 @@ import { escape_label, indent_stack } from "src/util/text"; export function error_to_string(error: Error) { // must show error name, message, and stack - return `${escape_label(error.name)}: ${escape_label(error.message)}\n${ - indent_stack(error.stack ?? "") - }`; + return `${escape_label(error.name)}: ${escape_label(error.message)}\n${indent_stack( + error.stack ?? "", + )}`; } export interface ErrorPageOptions { @@ -19,15 +19,14 @@ export interface ErrorPageOptions { export class ErrorPage extends Adw.Bin { static { - GObject.registerClass({ - GTypeName: "ErrorPage", - Template: "resource:///com/vixalien/muzika/ui/pages/error.ui", - InternalChildren: [ - "status", - "more", - "text_view", - ], - }, this); + GObject.registerClass( + { + GTypeName: "ErrorPage", + Template: "resource:///com/vixalien/muzika/ui/pages/error.ui", + InternalChildren: ["status", "more", "text_view"], + }, + this, + ); } _status!: Adw.StatusPage; diff --git a/src/pages/explore.ts b/src/pages/explore.ts index 45478263..6267d892 100644 --- a/src/pages/explore.ts +++ b/src/pages/explore.ts @@ -3,11 +3,7 @@ import GObject from "gi://GObject"; import Adw from "gi://Adw"; import { get_explore } from "libmuse"; -import type { - Category, - ExploreContents, - ParsedMoodOrGenre, -} from "libmuse"; +import type { Category, ExploreContents, ParsedMoodOrGenre } from "libmuse"; import { Carousel } from "../components/carousel/index.js"; import { Loading } from "../components/loading.js"; @@ -24,14 +20,19 @@ export interface ExplorePageState extends VScrollState { contents: ExploreContents; } -export class ExplorePage extends Adw.Bin - implements MuzikaPageWidget { +export class ExplorePage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "ExplorePage", - Template: "resource:///com/vixalien/muzika/ui/pages/explore.ui", - InternalChildren: ["scrolled", "box"], - }, this); + GObject.registerClass( + { + GTypeName: "ExplorePage", + Template: "resource:///com/vixalien/muzika/ui/pages/explore.ui", + InternalChildren: ["scrolled", "box"], + }, + this, + ); } private _scrolled!: Gtk.ScrolledWindow; @@ -91,7 +92,7 @@ export class ExplorePage extends Adw.Bin const carousel = new Carousel(); carousel.setup_more_button( - (show_more_button && data.browseId != null) + show_more_button && data.browseId != null ? data.params != null ? `navigator.visit("muzika:artist-albums:${data.browseId}:${data.params}")` : `navigator.visit("muzika:playlist:${data.browseId}")` diff --git a/src/pages/home.ts b/src/pages/home.ts index 6b8d0075..24327c1c 100644 --- a/src/pages/home.ts +++ b/src/pages/home.ts @@ -24,14 +24,25 @@ export interface HomePageState extends VScrollState { home: Home; } -export class HomePage extends Adw.Bin - implements MuzikaPageWidget { +export class HomePage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "HomePage", - Template: "resource:///com/vixalien/muzika/ui/pages/home.ui", - InternalChildren: ["scrolled", "box", "paginator", "carousels", "moods"], - }, this); + GObject.registerClass( + { + GTypeName: "HomePage", + Template: "resource:///com/vixalien/muzika/ui/pages/home.ui", + InternalChildren: [ + "scrolled", + "box", + "paginator", + "carousels", + "moods", + ], + }, + this, + ); } private _scrolled!: Gtk.ScrolledWindow; @@ -142,7 +153,8 @@ export class HomePage extends Adw.Bin if ( vadjustment.get_upper() - - (vadjustment.get_value() + vadjustment.get_page_size()) < 300 + (vadjustment.get_value() + vadjustment.get_page_size()) < + 300 ) { return true; } @@ -158,7 +170,8 @@ export class HomePage extends Adw.Bin // scroll if the scrolled window is not full if ( this._scrolled.get_vadjustment().get_upper() - - this._scrolled.get_vadjustment().get_page_size() < 0 + this._scrolled.get_vadjustment().get_page_size() < + 0 ) { this.load_more(); } @@ -194,7 +207,9 @@ export class HomePage extends Adw.Bin }) .catch(() => { add_toast( - _("Couldn't get more items from your home feed. Please try again later."), + _( + "Couldn't get more items from your home feed. Please try again later.", + ), ); this._paginator.can_paginate = !!this.home?.continuation; diff --git a/src/pages/library/albums.ts b/src/pages/library/albums.ts index 5aae528f..257bc503 100644 --- a/src/pages/library/albums.ts +++ b/src/pages/library/albums.ts @@ -6,9 +6,12 @@ import { AbstractLibraryPage } from "./base"; export class LibraryAlbumsPage extends AbstractLibraryPage { static { - GObject.registerClass({ - GTypeName: "LibraryAlbumsPage", - }, this); + GObject.registerClass( + { + GTypeName: "LibraryAlbumsPage", + }, + this, + ); } constructor() { diff --git a/src/pages/library/artists.ts b/src/pages/library/artists.ts index 6cf4c25d..1c83eb75 100644 --- a/src/pages/library/artists.ts +++ b/src/pages/library/artists.ts @@ -6,9 +6,12 @@ import { AbstractLibraryPage } from "./base"; export class LibraryArtistsPage extends AbstractLibraryPage { static { - GObject.registerClass({ - GTypeName: "LibraryArtistsPage", - }, this); + GObject.registerClass( + { + GTypeName: "LibraryArtistsPage", + }, + this, + ); } constructor() { diff --git a/src/pages/library/base.ts b/src/pages/library/base.ts index b1783326..f83847aa 100644 --- a/src/pages/library/base.ts +++ b/src/pages/library/base.ts @@ -37,13 +37,12 @@ export function order_id_to_name(string: string, orders: Map) { type LibraryResults = LibraryItems; -export type LibraryLoader = ( - options?: { +export type LibraryLoader = + (options?: { continuation?: string; signal?: AbortSignal; order?: PageOrder; - }, -) => Promise; + }) => Promise; export interface LibraryPageOptions { orders?: Map; @@ -57,11 +56,15 @@ interface LibraryState extends VScrollState { export class AbstractLibraryPage extends Adw.Bin - implements MuzikaPageWidget { + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "AbstractLibraryPage", - }, this); + GObject.registerClass( + { + GTypeName: "AbstractLibraryPage", + }, + this, + ); } private view: LibraryView; @@ -106,7 +109,7 @@ export class AbstractLibraryPage handle_order_changed(_: Gtk.Widget, order_name: string) { const order = this.orders.get(order_name); - this.order = order as PageOrder ?? undefined; + this.order = (order as PageOrder) ?? undefined; if (!order) return; @@ -162,9 +165,10 @@ export class AbstractLibraryPage load_more() { if (this.loading || !this.results?.continuation) return; - (this.constructor as typeof AbstractLibraryPage).loader({ - continuation: this.results.continuation, - }) + (this.constructor as typeof AbstractLibraryPage) + .loader({ + continuation: this.results.continuation, + }) .then((library) => { this.results!.items.push(...library.items); this.results!.continuation = library.continuation; @@ -187,8 +191,8 @@ export class AbstractLibraryPage return function (context: PageLoadContext) { return (loader as LibraryLoader)({ signal: context.signal, - order: context.url.searchParams.get("order") as LibraryOrder ?? - undefined, + order: + (context.url.searchParams.get("order") as LibraryOrder) ?? undefined, }).then((results) => { return { results, diff --git a/src/pages/library/history.ts b/src/pages/library/history.ts index d6e49bfb..b8c6b146 100644 --- a/src/pages/library/history.ts +++ b/src/pages/library/history.ts @@ -26,9 +26,12 @@ interface HistoryState extends VScrollState { class HistoryTitle extends Gtk.Box { static { - GObject.registerClass({ - GTypeName: "HistoryTitle", - }, this); + GObject.registerClass( + { + GTypeName: "HistoryTitle", + }, + this, + ); } private label_widget: Gtk.Label; @@ -48,7 +51,7 @@ class HistoryTitle extends Gtk.Box { }); this.label_widget = new Gtk.Label({ - label: props.title ?? null as unknown as string, + label: props.title ?? (null as unknown as string), hexpand: true, xalign: 0, }); @@ -63,15 +66,20 @@ interface CategoryMeta { title: string; } -export class HistoryPage extends Adw.Bin - implements MuzikaPageWidget { +export class HistoryPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "HistoryPage", - Template: - "resource:///com/vixalien/muzika/ui/components/library/history.ui", - InternalChildren: ["item_view", "scrolled"], - }, this); + GObject.registerClass( + { + GTypeName: "HistoryPage", + Template: + "resource:///com/vixalien/muzika/ui/components/library/history.ui", + InternalChildren: ["item_view", "scrolled"], + }, + this, + ); } private _item_view!: PlaylistItemView; @@ -127,19 +135,17 @@ export class HistoryPage extends Adw.Bin private show_library(library: History) { const items = library.categories.reduce((acc, category) => { - return acc.concat(category.items.map((item, index) => { - return SectionedPlayableContainer.new_from_playlist_item( - item, - index === 0 ? { title: category.title } : undefined, - ); - })); + return acc.concat( + category.items.map((item, index) => { + return SectionedPlayableContainer.new_from_playlist_item( + item, + index === 0 ? { title: category.title } : undefined, + ); + }), + ); }, [] as SectionedPlayableContainer[]); - this.model.splice( - this.model.n_items, - 0, - items, - ); + this.model.splice(this.model.n_items, 0, items); } get_state() { diff --git a/src/pages/library/index.ts b/src/pages/library/index.ts index 5a0cf0a0..6a8868c2 100644 --- a/src/pages/library/index.ts +++ b/src/pages/library/index.ts @@ -8,9 +8,12 @@ import { RequiredMixedItem } from "src/components/carousel/index.js"; export class LibraryPage extends AbstractLibraryPage { static { - GObject.registerClass({ - GTypeName: "LibraryPage", - }, this); + GObject.registerClass( + { + GTypeName: "LibraryPage", + }, + this, + ); } constructor() { diff --git a/src/pages/library/playlists.ts b/src/pages/library/playlists.ts index ca862437..fba59141 100644 --- a/src/pages/library/playlists.ts +++ b/src/pages/library/playlists.ts @@ -6,9 +6,12 @@ import { AbstractLibraryPage } from "./base"; export class LibraryPlaylistsPage extends AbstractLibraryPage { static { - GObject.registerClass({ - GTypeName: "LibraryPlaylistsPage", - }, this); + GObject.registerClass( + { + GTypeName: "LibraryPlaylistsPage", + }, + this, + ); } constructor() { diff --git a/src/pages/library/songs.ts b/src/pages/library/songs.ts index 3f1a7ab4..7b96aff2 100644 --- a/src/pages/library/songs.ts +++ b/src/pages/library/songs.ts @@ -20,15 +20,20 @@ import { add_toast } from "src/util/window.js"; // make sure paginator is registered before LibrarySongsPage GObject.type_ensure(Paginator.$gtype); -export class LibrarySongsPage extends Adw.Bin - implements MuzikaPageWidget { +export class LibrarySongsPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "LibrarySongsPage", - Template: - "resource:///com/vixalien/muzika/ui/components/library/songs.ui", - InternalChildren: ["item_view", "drop_down", "paginator", "scrolled"], - }, this); + GObject.registerClass( + { + GTypeName: "LibrarySongsPage", + Template: + "resource:///com/vixalien/muzika/ui/components/library/songs.ui", + InternalChildren: ["item_view", "drop_down", "paginator", "scrolled"], + }, + this, + ); } private _drop_down!: Gtk.DropDown; @@ -67,11 +72,11 @@ export class LibrarySongsPage extends Adw.Bin handle_order_changed(order_name: string) { const order = alphabetical_orders.get(order_name); - this.order = order as Order ?? undefined; + this.order = (order as Order) ?? undefined; if (!order) return; - let url = `muzika:${this.uri}?order=${order}`; + const url = `muzika:${this.uri}?order=${order}`; this.activate_action("navigator.replace", GLib.Variant.new_string(url)); } @@ -156,12 +161,11 @@ export class LibrarySongsPage extends Adw.Bin static load(context: PageLoadContext): Promise { return get_library_songs({ signal: context.signal, - order: context.url.searchParams.get("order") as Order ?? - undefined, + order: (context.url.searchParams.get("order") as Order) ?? undefined, }).then((results) => { return { results, - order: context.url.searchParams.get("order") as Order ?? undefined, + order: (context.url.searchParams.get("order") as Order) ?? undefined, }; }); } diff --git a/src/pages/library/subscriptions.ts b/src/pages/library/subscriptions.ts index ea7909f7..c1fc61fc 100644 --- a/src/pages/library/subscriptions.ts +++ b/src/pages/library/subscriptions.ts @@ -6,9 +6,12 @@ import { AbstractLibraryPage } from "./base"; export class LibrarySubscriptionsPage extends AbstractLibraryPage { static { - GObject.registerClass({ - GTypeName: "LibrarySubscriptionsPage", - }, this); + GObject.registerClass( + { + GTypeName: "LibrarySubscriptionsPage", + }, + this, + ); } constructor() { diff --git a/src/pages/login.ts b/src/pages/login.ts index 8d344bef..5b2e874d 100644 --- a/src/pages/login.ts +++ b/src/pages/login.ts @@ -11,20 +11,23 @@ import type { LoginCode } from "libmuse"; export class LoginDialog extends Adw.Dialog { static { - GObject.registerClass({ - GTypeName: "LoginDialog", - Template: "resource:///com/vixalien/muzika/ui/pages/login.ui", - InternalChildren: [ - "stack", - "spinner", - "flow", - "qr", - "link", - "code", - "button", - "toast_overlay", - ], - }, this); + GObject.registerClass( + { + GTypeName: "LoginDialog", + Template: "resource:///com/vixalien/muzika/ui/pages/login.ui", + InternalChildren: [ + "stack", + "spinner", + "flow", + "qr", + "link", + "code", + "button", + "toast_overlay", + ], + }, + this, + ); } _stack!: Gtk.Stack; @@ -92,7 +95,7 @@ export class LoginDialog extends Adw.Dialog { this._last_signal = undefined; }) .catch((error) => { - if ((error instanceof DOMException) && error.name === "AbortError") { + if (error instanceof DOMException && error.name === "AbortError") { return; } @@ -101,7 +104,9 @@ export class LoginDialog extends Adw.Dialog { } else { this._toast_overlay.add_toast( Adw.Toast.new( - _("An Error happened while trying to log you in. Generating a new code…"), + _( + "An Error happened while trying to log you in. Generating a new code…", + ), ), ); this.errored_before = true; diff --git a/src/pages/mood-playlists.ts b/src/pages/mood-playlists.ts index 237cc1ea..bcb848ab 100644 --- a/src/pages/mood-playlists.ts +++ b/src/pages/mood-playlists.ts @@ -19,14 +19,19 @@ export interface MoodPlaylistsPageState extends VScrollState { contents: MoodPlaylists; } -export class MoodPlaylistsPage extends Adw.Bin - implements MuzikaPageWidget { +export class MoodPlaylistsPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "MoodPlaylistsPage", - Template: "resource:///com/vixalien/muzika/ui/pages/mood-playlists.ui", - InternalChildren: ["scrolled", "box"], - }, this); + GObject.registerClass( + { + GTypeName: "MoodPlaylistsPage", + Template: "resource:///com/vixalien/muzika/ui/pages/mood-playlists.ui", + InternalChildren: ["scrolled", "box"], + }, + this, + ); } private _scrolled!: Gtk.ScrolledWindow; @@ -74,9 +79,7 @@ export class MoodPlaylistsPage extends Adw.Bin } } - private add_carousel( - data: MoodPlaylists["categories"][0], - ) { + private add_carousel(data: MoodPlaylists["categories"][0]) { if (!data || data.playlists.length === 0) return; const carousel = new Carousel(); diff --git a/src/pages/moods.ts b/src/pages/moods.ts index 3db8d038..076676bb 100644 --- a/src/pages/moods.ts +++ b/src/pages/moods.ts @@ -19,14 +19,19 @@ export interface MoodsPageState extends VScrollState { contents: MoodCategories; } -export class MoodsPage extends Adw.Bin - implements MuzikaPageWidget { +export class MoodsPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "MoodsPage", - Template: "resource:///com/vixalien/muzika/ui/pages/moods.ui", - InternalChildren: ["scrolled", "box"], - }, this); + GObject.registerClass( + { + GTypeName: "MoodsPage", + Template: "resource:///com/vixalien/muzika/ui/pages/moods.ui", + InternalChildren: ["scrolled", "box"], + }, + this, + ); } private _scrolled!: Gtk.ScrolledWindow; @@ -72,9 +77,7 @@ export class MoodsPage extends Adw.Bin return; } - private add_carousel( - data: MoodCategories["categories"][0], - ) { + private add_carousel(data: MoodCategories["categories"][0]) { if (!data || data.items.length === 0) return; const carousel = new Carousel(); diff --git a/src/pages/new-releases.ts b/src/pages/new-releases.ts index 7bd49eac..17b03f6a 100644 --- a/src/pages/new-releases.ts +++ b/src/pages/new-releases.ts @@ -19,14 +19,19 @@ export interface NewReleasesPageState extends VScrollState { contents: NewReleases; } -export class NewReleasesPage extends Adw.Bin - implements MuzikaPageWidget { +export class NewReleasesPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "NewReleasesPage", - Template: "resource:///com/vixalien/muzika/ui/pages/new-releases.ui", - InternalChildren: ["scrolled", "box"], - }, this); + GObject.registerClass( + { + GTypeName: "NewReleasesPage", + Template: "resource:///com/vixalien/muzika/ui/pages/new-releases.ui", + InternalChildren: ["scrolled", "box"], + }, + this, + ); } private _scrolled!: Gtk.ScrolledWindow; diff --git a/src/pages/playlist.ts b/src/pages/playlist.ts index 7deb14f7..a8b740bd 100644 --- a/src/pages/playlist.ts +++ b/src/pages/playlist.ts @@ -49,32 +49,37 @@ GObject.type_ensure(PlaylistHeader.$gtype); GObject.type_ensure(PlaylistItemView.$gtype); GObject.type_ensure(PlaylistBar.$gtype); -export class PlaylistPage extends Adw.Bin - implements MuzikaPageWidget { +export class PlaylistPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "PlaylistPage", - Template: "resource:///com/vixalien/muzika/ui/pages/playlist.ui", - InternalChildren: [ - "trackCount", - "separator", - "duration", - "scrolled", - "data", - "playlist_item_view", - "paginator", - "header", - "bar", - "suggestions", - "suggestions_item_view", - "insights_clamp", - "insights", - "menu", - "shuffle_button", - "edit_playlist_button", - "add_to_library_button", - ], - }, this); + GObject.registerClass( + { + GTypeName: "PlaylistPage", + Template: "resource:///com/vixalien/muzika/ui/pages/playlist.ui", + InternalChildren: [ + "trackCount", + "separator", + "duration", + "scrolled", + "data", + "playlist_item_view", + "paginator", + "header", + "bar", + "suggestions", + "suggestions_item_view", + "insights_clamp", + "insights", + "menu", + "shuffle_button", + "edit_playlist_button", + "add_to_library_button", + ], + }, + this, + ); } playlist?: Playlist; @@ -182,15 +187,17 @@ export class PlaylistPage extends Adw.Bin Adw.ResponseAppearance.DESTRUCTIVE, ); - const response = await dialog.choose(get_window(), null) + const response = await dialog + .choose(get_window(), null) .catch(console.error); if (response === "delete") { - delete_playlist(this.playlist!.id) + delete_playlist(this.playlist.id) .then(() => { add_toast(_("Playlist deleted")); this.activate_action("navigation.pop", null); - }).catch(() => { + }) + .catch(() => { add_toast(_("Couldn't delete playlist")); }); } @@ -234,7 +241,9 @@ export class PlaylistPage extends Adw.Bin const dialog = Adw.AlertDialog.new( _("Remove from playlist"), - _(" Are you sure that you want to remove the selected content from the playlist? "), + _( + " Are you sure that you want to remove the selected content from the playlist? ", + ), ); dialog.add_response("cancel", _("Cancel")); @@ -244,14 +253,17 @@ export class PlaylistPage extends Adw.Bin Adw.ResponseAppearance.DESTRUCTIVE, ); - const response = await dialog.choose(get_window(), null) + const response = await dialog + .choose(get_window(), null) .catch(console.error); if (response === "remove") { - const message = await remove_playlist_items(this.playlist!.id, items) - .catch((err) => { - console.error(err); - }); + const message = await remove_playlist_items( + this.playlist.id, + items, + ).catch((err) => { + console.error(err); + }); if (message?.status === "STATUS_SUCCEEDED") { success_toast(); @@ -359,8 +371,8 @@ export class PlaylistPage extends Adw.Bin this._playlist_item_view.playlistId = playlist.id; this._playlist_item_view.editable = this._bar.editable = playlist.editable; - this._playlist_item_view.show_rank = playlist.tracks[0] && - playlist.tracks[0].rank != null; + this._playlist_item_view.show_rank = + playlist.tracks[0] && playlist.tracks[0].rank != null; this._bar.playlistId = this.playlist.id; this._suggestions.visible = this.playlist.editable; @@ -408,7 +420,7 @@ export class PlaylistPage extends Adw.Bin 0, this.suggestions_model.n_items, playlist.suggestions.map((suggestion) => - PlayableContainer.new_from_playlist_item(suggestion) + PlayableContainer.new_from_playlist_item(suggestion), ), ); @@ -441,7 +453,7 @@ export class PlaylistPage extends Adw.Bin 0, this.suggestions_model.n_items, result.suggestions.map((suggestion) => - PlayableContainer.new(suggestion) + PlayableContainer.new(suggestion), ), ); }) @@ -457,35 +469,34 @@ export class PlaylistPage extends Adw.Bin private setup_menu() { if (!this.playlist) return; - this._menu.set_menu_model(generate_menu([ - [ - _("Start Radio"), - `queue.play-playlist("${this.playlist.id}?radio=true")`, - ], - [_("Play Next"), `queue.add-playlist("${this.playlist.id}?next=true")`], - [_("Add to queue"), `queue.add-playlist("${this.playlist.id}")`], - { - section: null, - items: [ - [ - _("Select tracks…"), - `playlist.select`, - ], - this.playlist.editable - ? [_("Delete Playlist…"), `playlist.delete`] - : null, + this._menu.set_menu_model( + generate_menu([ + [ + _("Start Radio"), + `queue.play-playlist("${this.playlist.id}?radio=true")`, ], - }, - { - section: null, - items: [ - [ - _("Copy Link"), - `win.copy-url("https://music.youtube.com/playlist?list=${this.playlist.id}")`, + [_("Play Next"), `queue.add-playlist("${this.playlist.id}?next=true")`], + [_("Add to queue"), `queue.add-playlist("${this.playlist.id}")`], + { + section: null, + items: [ + [_("Select tracks…"), `playlist.select`], + this.playlist.editable + ? [_("Delete Playlist…"), `playlist.delete`] + : null, ], - ], - }, - ])); + }, + { + section: null, + items: [ + [ + _("Copy Link"), + `win.copy-url("https://music.youtube.com/playlist?list=${this.playlist.id}")`, + ], + ], + }, + ]), + ); } no_more = false; @@ -544,7 +555,7 @@ export class PlaylistPage extends Adw.Bin ...this.playlist!, tracks: list_model_to_array(this.model) .map((container) => (container as PlayableContainer).object) - .filter((item) => item != null) as PlaylistItem[], + .filter((item) => item != null), }, vscroll: this._scrolled.get_vadjustment().get_value(), }; diff --git a/src/pages/preferences.ts b/src/pages/preferences.ts index 2633c099..5ea9719e 100644 --- a/src/pages/preferences.ts +++ b/src/pages/preferences.ts @@ -9,15 +9,14 @@ import { Settings } from "src/util/settings.js"; export class MuzikaPreferencesDialog extends Adw.PreferencesDialog { static { - GObject.registerClass({ - GTypeName: "MuzikaPreferencesDialog", - Template: "resource:///com/vixalien/muzika/ui/pages/preferences.ui", - InternalChildren: [ - "audio_quality", - "video_quality", - "background_play", - ], - }, this); + GObject.registerClass( + { + GTypeName: "MuzikaPreferencesDialog", + Template: "resource:///com/vixalien/muzika/ui/pages/preferences.ui", + InternalChildren: ["audio_quality", "video_quality", "background_play"], + }, + this, + ); } private _video_quality!: Adw.ComboRow; @@ -39,7 +38,7 @@ export class MuzikaPreferencesDialog extends Adw.PreferencesDialog { } private prepare_quality( - widget: typeof this._audio_quality | typeof this._video_quality, + widget: typeof this._audio_quality, qualities: typeof AudioQualities | typeof VideoQualities, gsettings_key: string, ) { @@ -52,7 +51,7 @@ export class MuzikaPreferencesDialog extends Adw.PreferencesDialog { widget.expression = Gtk.ClosureExpression.new( GObject.TYPE_STRING, - (container: ObjectContainer) => { + (container: ObjectContainer<(typeof qualities)[number]>) => { return container.object.name; }, [], diff --git a/src/pages/search.ts b/src/pages/search.ts index 14423d59..b327ae88 100644 --- a/src/pages/search.ts +++ b/src/pages/search.ts @@ -33,26 +33,31 @@ interface SearchData { GObject.type_ensure(InlineTabSwitcher.$gtype); -export class SearchPage extends Adw.Bin - implements MuzikaPageWidget { +export class SearchPage + extends Adw.Bin + implements MuzikaPageWidget +{ static { - GObject.registerClass({ - GTypeName: "SearchPage", - Template: "resource:///com/vixalien/muzika/ui/pages/search.ui", - InternalChildren: [ - "sections", - "stack", - "no_results", - "breakpoint", - "paginator", - "scrolled", - "context_label", - "scope_window", - "scope_switcher", - "filter_window", - "filter_box", - ], - }, this); + GObject.registerClass( + { + GTypeName: "SearchPage", + Template: "resource:///com/vixalien/muzika/ui/pages/search.ui", + InternalChildren: [ + "sections", + "stack", + "no_results", + "breakpoint", + "paginator", + "scrolled", + "context_label", + "scope_window", + "scope_switcher", + "filter_window", + "filter_box", + ], + }, + this, + ); } private _sections!: Gtk.Box; @@ -160,11 +165,9 @@ export class SearchPage extends Adw.Bin show_did_you_mean() { if (!this.results?.did_you_mean) return; - const link = `${search_runs_to_string(this.results.did_you_mean.search)}`; + const link = `${search_runs_to_string(this.results.did_you_mean.search)}`; this._context_label.visible = true; this._context_label.label = vprintf(_("Did you mean: %s"), [link]); @@ -173,27 +176,24 @@ export class SearchPage extends Adw.Bin show_autocorrect() { if (!this.results?.autocorrect) return; - const original_link = `${search_runs_to_string(this.results.autocorrect.original.search)}`; - - const corrected_link = `${search_runs_to_string(this.results.autocorrect.corrected.search)}`; + const original_link = `${search_runs_to_string(this.results.autocorrect.original.search)}`; + + const corrected_link = `${search_runs_to_string(this.results.autocorrect.corrected.search)}`; this._context_label.visible = true; this._context_label.label = - vprintf(_("Showing results for: %s"), [corrected_link]) + "\n" + + vprintf(_("Showing results for: %s"), [corrected_link]) + + "\n" + vprintf(_("Search instead for: %s"), [original_link]); } @@ -263,11 +263,14 @@ export class SearchPage extends Adw.Bin static load(context: PageLoadContext) { const autocorrect = context.url.searchParams.get("autocorrect"); - const args = [decodeURIComponent(context.match.params.query), { - signal: context.signal, - ...Object.fromEntries(context.url.searchParams as any), - autocorrect: autocorrect ? autocorrect === "true" : undefined, - }] as const; + const args = [ + decodeURIComponent(context.match.params.query), + { + signal: context.signal, + ...Object.fromEntries(context.url.searchParams as any), + autocorrect: autocorrect ? autocorrect === "true" : undefined, + }, + ] as const; return search(...args).then((results) => { return { @@ -303,8 +306,7 @@ export function search_args_to_url( Object.entries(opts) .filter(([_, v]) => v != null) .filter(([k]) => k !== "signal"), - ) - .toString(); + ).toString(); let url_string = `muzika:search:${encodeURIComponent(query)}`; if (params) url_string += `?${params}`; @@ -335,13 +337,15 @@ function filter_to_string(filter: Filter) { } function search_runs_to_string(runs: SearchRuns) { - return runs.map((run) => { - if (run.italics) { - return `${escape_label(run.text)}`; - } else if (run.bold) { - return `${escape_label(run.text)}`; - } else { - return escape_label(run.text); - } - }).join(""); + return runs + .map((run) => { + if (run.italics) { + return `${escape_label(run.text)}`; + } else if (run.bold) { + return `${escape_label(run.text)}`; + } else { + return escape_label(run.text); + } + }) + .join(""); } diff --git a/src/player/helpers.ts b/src/player/helpers.ts index 1dfeec2e..06e773b7 100644 --- a/src/player/helpers.ts +++ b/src/player/helpers.ts @@ -33,10 +33,7 @@ export async function get_track_settings( cache_maps.track_settings.set(video_id, omit(queue, ["tracks"])); for (const track of queue.tracks) { - cache_maps.queue_tracks.set( - track.videoId, - track, - ); + cache_maps.queue_tracks.set(track.videoId, track); } } @@ -54,10 +51,7 @@ export async function get_tracklist(video_ids: string[]) { const tracks = await get_queue_ids(video_ids); for (const track of tracks) { - cache_maps.queue_tracks.set( - track.videoId, - track, - ); + cache_maps.queue_tracks.set(track.videoId, track); } return tracks; @@ -70,10 +64,7 @@ export async function get_track_queue( const queue = await get_queue(video_id, null, options); for (const track of queue.tracks) { - cache_maps.queue_tracks.set( - track.videoId, - track, - ); + cache_maps.queue_tracks.set(track.videoId, track); } return queue; diff --git a/src/player/index.ts b/src/player/index.ts index f82d5472..9cd31cc8 100644 --- a/src/player/index.ts +++ b/src/player/index.ts @@ -37,8 +37,8 @@ if (!Gst.is_initialized()) { Gst.init(null); } -type GTypeToType = Y extends GObject.GType ? T - : never; +type GTypeToType = + Y extends GObject.GType ? T : never; type GTypeArrayToTypeArray = { [K in keyof Y]: GTypeToType; @@ -46,10 +46,10 @@ type GTypeArrayToTypeArray = { class MuzikaPlaySignalAdapter extends GObject.Object { private static events = { - "buffering": [GObject.TYPE_INT], + buffering: [GObject.TYPE_INT], "duration-changed": [GObject.TYPE_INT], "end-of-stream": [], - "error": [GLib.Error.$gtype, Gst.Structure.$gtype], + error: [GLib.Error.$gtype, Gst.Structure.$gtype], "media-info-updated": [GstPlay.PlayMediaInfo.$gtype], "mute-changed": [GObject.TYPE_BOOLEAN], "position-updated": [GObject.TYPE_DOUBLE], @@ -58,22 +58,24 @@ class MuzikaPlaySignalAdapter extends GObject.Object { "uri-loaded": [GObject.TYPE_STRING], "video-dimensions-changed": [GObject.TYPE_INT, GObject.TYPE_INT], "volume-changed": [GObject.TYPE_INT], - "warning": [GLib.Error.$gtype, Gst.Structure.$gtype], + warning: [GLib.Error.$gtype, Gst.Structure.$gtype], } as const; static { - GObject.registerClass({ - GTypeName: "MuzikaPlaySignalAdapter", - Signals: Object.fromEntries( - Object.entries(this.events) - .map(([name, types]) => [ + GObject.registerClass( + { + GTypeName: "MuzikaPlaySignalAdapter", + Signals: Object.fromEntries( + Object.entries(this.events).map(([name, types]) => [ name, { param_types: types, }, ]), - ), - }, this); + ), + }, + this, + ); } private _play: GstPlay.Play; @@ -86,7 +88,7 @@ class MuzikaPlaySignalAdapter extends GObject.Object { this._play = play; - const bus = this._play.get_message_bus()!; + const bus = this._play.get_message_bus(); bus.add_signal_watch(); bus.connect("message", this.on_message.bind(this)); @@ -103,7 +105,7 @@ class MuzikaPlaySignalAdapter extends GObject.Object { GstPlay.PlayMessage.$gtype, ); - if (!type[0] || structure.get_name()! !== "gst-play-message-data") { + if (!type[0] || structure.get_name() !== "gst-play-message-data") { return; } @@ -162,7 +164,7 @@ class MuzikaPlaySignalAdapter extends GObject.Object { break; case GstPlay.PlayMessage.MUTE_CHANGED: this.emit_message("mute-changed", [ - GstPlay.play_message_parse_muted_changed(message)!, + GstPlay.play_message_parse_muted_changed(message), ]); break; case GstPlay.PlayMessage.SEEK_DONE: @@ -174,60 +176,60 @@ class MuzikaPlaySignalAdapter extends GObject.Object { } private emit_message< - Name extends keyof typeof MuzikaPlaySignalAdapter["events"], - Types extends typeof MuzikaPlaySignalAdapter["events"][Name], - >( - name: Name, - args: GTypeArrayToTypeArray, - ) { - this.emit(name as string, ...args as GTypeToType[]); + Name extends keyof (typeof MuzikaPlaySignalAdapter)["events"], + Types extends (typeof MuzikaPlaySignalAdapter)["events"][Name], + >(name: Name, args: GTypeArrayToTypeArray) { + this.emit(name as string, ...(args as GTypeToType[])); } } export class MuzikaMediaStream extends Gtk.MediaStream { static { - GObject.registerClass({ - GTypeName: "MuzikaMediaStream", - Properties: { - queue: GObject.param_spec_object( - "queue", - "Queue", - "The queue", - Queue.$gtype, - GObject.ParamFlags.READABLE, - ), - buffering: GObject.param_spec_boolean( - "is-buffering", - "Is Buffering", - "Whether the player is buffering", - false, - GObject.ParamFlags.READABLE, - ), - paintable: GObject.param_spec_object( - "paintable", - "Paintable", - "The GdkPaintable representing the video", - Gdk.Paintable.$gtype, - GObject.ParamFlags.READABLE, - ), - media_info: GObject.param_spec_object( - "media-info", - "Media Info", - "The media info", - GstPlay.PlayMediaInfo.$gtype, - GObject.ParamFlags.READABLE, - ), - cubic_volume: GObject.param_spec_double( - "cubic-volume", - "Cubic Volume", - "The volume that is suitable for display", - 0.0, - 1.0, - 1.0, - GObject.ParamFlags.READABLE, - ), + GObject.registerClass( + { + GTypeName: "MuzikaMediaStream", + Properties: { + queue: GObject.param_spec_object( + "queue", + "Queue", + "The queue", + Queue.$gtype, + GObject.ParamFlags.READABLE, + ), + buffering: GObject.param_spec_boolean( + "is-buffering", + "Is Buffering", + "Whether the player is buffering", + false, + GObject.ParamFlags.READABLE, + ), + paintable: GObject.param_spec_object( + "paintable", + "Paintable", + "The GdkPaintable representing the video", + Gdk.Paintable.$gtype, + GObject.ParamFlags.READABLE, + ), + media_info: GObject.param_spec_object( + "media-info", + "Media Info", + "The media info", + GstPlay.PlayMediaInfo.$gtype, + GObject.ParamFlags.READABLE, + ), + cubic_volume: GObject.param_spec_double( + "cubic-volume", + "Cubic Volume", + "The volume that is suitable for display", + 0.0, + 1.0, + 1.0, + GObject.ParamFlags.READABLE, + ), + }, }, - }, this); + this, + ); } private _paintable: Gdk.Paintable | null = null; @@ -588,39 +590,42 @@ export class MuzikaMediaStream extends Gtk.MediaStream { export class MuzikaPlayer extends MuzikaMediaStream { static { - GObject.registerClass({ - GTypeName: "MuzikaPlayer", - Properties: { - queue: GObject.param_spec_object( - "queue", - "Queue", - "The queue", - Queue.$gtype, - GObject.ParamFlags.READABLE, - ), - buffering: GObject.param_spec_boolean( - "buffering", - "Buffering", - "Whether the player is buffering", - false, - GObject.ParamFlags.READABLE, - ), - now_playing: GObject.param_spec_object( - "now-playing", - "Now playing", - "The metadata of the currently playing song", - ObjectContainer.$gtype, - GObject.ParamFlags.READABLE, - ), - loading_track: GObject.param_spec_string( - "loading-track", - "Loading track", - "The videoId of track that is currently being loaded", - null, - GObject.ParamFlags.READABLE, - ), + GObject.registerClass( + { + GTypeName: "MuzikaPlayer", + Properties: { + queue: GObject.param_spec_object( + "queue", + "Queue", + "The queue", + Queue.$gtype, + GObject.ParamFlags.READABLE, + ), + buffering: GObject.param_spec_boolean( + "buffering", + "Buffering", + "Whether the player is buffering", + false, + GObject.ParamFlags.READABLE, + ), + now_playing: GObject.param_spec_object( + "now-playing", + "Now playing", + "The metadata of the currently playing song", + ObjectContainer.$gtype, + GObject.ParamFlags.READABLE, + ), + loading_track: GObject.param_spec_string( + "loading-track", + "Loading track", + "The videoId of track that is currently being loaded", + null, + GObject.ParamFlags.READABLE, + ), + }, }, - }, this); + this, + ); } private app: Application; @@ -633,8 +638,8 @@ export class MuzikaPlayer extends MuzikaMediaStream { get duration() { // normalise duration when the media-info is not available if (super.duration <= 0) { - const duration_seconds = this.now_playing?.object.song.videoDetails - .lengthSeconds; + const duration_seconds = + this.now_playing?.object.song.videoDetails.lengthSeconds; if (duration_seconds) { // to microsecond @@ -663,10 +668,13 @@ export class MuzikaPlayer extends MuzikaMediaStream { // try to seek to the same position if ( - counterpart_videoId && counterpart_videoId === now_playing_videoId && - current.duration_seconds && this.timestamp !== 0 + counterpart_videoId && + counterpart_videoId === now_playing_videoId && + current.duration_seconds && + this.timestamp !== 0 ) { - this.initial_seek_to = (this.timestamp / this.duration) * + this.initial_seek_to = + (this.timestamp / this.duration) * (current.duration_seconds * Gst.MSECOND); } else { // reset seek @@ -805,10 +813,9 @@ export class MuzikaPlayer extends MuzikaMediaStream { if (song) { if (this.add_history && get_option("auth").has_token()) { // add history entry, but don't wait for the promise to resolve - add_history_item(song) - .catch((err) => { - console.log("Couldn't add history item", err); - }); + add_history_item(song).catch((err) => { + console.log("Couldn't add history item", err); + }); this.add_history = false; } @@ -866,8 +873,8 @@ export class MuzikaPlayer extends MuzikaMediaStream { this.notify("is-buffering"); return Promise.all([ - get_song(track.videoId, { signal: this.loading_controller!.signal }), - get_track_settings(track.videoId, this.loading_controller!.signal), + get_song(track.videoId, { signal: this.loading_controller.signal }), + get_track_settings(track.videoId, this.loading_controller.signal), ]) .then(([song, settings]) => { this._now_playing = new ObjectContainer({ @@ -875,8 +882,8 @@ export class MuzikaPlayer extends MuzikaMediaStream { track, settings: { ...settings, - playlistId: this.queue.settings.object?.playlistId ?? - settings.playlistId, + playlistId: + this.queue.settings.object?.playlistId ?? settings.playlistId, }, }); this.notify("now-playing"); @@ -912,7 +919,7 @@ export class MuzikaPlayer extends MuzikaMediaStream { this.loading_controller = new AbortController(); - return get_song(track.videoId, { signal: this.loading_controller!.signal }) + return get_song(track.videoId, { signal: this.loading_controller.signal }) .then((song) => { this.refreshed_uri = true; @@ -953,7 +960,7 @@ export class MuzikaPlayer extends MuzikaMediaStream { return list_model_to_array(list) .map((container) => container.object) .filter(Boolean) - .map((track) => track?.videoId) as string[]; + .map((track) => track?.videoId); }; return { @@ -981,18 +988,16 @@ export class MuzikaPlayer extends MuzikaMediaStream { } await Promise.all([ - get_tracklist(state.tracks) - .then((tracks) => { - this.queue.add(tracks_to_meta(tracks), state.position ?? undefined); - }), - get_tracklist(state.original) - .then((tracks) => - tracks.forEach((track) => - this.queue._original.append( - new ObjectContainer({ ...track, playlist: null }), - ) - ) + get_tracklist(state.tracks).then((tracks) => { + this.queue.add(tracks_to_meta(tracks), state.position ?? undefined); + }), + get_tracklist(state.original).then((tracks) => + tracks.forEach((track) => + this.queue._original.append( + new ObjectContainer({ ...track, playlist: null }), + ), ), + ), ]); this.queue._shuffle = state.shuffle; @@ -1002,8 +1007,7 @@ export class MuzikaPlayer extends MuzikaMediaStream { private async load_state() { const state = store.get("player-state") as PlayerState | undefined; - await this.set_state(state) - .catch((err) => console.error(err)); + await this.set_state(state).catch((err) => console.error(err)); } save_state() { @@ -1209,11 +1213,15 @@ function get_song_formats< .filter((format) => { // filter requested manifests if (video && format_has_video(format)) { - return quality === VideoQuality.auto || - format.video_quality == VideoQuality[quality]; + return ( + quality === VideoQuality.auto || + format.video_quality == VideoQuality[quality] + ); } else if (!video && format_has_audio(format)) { - return quality === AudioQuality.auto || - format.audio_quality == AudioQuality[quality]; + return ( + quality === AudioQuality.auto || + format.audio_quality == AudioQuality[quality] + ); } else { return false; } @@ -1252,11 +1260,7 @@ function get_best_formats( let best_formats: Format[] = []; while (best_quality >= 0) { - best_formats = get_song_formats( - video, - formats, - best_quality, - ); + best_formats = get_song_formats(video, formats, best_quality); if (best_formats.length > 0) { return best_formats; @@ -1304,13 +1308,13 @@ function get_song_uri(song: Song) { return total_formats[0].url; } - return `data:application/dash+xml;base64,${ - btoa(convert_formats_to_dash({ + return `data:application/dash+xml;base64,${btoa( + convert_formats_to_dash({ ...song, adaptive_formats: [], formats: total_formats, - })) - }`; + }), + )}`; } export const VideoQualities: { name: string; value: string }[] = [ diff --git a/src/player/mpd.ts b/src/player/mpd.ts index 53fd14b6..3b199df0 100644 --- a/src/player/mpd.ts +++ b/src/player/mpd.ts @@ -8,168 +8,139 @@ export function convert_formats_to_dash(song: Song) { const duration = get_presentation_duration(formats); - const translable_caption = song.captions?.find((caption) => - caption.translatable + const translable_caption = song.captions?.find( + (caption) => caption.translatable, ); - return `\n` + objectToSchema({ - "@name": "MPD", - "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance", - "xmlns": "urn:mpeg:dash:schema:mpd:2011", - "xsi:schemaLocation": "urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd", - "xmlns:yt": "http://youtube.com/yt/2012/10/10", - "profiles": "urn:mpeg:dash:profile:isoff-on-demand:2011", - "type": "static", - "mediaPresentationDuration": duration, - "minBufferTime": "PT1.500S", - "#children": [ - { - "@name": "ProgramInformation", - "moreInformationURL": "https://github.com/vixalien/muzika", - "#children": "Dashed Song", - }, - { - "@name": "Period", - "#children": [ - ...formats.reduce((acc, format, index) => { - if (format.has_audio && format.has_video) return acc; - - const representation: Record = { - "@name": "Representation", - "id": format.itag, - "mimeType": escape_attribute(format.mime_type.split(";")[0]), - "codecs": escape_attribute(format.codecs.split(", ").join(",")), - "bandwidth": format.average_bitrate || format.bitrate, - "audioSamplingRate": format_has_audio(format) - ? format.sample_rate - : null, - "#children": [ - ...(format_has_audio(format) - ? [{ - "@name": "AudioChannelConfiguration", - "schemeIdUri": - "urn:mpeg:dash:23003:3:audio_channel_configuration:2011", - "value": format.channels, - }] - : []), - { - "@name": "BaseURL", - "@noindent": true, - "#children": getInitializationUrl(format), - }, - ...( - format.index_range - ? [ - { - "@name": "SegmentBase", - "indexRangeExact": "true", - "indexRange": - `${format.index_range.start}-${format.index_range.end}`, - "#children": [ - ...( - format.init_range - ? [ - { - "@name": "Initialization", - "range": - `${format.init_range.start}-${format.init_range.end}`, - }, - ] - : [] - ), - ], - }, - ] - : [] - ), - ], - }; - - if (format.has_video) { - representation.width = format.width; - representation.height = format.height; - representation.frameRate = format.fps; - representation.par = get_ratio(format.width, format.height); - representation.sar = "1:1"; - } - - if (format.has_audio) { - representation.audioSamplingRate = - (format as AudioFormat).sample_rate; - } - - const definition: Record = { - "@name": "AdaptationSet", - "mimeType": escape_attribute(format.mime_type.split(";")[0]), - "segmentAlignment": "true", - // "contentType": format.has_audio ? "audio" : "video", - "#children": [ - { - "@name": "Role", - "schemeIdUri": "urn:mpeg:dash:role:2011", - "value": "main", - }, - representation, - ], - }; - const existing = acc.find((item) => { - return item.mimeType === definition.mimeType; - }); - - if (existing) { - existing["#children"].push(representation); - } else { - acc.push(definition); - } - - return acc; - }, [] as Record[]), - // see https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2872 - ...song.captions.map((caption, index) => { - const url = new URL(caption.url); - url.searchParams.set("fmt", "vtt"); - - return { - "@name": "AdaptationSet", - "mimeType": "text/vtt", - "lang": caption.lang, - "#children": [ - { + return ( + `\n` + + objectToSchema({ + "@name": "MPD", + "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance", + xmlns: "urn:mpeg:dash:schema:mpd:2011", + "xsi:schemaLocation": "urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd", + "xmlns:yt": "http://youtube.com/yt/2012/10/10", + profiles: "urn:mpeg:dash:profile:isoff-on-demand:2011", + type: "static", + mediaPresentationDuration: duration, + minBufferTime: "PT1.500S", + "#children": [ + { + "@name": "ProgramInformation", + moreInformationURL: "https://github.com/vixalien/muzika", + "#children": "Dashed Song", + }, + { + "@name": "Period", + "#children": [ + ...formats.reduce( + (acc, format, index) => { + if (format.has_audio && format.has_video) return acc; + + const representation: Record = { "@name": "Representation", - "id": `caption-${index}`, - "bandwidth": 256, + id: format.itag, + mimeType: escape_attribute(format.mime_type.split(";")[0]), + codecs: escape_attribute(format.codecs.split(", ").join(",")), + bandwidth: format.average_bitrate || format.bitrate, + audioSamplingRate: format_has_audio(format) + ? format.sample_rate + : null, "#children": [ + ...(format_has_audio(format) + ? [ + { + "@name": "AudioChannelConfiguration", + schemeIdUri: + "urn:mpeg:dash:23003:3:audio_channel_configuration:2011", + value: format.channels, + }, + ] + : []), { "@name": "BaseURL", "@noindent": true, - "#children": escape_uri(url.toString()), + "#children": getInitializationUrl(format), }, + ...(format.index_range + ? [ + { + "@name": "SegmentBase", + indexRangeExact: "true", + indexRange: `${format.index_range.start}-${format.index_range.end}`, + "#children": [ + ...(format.init_range + ? [ + { + "@name": "Initialization", + range: `${format.init_range.start}-${format.init_range.end}`, + }, + ] + : []), + ], + }, + ] + : []), ], - }, - ], - }; - }), - ...(translable_caption - ? languages.map((lang) => { - const url = new URL(translable_caption.url); + }; + + if (format.has_video) { + representation.width = format.width; + representation.height = format.height; + representation.frameRate = format.fps; + representation.par = get_ratio(format.width, format.height); + representation.sar = "1:1"; + } + + if (format.has_audio) { + representation.audioSamplingRate = ( + format as AudioFormat + ).sample_rate; + } + + const definition: Record = { + "@name": "AdaptationSet", + mimeType: escape_attribute(format.mime_type.split(";")[0]), + segmentAlignment: "true", + // "contentType": format.has_audio ? "audio" : "video", + "#children": [ + { + "@name": "Role", + schemeIdUri: "urn:mpeg:dash:role:2011", + value: "main", + }, + representation, + ], + }; + const existing = acc.find((item) => { + return item.mimeType === definition.mimeType; + }); + + if (existing) { + existing["#children"].push(representation); + } else { + acc.push(definition); + } + + return acc; + }, + [] as Record[], + ), + // see https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2872 + ...song.captions.map((caption, index) => { + const url = new URL(caption.url); url.searchParams.set("fmt", "vtt"); - url.searchParams.set("tlang", lang.code); return { "@name": "AdaptationSet", - "mimeType": "text/vtt", - "lang": lang.code, + mimeType: "text/vtt", + lang: caption.lang, "#children": [ { "@name": "Representation", - "id": `caption-translated-${lang.code}`, - "bandwidth": 256, + id: `caption-${index}`, + bandwidth: 256, "#children": [ - { - "@name": "Role", - "schemeIdUri": "urn:mpeg:dash:role:2011", - "value": "dub", - }, { "@name": "BaseURL", "@noindent": true, @@ -179,12 +150,44 @@ export function convert_formats_to_dash(song: Song) { }, ], }; - }) - : []), - ], - }, - ], - }); + }), + ...(translable_caption + ? languages.map((lang) => { + const url = new URL(translable_caption.url); + url.searchParams.set("fmt", "vtt"); + url.searchParams.set("tlang", lang.code); + + return { + "@name": "AdaptationSet", + mimeType: "text/vtt", + lang: lang.code, + "#children": [ + { + "@name": "Representation", + id: `caption-translated-${lang.code}`, + bandwidth: 256, + "#children": [ + { + "@name": "Role", + schemeIdUri: "urn:mpeg:dash:role:2011", + value: "dub", + }, + { + "@name": "BaseURL", + "@noindent": true, + "#children": escape_uri(url.toString()), + }, + ], + }, + ], + }; + }) + : []), + ], + }, + ], + }) + ); } function format_duration(duration: number) { @@ -210,16 +213,11 @@ function get_presentation_duration(media: Format[]) { } function escape_attribute(str: string) { - return str - .replace(/\"/g, '\\"') - .replace(/\'/g, "\\'"); + return str.replace(/\"/g, '\\"').replace(/\'/g, "\\'"); } function escape_uri(uri: string) { - return uri - .replace(/&/g, "&") - .replace(//g, ">"); + return uri.replace(/&/g, "&").replace(//g, ">"); } function getInitializationUrl(format: Format) { @@ -249,9 +247,7 @@ function objectToSchema(obj: any) { if (key === "#children") { if (Array.isArray(value)) { - body += value - .map((child) => indent(objectToSchema(child))) - .join("\n"); + body += value.map((child) => indent(objectToSchema(child))).join("\n"); } else { body += (noindent ? "" : " ") + value.toString(); } @@ -265,7 +261,9 @@ function objectToSchema(obj: any) { .map(([key, value]) => `${key}="${value}"`) .join(" "); - const body_text = noindent ? body : ` + const body_text = noindent + ? body + : ` ${body} `; @@ -278,7 +276,7 @@ ${body} function get_ratio(a: number, b: number) { for (let base = b; base > 1; base--) { - if ((a % base) == 0 && (b % base) == 0) { + if (a % base == 0 && b % base == 0) { a = a / base; b = b / base; } diff --git a/src/player/queue.ts b/src/player/queue.ts index b1b14695..b206fb1c 100644 --- a/src/player/queue.ts +++ b/src/player/queue.ts @@ -49,116 +49,118 @@ export enum PreferredMediaType { export class Queue extends GObject.Object { static { - GObject.registerClass({ - GTypeName: "Queue", - Properties: { - history: GObject.param_spec_object( - "history", - "History", - "A Gio.ListStore that stores all the previously played songs", - Gio.ListStore.$gtype, - GObject.ParamFlags.READABLE, - ), - list: GObject.param_spec_object( - "list", - "List", - "A Gio.ListStore that stores all the songs", - Gio.ListStore.$gtype, - GObject.ParamFlags.READABLE, - ), - position: GObject.param_spec_int( - "position", - "Position", - "The current position in the queue", - 0, - 1000000, - 0, - GObject.ParamFlags.READABLE, - ), - current: GObject.param_spec_object( - "current", - "Current", - "The current song", - ObjectContainer.$gtype, - GObject.ParamFlags.READABLE, - ), - "can-play-next": GObject.param_spec_boolean( - "can-play-next", - "Can play next", - "Whether the next song can be played", - false, - GObject.ParamFlags.READABLE, - ), - "can-play-previous": GObject.param_spec_boolean( - "can-play-previous", - "Can play previous", - "Whether the previous song can be played", - false, - GObject.ParamFlags.READABLE, - ), - repeat: GObject.param_spec_uint( - "repeat", - "Repeat", - "The repeat mode", - 0, - 2, - 0, - GObject.ParamFlags.READWRITE, - ), - shuffle: GObject.param_spec_boolean( - "shuffle", - "Shuffle", - "Whether the queue is shuffled", - false, - GObject.ParamFlags.READWRITE, - ), - settings: GObject.param_spec_object( - "settings", - "Settings", - "The current queue settings", - ObjectContainer.$gtype, - GObject.ParamFlags.READWRITE, - ), - "active-chip": GObject.param_spec_string( - "active-chip", - "Active chip", - "The active chip", - null as any, - GObject.ParamFlags.READWRITE, - ), - "preferred-media-type": GObject.param_spec_uint( - "preferred-media-type", - "The preferred media type", - "Whether the users prefers to play tracks as-is, track or video versions", - PreferredMediaType.AUTO, - PreferredMediaType.VIDEO, - PreferredMediaType.AUTO, - GObject.ParamFlags.READWRITE, - ), - "current-is-video": GObject.param_spec_boolean( - "current-is-video", - "Current Is Video", - "Whether the currently playing track has a video", - false, - GObject.ParamFlags.READWRITE, - ), - }, - Signals: { - "prepare-next": { - param_types: [GObject.TYPE_STRING], + GObject.registerClass( + { + GTypeName: "Queue", + Properties: { + history: GObject.param_spec_object( + "history", + "History", + "A Gio.ListStore that stores all the previously played songs", + Gio.ListStore.$gtype, + GObject.ParamFlags.READABLE, + ), + list: GObject.param_spec_object( + "list", + "List", + "A Gio.ListStore that stores all the songs", + Gio.ListStore.$gtype, + GObject.ParamFlags.READABLE, + ), + position: GObject.param_spec_int( + "position", + "Position", + "The current position in the queue", + 0, + 1000000, + 0, + GObject.ParamFlags.READABLE, + ), + current: GObject.param_spec_object( + "current", + "Current", + "The current song", + ObjectContainer.$gtype, + GObject.ParamFlags.READABLE, + ), + "can-play-next": GObject.param_spec_boolean( + "can-play-next", + "Can play next", + "Whether the next song can be played", + false, + GObject.ParamFlags.READABLE, + ), + "can-play-previous": GObject.param_spec_boolean( + "can-play-previous", + "Can play previous", + "Whether the previous song can be played", + false, + GObject.ParamFlags.READABLE, + ), + repeat: GObject.param_spec_uint( + "repeat", + "Repeat", + "The repeat mode", + 0, + 2, + 0, + GObject.ParamFlags.READWRITE, + ), + shuffle: GObject.param_spec_boolean( + "shuffle", + "Shuffle", + "Whether the queue is shuffled", + false, + GObject.ParamFlags.READWRITE, + ), + settings: GObject.param_spec_object( + "settings", + "Settings", + "The current queue settings", + ObjectContainer.$gtype, + GObject.ParamFlags.READWRITE, + ), + "active-chip": GObject.param_spec_string( + "active-chip", + "Active chip", + "The active chip", + null as any, + GObject.ParamFlags.READWRITE, + ), + "preferred-media-type": GObject.param_spec_uint( + "preferred-media-type", + "The preferred media type", + "Whether the users prefers to play tracks as-is, track or video versions", + PreferredMediaType.AUTO, + PreferredMediaType.VIDEO, + PreferredMediaType.AUTO, + GObject.ParamFlags.READWRITE, + ), + "current-is-video": GObject.param_spec_boolean( + "current-is-video", + "Current Is Video", + "Whether the currently playing track has a video", + false, + GObject.ParamFlags.READWRITE, + ), + }, + Signals: { + "prepare-next": { + param_types: [GObject.TYPE_STRING], + }, + play: {}, }, - "play": {}, }, - }, this); + this, + ); } preferred_media_type = PreferredMediaType.AUTO; - private _list: Gio.ListStore> = new Gio - .ListStore(); + private _list: Gio.ListStore> = + new Gio.ListStore(); // original is used to store unshuffled list - _original: Gio.ListStore> = new Gio - .ListStore(); + _original: Gio.ListStore> = new Gio.ListStore(); get list() { return this._list; @@ -390,8 +392,8 @@ export class Queue extends GObject.Object { add_toast( params.has("next") ? vprintf(_("Playing “%s” next"), [normalized_title]) - // Translators: %s is a playlist name - : vprintf(_("Added “%s” to queue"), [normalized_title]), + : // Translators: %s is a playlist name + vprintf(_("Added “%s” to queue"), [normalized_title]), ); }); }, @@ -410,7 +412,8 @@ export class Queue extends GObject.Object { if (ids.length == 1) { // notify when starting radio, and the current track is playing already if ( - params.has("radio") && this.current?.object.videoId === ids[0] + params.has("radio") && + this.current?.object.videoId === ids[0] ) { add_toast(_("Starting Radio")); } @@ -443,17 +446,17 @@ export class Queue extends GObject.Object { add_toast( params.has("next") ? ngettext( - // Translators: %s is a song's name - vprintf(_("Playing “%s” next"), [normalized_title]), - vprintf(_("Playing %d songs next"), [tracks.length]), - tracks.length, - ) + // Translators: %s is a song's name + vprintf(_("Playing “%s” next"), [normalized_title]), + vprintf(_("Playing %d songs next"), [tracks.length]), + tracks.length, + ) : ngettext( - // Translators: %s is a song's name - vprintf(_("Added “%s” to queue"), [normalized_title]), - vprintf(_("Added %d songs to queue"), [tracks.length]), - tracks.length, - ), + // Translators: %s is a song's name + vprintf(_("Added “%s” to queue"), [normalized_title]), + vprintf(_("Added %d songs to queue"), [tracks.length]), + tracks.length, + ), ); }); }, @@ -472,30 +475,42 @@ export class Queue extends GObject.Object { }, ]); - action_group.add_action(build_action({ - name: "toggle-repeat", - parameter_type: null, - state: GLib.Variant.new_boolean(false), - activate: this.toggle_repeat.bind(this), - bind_state_full: [this, "repeat", () => { - return [ - true, - GLib.Variant.new_boolean( - this.repeat == RepeatMode.NONE ? false : true, - ), - ]; - }], - })); - - action_group.add_action(build_action({ - name: "toggle-shuffle", - parameter_type: null, - state: GLib.Variant.new_boolean(false), - activate: () => this.shuffle = !this.shuffle, - bind_state_full: [this, "shuffle", () => { - return [true, GLib.Variant.new_boolean(this.shuffle)]; - }], - })); + action_group.add_action( + build_action({ + name: "toggle-repeat", + parameter_type: null, + state: GLib.Variant.new_boolean(false), + activate: this.toggle_repeat.bind(this), + bind_state_full: [ + this, + "repeat", + () => { + return [ + true, + GLib.Variant.new_boolean( + this.repeat == RepeatMode.NONE ? false : true, + ), + ]; + }, + ], + }), + ); + + action_group.add_action( + build_action({ + name: "toggle-shuffle", + parameter_type: null, + state: GLib.Variant.new_boolean(false), + activate: () => (this.shuffle = !this.shuffle), + bind_state_full: [ + this, + "shuffle", + () => { + return [true, GLib.Variant.new_boolean(this.shuffle)]; + }, + ], + }), + ); this.connect("notify::can-play-previous", () => { action_group.action_enabled_changed("previous", this.can_play_previous); @@ -530,8 +545,8 @@ export class Queue extends GObject.Object { */ async change_active_chip(chip: string | null) { - const found_chip = this.settings?.object?.chips.find((c) => - c.playlistId == chip + const found_chip = this.settings?.object?.chips.find( + (c) => c.playlistId == chip, ); if (chip && found_chip) { @@ -548,8 +563,9 @@ export class Queue extends GObject.Object { this.list.splice( this.position + 1, this.list.n_items - this.position - 1, - tracks_to_meta(queue.tracks, found_chip.playlistId) - .map((track) => new ObjectContainer(track)), + tracks_to_meta(queue.tracks, found_chip.playlistId).map( + (track) => new ObjectContainer(track), + ), ); this.active_chip = chip; @@ -796,23 +812,12 @@ export class Queue extends GObject.Object { } } - private play_next( - tracks: QueueMeta[], - new_position?: number, - ) { - this.add_to_queue_at_position( - tracks, - this.position + 1, - new_position, - ); + private play_next(tracks: QueueMeta[], new_position?: number) { + this.add_to_queue_at_position(tracks, this.position + 1, new_position); } add(tracks: QueueMeta[], new_position?: number) { - this.add_to_queue_at_position( - tracks, - this.list.n_items, - new_position, - ); + this.add_to_queue_at_position(tracks, this.list.n_items, new_position); } private get_counterpart(track: QueueMeta) { diff --git a/src/polyfills/customevent.ts b/src/polyfills/customevent.ts index dc5ee042..4d66ad6b 100644 --- a/src/polyfills/customevent.ts +++ b/src/polyfills/customevent.ts @@ -3,13 +3,15 @@ // EventTarget import "event-target-polyfill"; -export class CustomEvent extends Event - implements globalThis.CustomEvent { +export class CustomEvent + extends Event + implements globalThis.CustomEvent +{ readonly detail: T; constructor(type: string, eventInitDict?: CustomEventInit) { super(type); - this.detail = eventInitDict?.detail ?? null as T; + this.detail = eventInitDict?.detail ?? (null as T); } initCustomEvent( diff --git a/src/polyfills/fetch.ts b/src/polyfills/fetch.ts index 554a3366..a4505541 100644 --- a/src/polyfills/fetch.ts +++ b/src/polyfills/fetch.ts @@ -9,11 +9,7 @@ import "./abortcontroller.js"; import "./customevent.js"; import "./domexception.js"; -Gio._promisify( - Soup.Session.prototype, - "send_async", - "send_finish", -); +Gio._promisify(Soup.Session.prototype, "send_async", "send_finish"); Gio._promisify( Gio.InputStream.prototype, @@ -21,11 +17,7 @@ Gio._promisify( "read_bytes_finish", ); -Gio._promisify( - Gio.OutputStream.prototype, - "splice_async", - "splice_finish", -); +Gio._promisify(Gio.OutputStream.prototype, "splice_async", "splice_finish"); export interface FetchOptions { body?: string | Uint8Array; @@ -145,7 +137,7 @@ export class GResponse { async arrayBuffer() { const reader = this._body.getReader(); - let chunks: Uint8Array[] = []; + const chunks: Uint8Array[] = []; while (true) { const { done, value } = await reader.read(); @@ -192,24 +184,24 @@ const SESSION = new Soup.Session({ }); export const cache = Soup.Cache.new( - SOUP_CACHE_DIR.get_path()!, + SOUP_CACHE_DIR.get_path(), Soup.CacheType.SHARED, ); // set max cache size to 16 megabytes -cache.set_max_size(16e+6); +cache.set_max_size(16e6); cache.load(); SESSION.add_feature(cache); export async function fetch(url: string | URL, options: FetchOptions = {}) { - if (typeof url !== "string" && ("href" in (url as URL))) { - url = (url as URL).href; + if (typeof url !== "string" && "href" in url) { + url = url.href; } const method = options.method?.toUpperCase() || "GET"; - const uri = GLib.Uri.parse(url as string, GLib.UriFlags.NONE); + const uri = GLib.Uri.parse(url, GLib.UriFlags.NONE); const message = new Soup.Message({ method, @@ -255,8 +247,8 @@ export async function fetch(url: string | URL, options: FetchOptions = {}) { cancellable, ).catch((e) => { if ( - (e instanceof Gio.IOErrorEnum) && - (e.code === Gio.IOErrorEnum.CANCELLED) + e instanceof Gio.IOErrorEnum && + e.code === Gio.IOErrorEnum.CANCELLED ) { if (options.signal && options.signal.reason instanceof DOMException) { reject(options.signal.reason); @@ -301,7 +293,7 @@ export async function fetch(url: string | URL, options: FetchOptions = {}) { status: message.status_code, statusText: message.reason_phrase, headers, - url: url as string, + url: url, }); resolve(response); diff --git a/src/sidebar.ts b/src/sidebar.ts index 730b72bf..40eb123f 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -15,11 +15,7 @@ export class WindowSidebar extends Adw.NavigationPage { { GTypeName: "WindowSidebar", Template: "resource:///com/vixalien/muzika/ui/sidebar.ui", - InternalChildren: [ - "account", - "login", - "navbar", - ], + InternalChildren: ["account", "login", "navbar"], Properties: {}, Signals: { "show-content": {}, @@ -58,10 +54,9 @@ export class WindowSidebar extends Adw.NavigationPage { return; } - const account = await get_current_user() - .catch(() => { - console.error("Couldn't get logged in user"); - }); + const account = await get_current_user().catch(() => { + console.error("Couldn't get logged in user"); + }); if (!account) return; @@ -71,10 +66,7 @@ export class WindowSidebar extends Adw.NavigationPage { account.name, `navigator.visit("muzika:channel:${account.channel_id}")`, ); - menu.append( - _("Logout"), - "win.logout", - ); + menu.append(_("Logout"), "win.logout"); this._account.menu_model = menu; } diff --git a/src/util/action.ts b/src/util/action.ts index e9784f7a..0116d5b2 100644 --- a/src/util/action.ts +++ b/src/util/action.ts @@ -36,7 +36,7 @@ export interface ActionDeclaration { export function build_action(decl: ActionDeclaration) { const action = new Gio.SimpleAction({ name: decl.name, - parameter_type: decl.parameter_type ?? null as any, + parameter_type: decl.parameter_type ?? (null as any), state: decl.state ?? undefined, }); diff --git a/src/util/giofilestore.ts b/src/util/giofilestore.ts index 38dfaeed..778c2e9a 100644 --- a/src/util/giofilestore.ts +++ b/src/util/giofilestore.ts @@ -34,8 +34,10 @@ export class GioFileStore extends Store { } catch (error) { // create the file if it's missing if ( - !(error instanceof GLib.Error && - error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND)) + !( + error instanceof GLib.Error && + error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND) + ) ) { console.error("Failed to load store, resetting", error); } @@ -48,7 +50,7 @@ export class GioFileStore extends Store { } get(key: string): T | null { - return this.map.get(key) as T ?? null; + return (this.map.get(key) as T) ?? null; } set(key: string, value: unknown): void { diff --git a/src/util/label.ts b/src/util/label.ts index 9a5fd0b2..cd16d550 100644 --- a/src/util/label.ts +++ b/src/util/label.ts @@ -8,10 +8,7 @@ export function setup_link_label( label: Gtk.Label, listeners?: SignalListeners, ) { - function connect< - Signal extends string, - Obj extends GObject.Object, - >( + function connect( widget: Obj, signal: Signal, fn: (...args: any[]) => any, @@ -23,18 +20,11 @@ export function setup_link_label( return widget.connect(signal, fn); } - connect( - label, - "activate-link", - (_: Gtk.Label, uri: string) => { - if (uri && uri.startsWith("muzika:")) { - label.activate_action( - "navigator.visit", - GLib.Variant.new_string(uri), - ); + connect(label, "activate-link", (_: Gtk.Label, uri: string) => { + if (uri && uri.startsWith("muzika:")) { + label.activate_action("navigator.visit", GLib.Variant.new_string(uri)); - return true; - } - }, - ); + return true; + } + }); } diff --git a/src/util/menu/index.ts b/src/util/menu/index.ts index c35823e5..2cb96d86 100644 --- a/src/util/menu/index.ts +++ b/src/util/menu/index.ts @@ -48,15 +48,11 @@ function is_gio_menu_item(item: any): item is Gio.MenuItem { return typeof item === "object" && item instanceof Gio.MenuItem; } -function is_submenu( - item: NonNullable, -): item is MenuSubmenu { +function is_submenu(item: NonNullable): item is MenuSubmenu { return typeof item === "object" && Object.hasOwn(item, "submenu"); } -function is_section( - item: NonNullable, -): item is MenuSection { +function is_section(item: NonNullable): item is MenuSection { return typeof item === "object" && Object.hasOwn(item, "section"); } diff --git a/src/util/menu/like.ts b/src/util/menu/like.ts index a65a7c7d..c88b7930 100644 --- a/src/util/menu/like.ts +++ b/src/util/menu/like.ts @@ -26,10 +26,10 @@ export function menuLikeRow( const { like_button, dislike_button } = create_like_buttons({ status, parent: popover, - cb: ((newStatus) => { + cb: (newStatus) => { popover.popdown(); cb?.(newStatus); - }), + }, videoId, }); @@ -49,9 +49,12 @@ export interface CreateLikeButtonsProps { cb?: LikeRowCallback; } -export function create_like_buttons( - { status, parent, videoId, cb }: CreateLikeButtonsProps, -) { +export function create_like_buttons({ + status, + parent, + videoId, + cb, +}: CreateLikeButtonsProps) { const change_rating = (newStatus: LikeStatus) => { cb?.(newStatus); parent.activate_action( diff --git a/src/util/objectcontainer.ts b/src/util/objectcontainer.ts index f4d45a0d..09a05388 100644 --- a/src/util/objectcontainer.ts +++ b/src/util/objectcontainer.ts @@ -3,18 +3,21 @@ import GObject from "gi://GObject"; export class ObjectContainer extends GObject.Object { static { if (!GObject.type_from_name("ObjectContainer")) { - GObject.registerClass({ - GTypeName: "ObjectContainer", - Properties: { - object: GObject.ParamSpec.object( - "object", - "Object", - "The contained object", - GObject.ParamFlags.READWRITE, - GObject.Object.$gtype, - ), + GObject.registerClass( + { + GTypeName: "ObjectContainer", + Properties: { + object: GObject.ParamSpec.object( + "object", + "Object", + "The contained object", + GObject.ParamFlags.READWRITE, + GObject.Object.$gtype, + ), + }, }, - }, this); + this, + ); } } @@ -29,18 +32,21 @@ export class ObjectContainer extends GObject.Object { export class OptionalObjectContainer extends GObject.Object { static { - GObject.registerClass({ - GTypeName: "OptionalObjectContainer", - Properties: { - object: GObject.ParamSpec.object( - "object", - "Object", - "The contained object", - GObject.ParamFlags.READWRITE, - GObject.Object.$gtype, - ), + GObject.registerClass( + { + GTypeName: "OptionalObjectContainer", + Properties: { + object: GObject.ParamSpec.object( + "object", + "Object", + "The contained object", + GObject.ParamFlags.READWRITE, + GObject.Object.$gtype, + ), + }, }, - }, this); + this, + ); } object?: T; diff --git a/src/util/playablelist.ts b/src/util/playablelist.ts index 3c562bab..c2daba51 100644 --- a/src/util/playablelist.ts +++ b/src/util/playablelist.ts @@ -97,43 +97,47 @@ export interface PlayableContainerProps { is_playlist?: boolean; } -export class PlayableContainer - extends GObject.Object { +export class PlayableContainer< + T extends Object = PlaylistItem, +> extends GObject.Object { static { - GObject.registerClass({ - GTypeName: "PlayableContainer", - Properties: { - object: GObject.ParamSpec.object( - "object", - "Contained Object", - "The contained object", - GObject.ParamFlags.READWRITE, - GObject.Object.$gtype, - ), - state: get_state_pspec(), - video_id: GObject.ParamSpec.string( - "video-id", - "Video ID", - "The video ID of the item", - GObject.ParamFlags.READWRITE, - null as any, - ), - playlist_id: GObject.ParamSpec.string( - "playlist-id", - "Playlist ID", - "The playlist ID of the item", - GObject.ParamFlags.READWRITE, - null as any, - ), - is_playlist: GObject.ParamSpec.boolean( - "is-playlist", - "Is Playlist", - "Whether the item is a playlist", - GObject.ParamFlags.READWRITE, - false, - ), + GObject.registerClass( + { + GTypeName: "PlayableContainer", + Properties: { + object: GObject.ParamSpec.object( + "object", + "Contained Object", + "The contained object", + GObject.ParamFlags.READWRITE, + GObject.Object.$gtype, + ), + state: get_state_pspec(), + video_id: GObject.ParamSpec.string( + "video-id", + "Video ID", + "The video ID of the item", + GObject.ParamFlags.READWRITE, + null as any, + ), + playlist_id: GObject.ParamSpec.string( + "playlist-id", + "Playlist ID", + "The playlist ID of the item", + GObject.ParamFlags.READWRITE, + null as any, + ), + is_playlist: GObject.ParamSpec.boolean( + "is-playlist", + "Is Playlist", + "Whether the item is a playlist", + GObject.ParamFlags.READWRITE, + false, + ), + }, }, - }, this); + this, + ); } object: T; @@ -191,18 +195,21 @@ export class SectionedPlayableContainer< Section extends Object = Object, > extends PlayableContainer { static { - GObject.registerClass({ - GTypeName: "SectionedPlayableContainer", - Properties: { - section: GObject.ParamSpec.object( - "section", - "Section", - "If this item starts a section, this property will be set to the section", - GObject.ParamFlags.READWRITE, - ObjectContainer.$gtype, - ), + GObject.registerClass( + { + GTypeName: "SectionedPlayableContainer", + Properties: { + section: GObject.ParamSpec.object( + "section", + "Section", + "If this item starts a section, this property will be set to the section", + GObject.ParamFlags.READWRITE, + ObjectContainer.$gtype, + ), + }, }, - }, this); + this, + ); } constructor(props: SectionedPlayableContainerProps) { @@ -279,34 +286,40 @@ export interface PlayableListProps { } export class PlayableList< - T extends Object = PlaylistItem, - Container extends PlayableContainer = PlayableContainer, -> extends GObject.Object implements Gio.ListModel { + T extends Object = PlaylistItem, + Container extends PlayableContainer = PlayableContainer, + > + extends GObject.Object + implements Gio.ListModel +{ static { - GObject.registerClass({ - GTypeName: "PlayableList", - Properties: { - item_type: GObject.ParamSpec.uint64( - "item-type", - "Item Type", - "The type of the items in the list", - GObject.ParamFlags.READWRITE, - 0, - Number.MAX_SAFE_INTEGER, - 0, - ), - n_items: GObject.ParamSpec.uint64( - "n-items", - "Number of Items", - "The number of items in the list", - GObject.ParamFlags.READABLE, - 0, - Number.MAX_SAFE_INTEGER, - 0, - ), + GObject.registerClass( + { + GTypeName: "PlayableList", + Properties: { + item_type: GObject.ParamSpec.uint64( + "item-type", + "Item Type", + "The type of the items in the list", + GObject.ParamFlags.READWRITE, + 0, + Number.MAX_SAFE_INTEGER, + 0, + ), + n_items: GObject.ParamSpec.uint64( + "n-items", + "Number of Items", + "The number of items in the list", + GObject.ParamFlags.READABLE, + 0, + Number.MAX_SAFE_INTEGER, + 0, + ), + }, + Implements: [Gio.ListModel], }, - Implements: [Gio.ListModel], - }, this); + this, + ); } protected array = new Array(); @@ -351,9 +364,7 @@ export class PlayableList< return PlayableContainer.$gtype; } - find( - fn: (item: Container) => boolean, - ): number | null { + find(fn: (item: Container) => boolean): number | null { const index = this.array.findIndex(fn); return index === -1 ? null : index; @@ -381,11 +392,7 @@ export class PlayableList< this.items_changed(position, 0, 1); } - splice( - position: number, - removed: number, - added: Container[], - ): void { + splice(position: number, removed: number, added: Container[]): void { this.array.splice(position, removed, ...added); this.items_changed(position, removed, added.length); @@ -406,24 +413,25 @@ export class PlayableList< this.array.forEach((item) => { if (item.is_playlist) { - item.state = (item.playlist_id && - player.now_playing?.object.settings.playlistId == - item.playlist_id) - ? player.playing - ? DynamicActionState.PLAYING - : DynamicActionState.PAUSED - : item.video_id && player.loading_track == item.video_id - ? DynamicActionState.LOADING - : DynamicActionState.DEFAULT; + item.state = + item.playlist_id && + player.now_playing?.object.settings.playlistId == item.playlist_id + ? player.playing + ? DynamicActionState.PLAYING + : DynamicActionState.PAUSED + : item.video_id && player.loading_track == item.video_id + ? DynamicActionState.LOADING + : DynamicActionState.DEFAULT; } else { - item.state = (item.video_id && - player.now_playing?.object.track.videoId == item.video_id) - ? player.playing - ? DynamicActionState.PLAYING - : DynamicActionState.PAUSED - : player.loading_track == item.video_id - ? DynamicActionState.LOADING - : DynamicActionState.DEFAULT; + item.state = + item.video_id && + player.now_playing?.object.track.videoId == item.video_id + ? player.playing + ? DynamicActionState.PLAYING + : DynamicActionState.PAUSED + : player.loading_track == item.video_id + ? DynamicActionState.LOADING + : DynamicActionState.DEFAULT; } }); } @@ -431,14 +439,11 @@ export class PlayableList< setup_listeners() { const player = get_player(); - this.listeners.add( - player, - [ - player.connect("notify::now-playing", this.reload_state.bind(this)), - player.connect("notify::playing", this.reload_state.bind(this)), - player.connect("notify::loading-track", this.reload_state.bind(this)), - ], - ); + this.listeners.add(player, [ + player.connect("notify::now-playing", this.reload_state.bind(this)), + player.connect("notify::playing", this.reload_state.bind(this)), + player.connect("notify::loading-track", this.reload_state.bind(this)), + ]); this.reload_state(); } @@ -448,17 +453,22 @@ export class PlayableList< } } -export class SectionedPlayableList - extends PlayableList> { +export class SectionedPlayableList< + T extends Object = PlaylistItem, +> extends PlayableList> { static { - GObject.registerClass({ - GTypeName: "SectionedPlayableList", - Implements: [Gtk.SectionModel], - }, this); + GObject.registerClass( + { + GTypeName: "SectionedPlayableList", + Implements: [Gtk.SectionModel], + }, + this, + ); } vfunc_get_section(position: number) { - let start = -1, end = -1; + let start = -1, + end = -1; for (let i = position; i >= 0; i--) { if (this.array[i].has_section()) { diff --git a/src/util/portals.ts b/src/util/portals.ts index 190ad74b..e797127f 100644 --- a/src/util/portals.ts +++ b/src/util/portals.ts @@ -24,15 +24,17 @@ export function request_background() { const window = get_window(); const parent = window ? XdpGtk4.parent_new_gtk(window) : null; - return portal.request_background( - parent, - _("Muzika needs to run in the background to play music"), - [pkg.name], - Xdp.BackgroundFlags.NONE, - null, - ).catch(() => { - console.error("Permission to run in the background not granted"); - }); + return portal + .request_background( + parent, + _("Muzika needs to run in the background to play music"), + [pkg.name], + Xdp.BackgroundFlags.NONE, + null, + ) + .catch(() => { + console.error("Permission to run in the background not granted"); + }); } export function set_background_status() { diff --git a/src/util/secret-store.ts b/src/util/secret-store.ts index 24c5ab95..b484b120 100644 --- a/src/util/secret-store.ts +++ b/src/util/secret-store.ts @@ -51,7 +51,7 @@ export class MuzikaSecretStore extends Store { } get(key: string): T | null { - return this.map.get(key) as T ?? null; + return (this.map.get(key) as T) ?? null; } set(key: string, value: unknown): void { @@ -71,11 +71,7 @@ export class MuzikaSecretStore extends Store { this.save(); - Secret.password_clear_sync( - this.schema, - { version: this.version }, - null, - ); + Secret.password_clear_sync(this.schema, { version: this.version }, null); } private save() { diff --git a/src/util/signal-listener.ts b/src/util/signal-listener.ts index 26d9ddd3..f354be4b 100644 --- a/src/util/signal-listener.ts +++ b/src/util/signal-listener.ts @@ -33,10 +33,7 @@ export class SignalListeners { this.bindings.length = 0; } - connect< - Signal extends string, - Obj extends GObject.Object, - >( + connect( widget: Obj, signal: Signal, fn: (...args: any[]) => any, diff --git a/src/util/text.ts b/src/util/text.ts index da98eced..1db060ad 100644 --- a/src/util/text.ts +++ b/src/util/text.ts @@ -26,8 +26,7 @@ function normalize_nodes(nodes?: string | (string | null)[]): string[] { } else if (typeof nodes === "string") { return [nodes]; } else { - return nodes - .filter((node) => node != null) as string[]; + return nodes.filter((node) => node != null) as string[]; } } @@ -39,9 +38,9 @@ export function pretty_subtitles( const { prefix, suffix = [] } = Array.isArray(options) ? { suffix: normalize_nodes(options), prefix: [] } : { - prefix: normalize_nodes(options.prefix), - suffix: normalize_nodes(options.suffix), - }; + prefix: normalize_nodes(options.prefix), + suffix: normalize_nodes(options.suffix), + }; const author_markup: string[] = []; const author_plain: string[] = []; diff --git a/src/util/window.ts b/src/util/window.ts index ec97503d..824a890d 100644 --- a/src/util/window.ts +++ b/src/util/window.ts @@ -4,8 +4,7 @@ import { Application } from "src/application"; export function get_window() { // TODO: this will not always be defined - return (Gtk.Application.get_default() as Application) - .window!; + return (Gtk.Application.get_default() as Application).window!; } export function add_toast(toast: string) { diff --git a/src/window.ts b/src/window.ts index 07eb774b..5f04916e 100644 --- a/src/window.ts +++ b/src/window.ts @@ -32,9 +32,7 @@ import Gio from "gi://Gio"; import { Navigator } from "./navigation.js"; import { get_player } from "./application.js"; import { Settings } from "./util/settings.js"; -import { - PlayerNowPlayingDetails, -} from "./components/player/now-playing/details.js"; +import { PlayerNowPlayingDetails } from "./components/player/now-playing/details.js"; import { LoginDialog } from "./pages/login.js"; import { AddActionEntries } from "./util/action.js"; import { get_option, LikeStatus, rate_song } from "libmuse"; @@ -71,9 +69,7 @@ export class Window extends Adw.ApplicationWindow { "now_playing_view", "sidebar", ], - Children: [ - "toast_overlay", - ], + Children: ["toast_overlay"], Properties: { navigator: GObject.ParamSpec.object( "navigator", @@ -150,10 +146,7 @@ export class Window extends Adw.ApplicationWindow { this.insert_action_group("navigator", this.navigator.get_action_group()); this.insert_action_group("player", player.get_action_group()); - this.insert_action_group( - "queue", - player.queue.get_action_group(), - ); + this.insert_action_group("queue", player.queue.get_action_group()); this.add_actions(); @@ -250,7 +243,7 @@ export class Window extends Adw.ApplicationWindow { this.rate_song( videoId, status as LikeStatus, - oldStatus as LikeStatus || undefined, + (oldStatus as LikeStatus) || undefined, ); }, }, @@ -316,8 +309,7 @@ export class Window extends Adw.ApplicationWindow { Adw.ResponseAppearance.DESTRUCTIVE, ); - const response = await dialog.choose(this, null) - .catch(console.error); + const response = await dialog.choose(this, null).catch(console.error); if (response === "logout") { get_option("auth").token = null; @@ -344,7 +336,8 @@ export class Window extends Adw.ApplicationWindow { controller.abort(); }); - loginDialog.auth_flow(controller.signal) + loginDialog + .auth_flow(controller.signal) .then(() => { this.add_toast(_("Successfully logged in!")); this.navigator.reload(); @@ -457,11 +450,11 @@ export class Window extends Adw.ApplicationWindow { status: LikeStatus, oldStatus?: LikeStatus, ) { - rate_song(videoId, status as LikeStatus) + rate_song(videoId, status) .then(() => { const toast = new Adw.Toast(); - switch (status as LikeStatus) { + switch (status) { case "DISLIKE": toast.title = _("Added to disliked songs"); break; diff --git a/types/ambient.d.ts b/types/ambient.d.ts index ab58c765..e505d46a 100644 --- a/types/ambient.d.ts +++ b/types/ambient.d.ts @@ -18,7 +18,7 @@ declare interface Number { declare module imports { const format: { - format(this: String, ...args: any[]): string; + format(this: string, ...args: any[]): string; printf(fmt: string, ...args: any[]): string; vprintf(fmt: string, args: any[]): string; }; @@ -26,9 +26,5 @@ declare module imports { declare module "gettext" { export function gettext(id: string): string; - export function ngettext( - singular: string, - plural: string, - n: number, - ): string; + export function ngettext(singular: string, plural: string, n: number): string; } From 101b2a99a1e87698e3231b569f364faf08b54061 Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Thu, 9 May 2024 05:33:11 +0200 Subject: [PATCH 4/6] chore(lint): fix lint errors --- .eslintrc.js => .eslintrc.cjs | 7 ++-- .prettierrc | 0 package.json | 1 + src/components/carousel/card.ts | 2 - src/components/carousel/flatcard.ts | 13 +++++-- src/components/carousel/index.ts | 8 ++-- src/components/carousel/view/flatgrid.ts | 17 ++++---- src/components/carousel/view/flatlist.ts | 17 ++++---- src/components/carousel/view/grid.ts | 12 ++++-- src/components/carousel/view/list.ts | 12 ++++-- src/components/carousel/view/util.ts | 4 +- src/components/fixed-ratio-thumbnail.ts | 5 +-- src/components/inline-tab-switcher.ts | 30 +++++++------- src/components/nav/page.ts | 15 +++---- src/components/navbar/button.ts | 3 +- src/components/player/now-playing/details.ts | 12 +++--- src/components/player/now-playing/view.ts | 4 +- src/components/player/queue.ts | 7 ++-- src/components/player/scale.ts | 8 ++-- src/components/player/video/full.ts | 3 -- src/components/player/video/mini.ts | 2 - src/components/player/view.ts | 2 - src/components/playlist/columnview.ts | 2 +- src/components/playlist/edit.ts | 4 +- src/components/playlist/itemview.ts | 8 ++-- src/components/playlist/listitem.ts | 1 - src/components/playlist/listview.ts | 4 +- src/components/search/topresultcard.ts | 5 ++- src/mpris.ts | 36 +++++++++-------- src/muse.ts | 1 - src/navigation.ts | 6 ++- src/pages/authentication-error.ts | 2 +- src/pages/charts.ts | 2 +- src/pages/error.ts | 8 ++-- src/pages/explore.ts | 2 +- src/pages/library/history.ts | 4 +- src/pages/login.ts | 2 +- src/pages/moods.ts | 2 +- src/pages/playlist.ts | 5 +-- src/pages/search.ts | 14 ++++--- src/player/helpers.ts | 2 +- src/player/index.ts | 21 +++++----- src/player/mpd.ts | 28 ++++++------- src/player/queue.ts | 25 ++++-------- src/polyfills/abortcontroller.ts | 2 + src/polyfills/base64.ts | 2 - src/polyfills/customevent.ts | 9 +---- src/polyfills/fetch.ts | 6 ++- src/util/action.ts | 10 ++--- src/util/label.ts | 1 + src/util/list.ts | 4 +- src/util/menu/index.ts | 26 ++++++++----- src/util/menu/like.ts | 5 ++- src/util/objectcontainer.ts | 4 +- src/util/playablelist.ts | 41 ++++++++++---------- src/util/signal-listener.ts | 4 +- src/util/text.ts | 4 +- src/window.ts | 6 +-- types/ambient.d.ts | 8 ++-- 59 files changed, 258 insertions(+), 242 deletions(-) rename .eslintrc.js => .eslintrc.cjs (71%) create mode 100644 .prettierrc diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 71% rename from .eslintrc.js rename to .eslintrc.cjs index 4a525673..4ccb92b5 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -2,14 +2,13 @@ module.exports = { extends: [ "eslint:recommended", "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", + // "plugin:@typescript-eslint/recommended-requiring-type-checking", "plugin:prettier/recommended", ], parser: "@typescript-eslint/parser", parserOptions: { sourceType: "module", - project: "tsconfig.json", - tsconfigRootDir: __dirname, + project: "./tsconfig.json", warnOnUnsupportedTypeScriptVersion: false, }, rules: { @@ -18,6 +17,6 @@ module.exports = { }], "prettier/prettier": "error", }, - plugins: ["@typescript-eslint", "prettier"], + plugins: ["@typescript-eslint"], root: true, }; diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..e69de29b diff --git a/package.json b/package.json index 4d741c11..4015d657 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "repository": "https://github.com/vixalien/muzika", "author": "Angelo Verlain ", "license": "MIT", + "type": "module", "dependencies": { "@lemaik/qrcode-svg": "^1.2.0", "libmuse": "^0.0.97", diff --git a/src/components/carousel/card.ts b/src/components/carousel/card.ts index 7a10386b..eae46d09 100644 --- a/src/components/carousel/card.ts +++ b/src/components/carousel/card.ts @@ -1,6 +1,5 @@ import Gtk from "gi://Gtk?version=4.0"; import GObject from "gi://GObject"; -import GLib from "gi://GLib"; import type { ArtistRun, @@ -18,7 +17,6 @@ import { get_thumbnail_with_size } from "../webimage.js"; import { pretty_subtitles } from "src/util/text.js"; import { MixedCardItem } from "../library/mixedcard.js"; import { DynamicActionState, DynamicImage } from "../dynamic-image"; -import { SignalListeners } from "src/util/signal-listener.js"; import { MenuHelper } from "src/util/menu/index.js"; import { menuLikeRow } from "src/util/menu/like.js"; import { setup_link_label } from "src/util/label.js"; diff --git a/src/components/carousel/flatcard.ts b/src/components/carousel/flatcard.ts index 2ef257e5..488b549e 100644 --- a/src/components/carousel/flatcard.ts +++ b/src/components/carousel/flatcard.ts @@ -1,6 +1,5 @@ import Gtk from "gi://Gtk?version=4.0"; import GObject from "gi://GObject"; -import GLib from "gi://GLib"; import type { ArtistRun, @@ -731,7 +730,7 @@ export class FlatCard extends Gtk.Box { this.show_video(content); break; default: - console.warn(`Unknown content type: ${(content as any).type}`); + console.warn(`Unknown content type: ${(content as InlineSong).type}`); } } @@ -759,7 +758,10 @@ export class FlatCard extends Gtk.Box { this.show_search_radio(content); break; default: - console.error("Unknown search content type", (content as any).type); + console.error( + "Unknown search content type", + (content as SearchContent).type, + ); return; } } @@ -793,8 +795,11 @@ export class FlatCard extends Gtk.Box { break; case "flat-song": this.show_flat_song(content); + break; default: - console.warn(`Unknown content type: ${content.type}`); + console.warn( + `Unknown content type: ${(content as MixedCardItem).type}`, + ); } } diff --git a/src/components/carousel/index.ts b/src/components/carousel/index.ts index db9abc48..a0da8915 100644 --- a/src/components/carousel/index.ts +++ b/src/components/carousel/index.ts @@ -17,7 +17,7 @@ export type RequiredMixedItem = NonNullable; export class Carousel< Content extends Partial> & { - contents: string | (MixedCardItem | null)[]; + contents: string | (MixedCardItem | ParsedMoodOrGenre | null)[]; display?: null | "list" | "mood"; }, > extends Gtk.Box { @@ -194,11 +194,11 @@ export class Carousel< this._carousel_stack.visible_child = this._scrolled; if (content.display == "list") { - this.show_gridview(content.contents); + this.show_gridview(content.contents as MixedCardItem[]); } else if (content.display == "mood") { - this.show_moodview(content.contents as any[]); + this.show_moodview(content.contents as ParsedMoodOrGenre[]); } else { - this.show_listview(content.contents); + this.show_listview(content.contents as MixedCardItem[]); } } } diff --git a/src/components/carousel/view/flatgrid.ts b/src/components/carousel/view/flatgrid.ts index f7a7dd19..291dfaa6 100644 --- a/src/components/carousel/view/flatgrid.ts +++ b/src/components/carousel/view/flatgrid.ts @@ -13,6 +13,11 @@ export interface FlatGridViewConstructorProperties child_type: FlatViewChildType; } +interface ContainerWithBinding + extends PlayableContainer { + binding?: GObject.Binding; +} + export class FlatGridView extends Gtk.GridView { static { GObject.registerClass( @@ -69,9 +74,7 @@ export class FlatGridView extends Gtk.GridView { bind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { const card = list_item.child as FlatCard; - const container = list_item.item as PlayableContainer< - InlineSong | SearchContent - >; + const container = list_item.item as ContainerWithBinding; if (container.object) { switch (this.child_type) { @@ -86,7 +89,7 @@ export class FlatGridView extends Gtk.GridView { break; } - (container as any).binding = container.bind_property( + container.binding = container.bind_property( "state", card, "state", @@ -96,11 +99,9 @@ export class FlatGridView extends Gtk.GridView { } unbind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { - const container = list_item.item as PlayableContainer< - InlineSong | SearchContent - >; + const container = list_item.item as ContainerWithBinding; - ((container as any).binding as GObject.Binding)?.unbind(); + (container.binding as GObject.Binding)?.unbind(); } vfunc_map(): void { diff --git a/src/components/carousel/view/flatlist.ts b/src/components/carousel/view/flatlist.ts index 936c45fa..cf2260ad 100644 --- a/src/components/carousel/view/flatlist.ts +++ b/src/components/carousel/view/flatlist.ts @@ -13,6 +13,11 @@ export interface FlatListViewConstructorProperties child_type: FlatViewChildType; } +interface ContainerWithBinding + extends PlayableContainer { + binding?: GObject.Binding; +} + export class FlatListView extends Gtk.ListView { static { GObject.registerClass( @@ -74,9 +79,7 @@ export class FlatListView extends Gtk.ListView { bind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { const card = list_item.child as FlatCard; - const container = list_item.item as PlayableContainer< - InlineSong | SearchContent - >; + const container = list_item.item as ContainerWithBinding; if (container.object) { switch (this.child_type) { @@ -91,7 +94,7 @@ export class FlatListView extends Gtk.ListView { break; } - (container as any).binding = container.bind_property( + container.binding = container.bind_property( "state", card, "state", @@ -101,11 +104,9 @@ export class FlatListView extends Gtk.ListView { } unbind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { - const container = list_item.item as PlayableContainer< - InlineSong | SearchContent - >; + const container = list_item.item as ContainerWithBinding; - ((container as any).binding as GObject.Binding)?.unbind(); + (container.binding as GObject.Binding)?.unbind(); } vfunc_map(): void { diff --git a/src/components/carousel/view/grid.ts b/src/components/carousel/view/grid.ts index 83315241..2745438a 100644 --- a/src/components/carousel/view/grid.ts +++ b/src/components/carousel/view/grid.ts @@ -10,6 +10,10 @@ import { mixed_card_activate_cb } from "./util.js"; export type RequiredMixedItem = NonNullable; +interface ContainerWithBinding extends PlayableContainer { + binding?: GObject.Binding; +} + export class CarouselGridView extends Gtk.GridView { static { GObject.registerClass( @@ -64,12 +68,12 @@ export class CarouselGridView extends Gtk.GridView { bind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { const card = list_item.child as CarouselCard; - const container = list_item.item as PlayableContainer; + const container = list_item.item as ContainerWithBinding; if (container.object) { card.show_item(container.object); - (container as any).binding = container.bind_property( + container.binding = container.bind_property( "state", card, "state", @@ -79,9 +83,9 @@ export class CarouselGridView extends Gtk.GridView { } unbind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { - const container = list_item.item as PlayableContainer; + const container = list_item.item as ContainerWithBinding; - ((container as any).binding as GObject.Binding)?.unbind(); + (container.binding as GObject.Binding)?.unbind(); } vfunc_map(): void { diff --git a/src/components/carousel/view/list.ts b/src/components/carousel/view/list.ts index c69b8dcc..b6cc6ba6 100644 --- a/src/components/carousel/view/list.ts +++ b/src/components/carousel/view/list.ts @@ -10,6 +10,10 @@ import { mixed_card_activate_cb } from "./util.js"; export type RequiredMixedItem = NonNullable; +interface ContainerWithBinding extends PlayableContainer { + binding?: GObject.Binding; +} + export class CarouselListView extends Gtk.ListView { static { GObject.registerClass( @@ -50,12 +54,12 @@ export class CarouselListView extends Gtk.ListView { bind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { const card = list_item.child as CarouselCard; - const container = list_item.item as PlayableContainer; + const container = list_item.item as ContainerWithBinding; if (container.object) { card.show_item(container.object); - (container as any).binding = container.bind_property( + container.binding = container.bind_property( "state", card, "state", @@ -65,9 +69,9 @@ export class CarouselListView extends Gtk.ListView { } unbind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { - const container = list_item.item as PlayableContainer; + const container = list_item.item as ContainerWithBinding; - ((container as any).binding as GObject.Binding)?.unbind(); + (container.binding as GObject.Binding)?.unbind(); } vfunc_map(): void { diff --git a/src/components/carousel/view/util.ts b/src/components/carousel/view/util.ts index b2dff703..bddfcd05 100644 --- a/src/components/carousel/view/util.ts +++ b/src/components/carousel/view/util.ts @@ -98,13 +98,14 @@ function activate_mixed_card(view: Gtk.Widget, item: MixedCardItem) { break; case "artist": // library channels are music channels + // eslint-disable-next-line no-fallthrough case "channel": uri = `artist:${item.browseId}`; break; case "album": uri = `album:${item.browseId}`; break; - case "library-artist": + case "library-artist": { // remove MPLA prefix if it's there const id = item.browseId; if (id.startsWith("MPLA")) { @@ -113,6 +114,7 @@ function activate_mixed_card(view: Gtk.Widget, item: MixedCardItem) { uri = `artist:${item.browseId}`; } break; + } case "inline-video": case "song": case "video": diff --git a/src/components/fixed-ratio-thumbnail.ts b/src/components/fixed-ratio-thumbnail.ts index 4c460590..89ffa376 100644 --- a/src/components/fixed-ratio-thumbnail.ts +++ b/src/components/fixed-ratio-thumbnail.ts @@ -279,9 +279,8 @@ export class FixedRatioThumbnail extends Gtk.Widget implements Gtk.Orientable { orientation: Gtk.Orientation, for_size: number, ): [number, number, number, number] { - let minimal_size: number, - natural_size: number, - minimum_baseline = -1, + let minimal_size: number, natural_size: number; + const minimum_baseline = -1, natural_baseline = -1; const expand = this.can_expand; diff --git a/src/components/inline-tab-switcher.ts b/src/components/inline-tab-switcher.ts index fcec44a0..9d0e52da 100644 --- a/src/components/inline-tab-switcher.ts +++ b/src/components/inline-tab-switcher.ts @@ -16,33 +16,33 @@ export class Tab extends GObject.Object { { GTypeName: "Tab", Properties: { - id: GObject.ParamSpec.string( + id: GObject.param_spec_string( "id", "ID", "The unique ID of the tab", + null, GObject.ParamFlags.READWRITE, - null as any, ), - title: GObject.ParamSpec.string( + title: GObject.param_spec_string( "title", "Title", "Title of the tab", + null, GObject.ParamFlags.READWRITE, - null as any, ), - icon: GObject.ParamSpec.string( + icon: GObject.param_spec_string( "icon", "Icon", "Icon that represents the tab", + null, GObject.ParamFlags.READWRITE, - null as any, ), - navigate: GObject.ParamSpec.string( + navigate: GObject.param_spec_string( "action-target", "Action Target", "The target string of the action to be executed when the tab is activated", + null, GObject.ParamFlags.READWRITE, - null as any, ), }, }, @@ -67,7 +67,7 @@ export class Tab extends GObject.Object { export class InlineTabSwitcher extends Gtk.Widget { private TIMEOUT_EXPAND = 500; - private buttons = new Map(); + private buttons = new Map(); model = new Gio.ListStore(); @@ -154,7 +154,7 @@ export class InlineTabSwitcher extends Gtk.Widget { private clear_switcher() { this.buttons.forEach((button, tab) => { - const separator = (button as any).separator as Gtk.Widget; + const separator = button.separator as Gtk.Widget; button.unparent(); separator.unparent(); tab.connect("notify", this.tab_updated_cb.bind(this)); @@ -196,7 +196,7 @@ export class InlineTabSwitcher extends Gtk.Widget { hexpand: true, vexpand: true, focus_on_click: false, - }); + }) as ToggleButtonWithSeparator; button.add_css_class("flat"); @@ -267,7 +267,7 @@ export class InlineTabSwitcher extends Gtk.Widget { const separator = Gtk.Separator.new(Gtk.Orientation.VERTICAL); separator.set_parent(this); - (button as any).separator = separator; + button.separator = separator; const separator_changed = () => { const prev_separator = button.get_prev_sibling(); @@ -287,7 +287,7 @@ export class InlineTabSwitcher extends Gtk.Widget { separator_changed(); } - private tab_updated_cb(tab: Tab, pspec: GObject.ParamSpec) { + private tab_updated_cb(tab: Tab) { const button = this.buttons.get(tab)!; this.update_button(tab, button); @@ -360,3 +360,7 @@ export class InlineTabSwitcher extends Gtk.Widget { } } } + +interface ToggleButtonWithSeparator extends Gtk.ToggleButton { + separator: Gtk.Separator; +} diff --git a/src/components/nav/page.ts b/src/components/nav/page.ts index fba74c6a..45f266dd 100644 --- a/src/components/nav/page.ts +++ b/src/components/nav/page.ts @@ -17,10 +17,7 @@ export interface PageState { // register Loading GObject.type_ensure(Loading.$gtype); -export class Page< - Data extends unknown, - State extends unknown = null, -> extends Adw.NavigationPage { +export class Page extends Adw.NavigationPage { static { GObject.registerClass( { @@ -79,7 +76,7 @@ export class Page< last_match?: MatchResult>; private __state: PageState | null = null; - private __error: any; + private __error?: unknown; constructor(meta: MuzikaPageMeta) { super(); @@ -94,12 +91,12 @@ export class Page< vfunc_hidden(): void { if (this.__error) { - this.page = this._content.child = null as any; + this.page = this._content.child = null!; } else if (this.page) { this.__state = { state: this.page.get_state(), }; - this.page = this._content.child = null as any; + this.page = this._content.child = null!; } } @@ -118,7 +115,7 @@ export class Page< } } - show_error(error: any) { + show_error(error: unknown) { this.__error = error; let error_page: Gtk.Widget; @@ -158,7 +155,7 @@ export class Page< this.__error = null; const page = this.meta.build(); - page.present(result); + page.present(result as Data); this._content.child = this.page = page; } catch (error) { diff --git a/src/components/navbar/button.ts b/src/components/navbar/button.ts index 43af5aec..ab958be5 100644 --- a/src/components/navbar/button.ts +++ b/src/components/navbar/button.ts @@ -1,4 +1,3 @@ -import GLib from "gi://GLib"; import GObject from "gi://GObject"; import Gtk from "gi://Gtk?version=4.0"; @@ -58,7 +57,7 @@ export class NavbarButton extends Gtk.Box { link: string | null = null; title: string | null = null; - constructor(args?: any) { + constructor(args?: Partial) { super(args); } diff --git a/src/components/player/now-playing/details.ts b/src/components/player/now-playing/details.ts index 15b08db0..201b1886 100644 --- a/src/components/player/now-playing/details.ts +++ b/src/components/player/now-playing/details.ts @@ -88,37 +88,37 @@ export class PlayerNowPlayingDetails extends Adw.NavigationPage { // TODO: use `sensitive` instead // blocked by: - // @ts-expect-error + // @ts-expect-error wrong types player.queue.bind_property_full( "settings", this._lyrics_page, "visible", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { return [true, player.queue.settings.object?.lyrics != null]; }, null, ); - // @ts-expect-error + // @ts-expect-error wrong types player.queue.bind_property_full( "settings", this._related_page, "visible", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { return [true, player.queue.settings.object?.related != null]; }, null, ); - // @ts-expect-error + // @ts-expect-error wrong types this._stack.bind_property_full( "visible-child", this, "title", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { const visible_child = this._stack.get_visible_child(); if (!visible_child) return [false]; diff --git a/src/components/player/now-playing/view.ts b/src/components/player/now-playing/view.ts index 1b494d9c..7410daad 100644 --- a/src/components/player/now-playing/view.ts +++ b/src/components/player/now-playing/view.ts @@ -195,7 +195,7 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { this._duration, "label", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { return [true, micro_to_string(this.player.duration)]; }, null, @@ -206,7 +206,7 @@ export class PlayerNowPlayingView extends Adw.NavigationPage { this._timestamp, "label", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { return [true, micro_to_string(this.player.timestamp)]; }, null, diff --git a/src/components/player/queue.ts b/src/components/player/queue.ts index 161d5c56..5bea9e32 100644 --- a/src/components/player/queue.ts +++ b/src/components/player/queue.ts @@ -2,14 +2,13 @@ import Gtk from "gi://Gtk?version=4.0"; import GObject from "gi://GObject"; import Adw from "gi://Adw"; -import type { QueueTrack } from "libmuse"; - -import { ObjectContainer } from "src/util/objectcontainer"; import { QueueItem } from "./queueitem"; import { MuzikaPlayer } from "src/player"; import { escape_label } from "src/util/text"; import { get_player } from "src/application"; import { setup_link_label } from "src/util/label"; +import { ObjectContainer } from "src/util/objectcontainer"; +import { QueueTrack } from "libmuse"; export class QueueView extends Gtk.Stack { static { @@ -146,7 +145,7 @@ export class QueueView extends Gtk.Stack { } bind_cb(_factory: Gtk.ListItemFactory, list_item: Gtk.ListItem) { - const container = list_item.get_item(); + const container = list_item.get_item() as ObjectContainer; const track = container.object; const card = new QueueItem(); diff --git a/src/components/player/scale.ts b/src/components/player/scale.ts index 27f7308f..b4122b51 100644 --- a/src/components/player/scale.ts +++ b/src/components/player/scale.ts @@ -49,7 +49,7 @@ export class PlayerScale extends Gtk.Scale { get_player().seek(value); }); - this.connect("value-changed", (_) => { + this.connect("value-changed", () => { this.emit("user-changed-value", this.adjustment.value); }); } @@ -82,7 +82,7 @@ export class PlayerScale extends Gtk.Scale { this.adjustment, "upper", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { // the `|| 10` is to prevent the scale being invisible when the upper // adjustment value is set to 0 return [true, player.duration || 10]; @@ -109,7 +109,7 @@ export class PlayerScale extends Gtk.Scale { this, "buffering", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { return [true, player.is_buffering && player.playing]; }, null, @@ -120,7 +120,7 @@ export class PlayerScale extends Gtk.Scale { this, "buffering", GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE, - (_, __) => { + () => { return [true, player.playing && player.is_buffering]; }, null, diff --git a/src/components/player/video/full.ts b/src/components/player/video/full.ts index c0c5ec96..32c5023e 100644 --- a/src/components/player/video/full.ts +++ b/src/components/player/video/full.ts @@ -1,6 +1,5 @@ import GObject from "gi://GObject"; import Adw from "gi://Adw"; -import GLib from "gi://GLib"; import Gtk from "gi://Gtk?version=4.0"; import { get_player } from "src/application"; @@ -58,8 +57,6 @@ export class FullVideoControls extends Adw.Bin { this._duration_label.label = track.duration_seconds ? seconds_to_string(track.duration_seconds) : track.duration ?? "00:00"; - { - } } } diff --git a/src/components/player/video/mini.ts b/src/components/player/video/mini.ts index e5838862..2380678e 100644 --- a/src/components/player/video/mini.ts +++ b/src/components/player/video/mini.ts @@ -56,8 +56,6 @@ export class MiniVideoControls extends Adw.Bin { this._duration_label.label = track.duration_seconds ? seconds_to_string(track.duration_seconds) : track.duration ?? "00:00"; - { - } } } diff --git a/src/components/player/view.ts b/src/components/player/view.ts index bbe9ae46..d990908c 100644 --- a/src/components/player/view.ts +++ b/src/components/player/view.ts @@ -1,7 +1,5 @@ import GObject from "gi://GObject"; import Adw from "gi://Adw"; -import GLib from "gi://GLib"; -import Gtk from "gi://Gtk?version=4.0"; import { MiniPlayerView } from "./mini.js"; import { FullPlayerView } from "./full.js"; diff --git a/src/components/playlist/columnview.ts b/src/components/playlist/columnview.ts index 26412e43..8818e231 100644 --- a/src/components/playlist/columnview.ts +++ b/src/components/playlist/columnview.ts @@ -651,7 +651,7 @@ export class PlaylistColumnView extends Gtk.ColumnView { "playlist-id", "Playlist ID", "The playlist ID", - null as any, + null, GObject.ParamFlags.READWRITE, ), album: GObject.param_spec_boolean( diff --git a/src/components/playlist/edit.ts b/src/components/playlist/edit.ts index 8ef5270d..e81852f5 100644 --- a/src/components/playlist/edit.ts +++ b/src/components/playlist/edit.ts @@ -51,7 +51,7 @@ export class PrivacyStatus extends GObject.Object { } } -export interface PrivacyStatus { +export interface PrivacyStatusProps { id: string; name: string; description: string; @@ -188,7 +188,7 @@ export class EditPlaylistDialog extends Adw.PreferencesDialog { await edit_playlist(this.playlist.id, { title: values.title, description: values.description, - privacy_status: values.privacy.id as any, + privacy_status: values.privacy.id as "PUBLIC", }); add_toast(_("Playlist saved")); diff --git a/src/components/playlist/itemview.ts b/src/components/playlist/itemview.ts index cd57d227..c4d8bc99 100644 --- a/src/components/playlist/itemview.ts +++ b/src/components/playlist/itemview.ts @@ -157,9 +157,7 @@ export class PlaylistItemView extends Adw.Bin { this._model = model; - this.multi_selection_model = new Gtk.MultiSelection({ - model: model as any, - }); + this.multi_selection_model = new Gtk.MultiSelection({ model: model! }); this.set_current_property("model", this.multi_selection_model); @@ -232,12 +230,12 @@ export class PlaylistItemView extends Adw.Bin { } const props = { - header_factory: this.header_factory ?? (null as any), + header_factory: this.header_factory ?? (null as unknown as undefined), model: this.multi_selection_model!, selection_mode: this.selection_mode, album: this.album, show_add: this.show_add, - playlistId: this.playlistId ?? (null as any), + playlistId: this.playlistId ?? (null as unknown as undefined), editable: this.editable, }; diff --git a/src/components/playlist/listitem.ts b/src/components/playlist/listitem.ts index 0d8e1c7f..95473ad4 100644 --- a/src/components/playlist/listitem.ts +++ b/src/components/playlist/listitem.ts @@ -1,6 +1,5 @@ import Gtk from "gi://Gtk?version=4.0"; import GObject from "gi://GObject"; -import GLib from "gi://GLib"; import type { PlaylistItem } from "libmuse"; diff --git a/src/components/playlist/listview.ts b/src/components/playlist/listview.ts index 95526ca6..11dc4eb7 100644 --- a/src/components/playlist/listview.ts +++ b/src/components/playlist/listview.ts @@ -31,7 +31,7 @@ export class PlaylistListView extends Gtk.ListView { "playlist-id", "Playlist ID", "The playlist ID", - null as any, + null, GObject.ParamFlags.READWRITE, ), album: GObject.param_spec_boolean( @@ -185,7 +185,7 @@ export class PlaylistListView extends Gtk.ListView { item.signals.add( item, - item.connect("add", (_) => { + item.connect("add", () => { this.emit("add", list_item.position); }), ); diff --git a/src/components/search/topresultcard.ts b/src/components/search/topresultcard.ts index dff83f8d..10e8394f 100644 --- a/src/components/search/topresultcard.ts +++ b/src/components/search/topresultcard.ts @@ -438,7 +438,10 @@ export class TopResultCard extends Adw.Bin { this.show_playlist(top_result); break; default: - console.error("Unknown top result type", (top_result as any).type); + console.error( + "Unknown top result type", + (top_result as TopResult).type, + ); return; } } diff --git a/src/mpris.ts b/src/mpris.ts index 07c5197a..d6593b60 100644 --- a/src/mpris.ts +++ b/src/mpris.ts @@ -1,7 +1,6 @@ import Gio from "gi://Gio"; import GLib from "gi://GLib"; import Gtk from "gi://Gtk?version=4.0"; -import GstPlay from "gi://GstPlay"; import type { LikeStatus } from "libmuse"; @@ -170,7 +169,7 @@ export class DBusInterface { parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation, ) { - const args = parameters.unpack() as any[]; + const args = parameters.unpack() as unknown[]; this.method_inargs.get(method_name)!.forEach((sig, i) => { if (sig === "h") { @@ -185,7 +184,9 @@ export class DBusInterface { let result; try { - result = (this[method_snake_name as keyof this] as any)(...args); + result = ( + this[method_snake_name as keyof this] as (...args: unknown[]) => unknown + )(...args); } catch (error) { invocation.return_dbus_error( interface_name, @@ -206,7 +207,7 @@ export class DBusInterface { } } - _dbus_emit_signal(signal_name: string, values: Record) { + _dbus_emit_signal(signal_name: string, values: Record) { if (this.signals.size === 0) return; const signal = this.signals.get(signal_name)!; @@ -218,7 +219,8 @@ export class DBusInterface { parameters.push(GLib.Variant.new(signature, value)); } - const variant = GLib.Variant.new_tuple(parameters as any); + // @ts-expect-error incorrect types + const variant = GLib.Variant.new_tuple(parameters); this.connection.emit_signal( null, @@ -291,7 +293,7 @@ export class MPRIS extends DBusInterface { this.player.connect("notify::seeking", () => { if (!this.player.seeking) { - this._on_seek_finished(this as any, this.player.timestamp); + this._on_seek_finished(this, this.player.timestamp); } }), ]); @@ -300,7 +302,7 @@ export class MPRIS extends DBusInterface { _get_playback_status() { if (this.player.playing) { return "Playing"; - } else if (this.player.state === GstPlay.PlayState.PAUSED) { + } else if (this.player.is_prepared()) { return "Paused"; } else { return "Stopped"; @@ -356,11 +358,11 @@ export class MPRIS extends DBusInterface { "xesam:album": GLib.Variant.new_string(track.album?.name ?? ""), "xesam:artist": GLib.Variant.new_array( GLib.VariantType.new("s"), - artists as any, + artists, ), "xesam:albumArtist": GLib.Variant.new_array( GLib.VariantType.new("s"), - artists as any, + artists, ), "mpris:artUrl": GLib.Variant.new_string(largest_thumbnail.url), }; @@ -396,7 +398,7 @@ export class MPRIS extends DBusInterface { this._on_player_model_changed(this.player.queue.list, 0, 0, 0); } - previous_state = new Map(); + previous_state = new Map(); _on_player_model_changed( model: Gio.ListStore, @@ -467,7 +469,7 @@ export class MPRIS extends DBusInterface { ); } - private _on_seek_finished(_: Gtk.Widget, position: number) { + private _on_seek_finished(_: this, position: number) { this._seeked(Math.trunc(position)); } @@ -559,7 +561,7 @@ export class MPRIS extends DBusInterface { * * Not implemented */ - open_uri(_uri: string) { + open_uri() { return; } @@ -593,7 +595,7 @@ export class MPRIS extends DBusInterface { const iface = interface_name.get_string()[0]; switch (iface) { - case this.MEDIA_PLAYER2_IFACE: + case this.MEDIA_PLAYER2_IFACE: { const application_id = this.app.get_application_id() ?? ""; return { @@ -607,7 +609,8 @@ export class MPRIS extends DBusInterface { SupportedUriSchemes: GLib.Variant.new_strv([]), SupportedMimeTypes: GLib.Variant.new_strv([]), }; - case this.MEDIA_PLAYER2_PLAYER_IFACE: + } + case this.MEDIA_PLAYER2_PLAYER_IFACE: { const position_msecond = Math.trunc(this.player.timestamp); const playback_status = this._get_playback_status(); const is_shuffle = this.player.queue.shuffle; @@ -632,6 +635,7 @@ export class MPRIS extends DBusInterface { CanSeek: GLib.Variant.new_boolean(true), CanControl: GLib.Variant.new_boolean(true), }; + } case "org.freedesktop.DBus.Properties": return {}; case "org.freedesktop.DBus.Introspectable": @@ -683,14 +687,14 @@ export class MPRIS extends DBusInterface { break; default: console.warn( - `MPRIS can not set, as it does not implement ${interface_name}`, + `MPRIS can not set, as it does not implement ${interface_name.get_string()[0]}`, ); } } _properties_changed( interface_name: string, - changed_properties: Record>, + changed_properties: Record, invalidated_properties: string[], ) { this._dbus_emit_signal("PropertiesChanged", { diff --git a/src/muse.ts b/src/muse.ts index bf9d431a..40be47dd 100644 --- a/src/muse.ts +++ b/src/muse.ts @@ -6,7 +6,6 @@ import "core-js/features/url"; // Headers import { Headers } from "headers-polyfill"; -/// @ts-ignore globalThis.Headers = Headers; // Headers diff --git a/src/navigation.ts b/src/navigation.ts index bb33c7b0..538f817f 100644 --- a/src/navigation.ts +++ b/src/navigation.ts @@ -154,7 +154,7 @@ export class Navigator extends GObject.Object { }, { name: "back", - activate: (_) => { + activate: () => { this.back(); }, }, @@ -260,7 +260,9 @@ export class Navigator extends GObject.Object { if (search_match) { this.emit( "search-changed", - decodeURIComponent((search_match.params as any).query), + decodeURIComponent( + (search_match.params as Record).query, + ), ); } diff --git a/src/pages/authentication-error.ts b/src/pages/authentication-error.ts index 1d33c985..4bf8ac63 100644 --- a/src/pages/authentication-error.ts +++ b/src/pages/authentication-error.ts @@ -58,7 +58,7 @@ export class AuthenticationErrorPage extends Adw.Bin { } } - set_error(error: any) { + set_error(error: unknown) { if (error instanceof Error) { this.set_more(!!error, error_to_string(error)); } else { diff --git a/src/pages/charts.ts b/src/pages/charts.ts index 6fb919ba..9b46e892 100644 --- a/src/pages/charts.ts +++ b/src/pages/charts.ts @@ -160,7 +160,7 @@ export class ChartsPage carousel.show_content({ title, display: "mood", - contents: data.results as any, + contents: data.results, }); this._box.append(carousel); diff --git a/src/pages/error.ts b/src/pages/error.ts index 7a8a7c87..5ea60b24 100644 --- a/src/pages/error.ts +++ b/src/pages/error.ts @@ -14,7 +14,7 @@ export function error_to_string(error: Error) { } export interface ErrorPageOptions { - error?: any; + error?: unknown; } export class ErrorPage extends Adw.Bin { @@ -61,7 +61,7 @@ export class ErrorPage extends Adw.Bin { } } - set_error(error: any) { + set_error(error: unknown) { if (error instanceof GLib.Error) { if ( error instanceof Gio.ResolverError && @@ -80,7 +80,9 @@ export class ErrorPage extends Adw.Bin { this.set_message(`${error.name}: ${error.message}`); this.set_more(!!error, error_to_string(error)); } else { - this.set_message(error ? _(`Error: ${error}`) : _("Unknown error")); + this.set_message( + error ? _(`Error: ${error.toString()}`) : _("Unknown error"), + ); this.set_more(false); } } diff --git a/src/pages/explore.ts b/src/pages/explore.ts index 6267d892..cc4b84e7 100644 --- a/src/pages/explore.ts +++ b/src/pages/explore.ts @@ -118,7 +118,7 @@ export class ExplorePage carousel.show_content({ title, display: "mood", - contents: data.results as any, + contents: data.results, }); this._box.append(carousel); diff --git a/src/pages/library/history.ts b/src/pages/library/history.ts index b8c6b146..2f7be6f9 100644 --- a/src/pages/library/history.ts +++ b/src/pages/library/history.ts @@ -5,7 +5,7 @@ import Gtk from "gi://Gtk?version=4.0"; import { get_history } from "libmuse"; import type { History, PlaylistItem } from "libmuse"; -import { MuzikaPageWidget, PageLoadContext } from "src/navigation.js"; +import { MuzikaPageWidget } from "src/navigation.js"; import { PlaylistItemView } from "src/components/playlist/itemview.js"; import { SectionedPlayableContainer, @@ -160,7 +160,7 @@ export class HistoryPage this.present(state.results); } - static load(context: PageLoadContext) { + static load() { return get_history(); } } diff --git a/src/pages/login.ts b/src/pages/login.ts index 5b2e874d..38d0f09d 100644 --- a/src/pages/login.ts +++ b/src/pages/login.ts @@ -3,7 +3,7 @@ import Gdk from "gi://Gdk?version=4.0"; import GObject from "gi://GObject"; import Adw from "gi://Adw"; -/// @ts-expect-error +/// @ts-expect-error this package has no types import QRCode from "@lemaik/qrcode-svg"; import { get_option } from "libmuse"; diff --git a/src/pages/moods.ts b/src/pages/moods.ts index 076676bb..aaa1bddd 100644 --- a/src/pages/moods.ts +++ b/src/pages/moods.ts @@ -85,7 +85,7 @@ export class MoodsPage carousel.show_content({ title: data.title, display: "mood", - contents: data.items as any[], + contents: data.items, }); this._box.append(carousel); diff --git a/src/pages/playlist.ts b/src/pages/playlist.ts index a8b740bd..37492b67 100644 --- a/src/pages/playlist.ts +++ b/src/pages/playlist.ts @@ -30,7 +30,6 @@ import { EditedValues, EditPlaylistDialog, } from "src/components/playlist/edit.js"; -import { Window } from "src/window.js"; import { PlayableContainer, PlayableList } from "src/util/playablelist.js"; import { AddActionEntries } from "src/util/action.js"; import { generate_menu } from "src/util/menu/index.js"; @@ -131,7 +130,7 @@ export class PlaylistPage (group.add_action_entries as AddActionEntries)([ { name: "delete", - activate: (__) => { + activate: () => { this.delete_playlist(); }, }, @@ -336,7 +335,7 @@ export class PlaylistPage this.playlist.title = values.title; this.playlist.description = values.description; - this.playlist.privacy = values.privacy.id as any; + this.playlist.privacy = values.privacy.id as "PUBLIC"; this._header.set_title(values.title); this._header.set_description(values.description); diff --git a/src/pages/search.ts b/src/pages/search.ts index b327ae88..0c9e45c2 100644 --- a/src/pages/search.ts +++ b/src/pages/search.ts @@ -9,7 +9,7 @@ import type { Filter, SearchOptions, SearchResults, SearchRuns } from "libmuse"; import { SearchSection } from "../components/search/section.js"; import { TopResultSection } from "../components/search/topresultsection.js"; import { Paginator } from "../components/paginator.js"; -import { InlineTabSwitcher, Tab } from "../components/inline-tab-switcher.js"; +import { InlineTabSwitcher } from "../components/inline-tab-switcher.js"; import { MuzikaPageWidget, PageLoadContext } from "src/navigation.js"; import { escape_label } from "src/util/text.js"; import { @@ -267,7 +267,8 @@ export class SearchPage decodeURIComponent(context.match.params.query), { signal: context.signal, - ...Object.fromEntries(context.url.searchParams as any), + // @ts-expect-error types wonky + ...Object.fromEntries(context.url.searchParams as unknown), autocorrect: autocorrect ? autocorrect === "true" : undefined, }, ] as const; @@ -300,13 +301,16 @@ export function search_args_to_url( options: SearchOptions = {}, replace = false, ) { - const opts = options as Record; - if (replace) opts.replace = true; + const opts = options as Record; + + if (replace) opts.replace = "true"; + const params = new URLSearchParams( Object.entries(opts) - .filter(([_, v]) => v != null) + .filter(([, v]) => v != null) .filter(([k]) => k !== "signal"), ).toString(); + let url_string = `muzika:search:${encodeURIComponent(query)}`; if (params) url_string += `?${params}`; diff --git a/src/player/helpers.ts b/src/player/helpers.ts index 06e773b7..0edee676 100644 --- a/src/player/helpers.ts +++ b/src/player/helpers.ts @@ -9,7 +9,7 @@ import { omit } from "lodash-es"; import { QueueSettings, RepeatMode } from "./queue"; import { get_player } from "src/application"; -function create_cache_map() { +function create_cache_map() { return new Map(); } diff --git a/src/player/index.ts b/src/player/index.ts index 9cd31cc8..78876ebe 100644 --- a/src/player/index.ts +++ b/src/player/index.ts @@ -136,16 +136,18 @@ class MuzikaPlaySignalAdapter extends GObject.Object { case GstPlay.PlayMessage.END_OF_STREAM: this.emit_message("end-of-stream", []); break; - case GstPlay.PlayMessage.ERROR: + case GstPlay.PlayMessage.ERROR: { const error = GstPlay.play_message_parse_error(message); this.emit_message("error", [error[0]!, error[1]!]); break; - case GstPlay.PlayMessage.WARNING: + } + case GstPlay.PlayMessage.WARNING: { const warning = GstPlay.play_message_parse_warning(message); this.emit_message("warning", [warning[0]!, warning[1]!]); break; + } case GstPlay.PlayMessage.VIDEO_DIMENSIONS_CHANGED: this.emit_message( "video-dimensions-changed", @@ -283,6 +285,7 @@ export class MuzikaMediaStream extends Gtk.MediaStream { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any this._paintable = (sink as any).paintable; this.notify("paintable"); @@ -491,7 +494,7 @@ export class MuzikaMediaStream extends Gtk.MediaStream { } } - private duration_changed_cb(_play: GstPlay.Play): void { + private duration_changed_cb(): void { this.notify("duration"); } @@ -512,7 +515,7 @@ export class MuzikaMediaStream extends Gtk.MediaStream { this.gerror(error); } - protected eos_cb(_play: GstPlay.Play): boolean { + protected eos_cb(): boolean { if (this._play.duration - this._play.position >= Gst.SECOND) { // this means an error occured, we might need to refresh the uri if (!this.refreshed_uri) { @@ -551,12 +554,12 @@ export class MuzikaMediaStream extends Gtk.MediaStream { } } - private volume_changed_cb(_play: GstPlay.Play): void { + private volume_changed_cb(): void { this.notify("volume"); this.notify("cubic-volume"); } - private mute_changed_cb(_play: GstPlay.Play): void { + private mute_changed_cb(): void { this.notify("muted"); } @@ -924,7 +927,7 @@ export class MuzikaPlayer extends MuzikaMediaStream { this.refreshed_uri = true; this._now_playing = new ObjectContainer({ - ...this.now_playing?.object!, + ...this.now_playing!.object, song, }); @@ -943,8 +946,8 @@ export class MuzikaPlayer extends MuzikaMediaStream { }); } - protected eos_cb(_play: GstPlay.Play) { - if (super.eos_cb(_play)) { + protected eos_cb() { + if (super.eos_cb()) { this.queue.repeat_or_next(); } diff --git a/src/player/mpd.ts b/src/player/mpd.ts index 3b199df0..edb83aef 100644 --- a/src/player/mpd.ts +++ b/src/player/mpd.ts @@ -34,10 +34,10 @@ export function convert_formats_to_dash(song: Song) { "@name": "Period", "#children": [ ...formats.reduce( - (acc, format, index) => { + (acc, format) => { if (format.has_audio && format.has_video) return acc; - const representation: Record = { + const representation: Record = { "@name": "Representation", id: format.itag, mimeType: escape_attribute(format.mime_type.split(";")[0]), @@ -98,7 +98,7 @@ export function convert_formats_to_dash(song: Song) { ).sample_rate; } - const definition: Record = { + const definition: Record = { "@name": "AdaptationSet", mimeType: escape_attribute(format.mime_type.split(";")[0]), segmentAlignment: "true", @@ -117,14 +117,14 @@ export function convert_formats_to_dash(song: Song) { }); if (existing) { - existing["#children"].push(representation); + (existing["#children"] as unknown[]).push(representation); } else { acc.push(definition); } return acc; }, - [] as Record[], + [] as Record[], ), // see https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2872 ...song.captions.map((caption, index) => { @@ -213,7 +213,7 @@ function get_presentation_duration(media: Format[]) { } function escape_attribute(str: string) { - return str.replace(/\"/g, '\\"').replace(/\'/g, "\\'"); + return str.replace(/"/g, '\\"').replace(/'/g, "\\'"); } function escape_uri(uri: string) { @@ -231,8 +231,8 @@ function indent(str: string) { .join("\n"); } -function objectToSchema(obj: any) { - const attributes: Record = {}; +function objectToSchema(obj: Record) { + const attributes: Record = {}; const noindent = Object.hasOwn(obj, "@noindent"); @@ -249,7 +249,7 @@ function objectToSchema(obj: any) { if (Array.isArray(value)) { body += value.map((child) => indent(objectToSchema(child))).join("\n"); } else { - body += (noindent ? "" : " ") + value.toString(); + body += (noindent ? "" : " ") + value?.toString(); } continue; } @@ -258,7 +258,7 @@ function objectToSchema(obj: any) { } const attributes_string = Object.entries(attributes) - .map(([key, value]) => `${key}="${value}"`) + .map(([key, value]) => `${key}="${value?.toString()}"`) .join(" "); const body_text = noindent @@ -267,11 +267,11 @@ function objectToSchema(obj: any) { ${body} `; - const closing = body ? `>${body_text}` : "/>"; + const tag = obj["@name"] as string; - return `<${obj["@name"]}${ - attributes_string ? " " + attributes_string : "" - }${closing}`; + const closing = body ? `>${body_text}` : "/>"; + + return `<${tag}${attributes_string ? " " + attributes_string : ""}${closing}`; } function get_ratio(a: number, b: number) { diff --git a/src/player/queue.ts b/src/player/queue.ts index b206fb1c..0681dda5 100644 --- a/src/player/queue.ts +++ b/src/player/queue.ts @@ -2,6 +2,8 @@ import GObject from "gi://GObject"; import Gio from "gi://Gio"; import GLib from "gi://GLib"; +import { omit } from "lodash-es"; + import { get_queue } from "libmuse"; import type { Queue as MuseQueue, QueueTrack } from "libmuse"; @@ -32,7 +34,7 @@ export interface QueueMeta extends QueueTrack { } // Durstenfeld's modification of Fisher-Yates shuffle -function durstenfeld_shuffle(array: T[]) { +function durstenfeld_shuffle(array: T[]) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; @@ -124,7 +126,7 @@ export class Queue extends GObject.Object { "active-chip", "Active chip", "The active chip", - null as any, + null, GObject.ParamFlags.READWRITE, ), "preferred-media-type": GObject.param_spec_uint( @@ -242,7 +244,7 @@ export class Queue extends GObject.Object { } private _settings: ObjectContainer = new ObjectContainer( - null as any, + null!, ); get settings() { @@ -375,7 +377,7 @@ export class Queue extends GObject.Object { activate: (__, param) => { if (!param) return; - const url = new URL(`muzika:${param.get_string()}`); + const url = new URL(`muzika:${param.get_string()[0]}`); const params = url.searchParams; this.add_playlist(url.pathname, params.get("video") ?? undefined, { @@ -608,7 +610,7 @@ export class Queue extends GObject.Object { } if (options.play) { - this.set_settings(_omit(queue, ["tracks"])); + this.set_settings(omit(queue, ["tracks"])); const position = queue.current?.index ? queue.current?.index % queue.tracks.length @@ -632,7 +634,7 @@ export class Queue extends GObject.Object { const queue = await get_track_queue(song_ids[0], { radio: true }); tracks = queue.tracks; - first_track_options = _omit(queue, ["tracks"]); + first_track_options = omit(queue, ["tracks"]); } else { [tracks, first_track_options] = await Promise.all([ get_tracklist(song_ids).then((tracks) => tracks ?? []), @@ -868,17 +870,6 @@ interface AddPlaylistOptions { radio?: boolean; } -function _omit, Key extends keyof Object>( - object: Object, - keys: Key[], -): Omit { - const new_object = { ...object }; - for (const key of keys) { - delete new_object[key]; - } - return new_object; -} - export function tracks_to_meta( tracks: QueueTrack[], playlist: string | null = null, diff --git a/src/polyfills/abortcontroller.ts b/src/polyfills/abortcontroller.ts index bda00a40..4f776318 100644 --- a/src/polyfills/abortcontroller.ts +++ b/src/polyfills/abortcontroller.ts @@ -20,12 +20,14 @@ export class AbortSignal extends EventTarget implements globalThis.AbortSignal { return this._aborted; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any private _reason: any = null; get reason() { return this._reason; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any private _onabort: ((this: globalThis.AbortSignal, ev: Event) => any) | null = null; diff --git a/src/polyfills/base64.ts b/src/polyfills/base64.ts index 804ca7ca..805cc6ad 100644 --- a/src/polyfills/base64.ts +++ b/src/polyfills/base64.ts @@ -11,7 +11,5 @@ export function btoa(string: string) { return GLib.base64_encode(encoder.encode(string)); } -// @ts-ignore globalThis.atob = atob; -// @ts-ignore globalThis.btoa = btoa; diff --git a/src/polyfills/customevent.ts b/src/polyfills/customevent.ts index 4d66ad6b..a018bea0 100644 --- a/src/polyfills/customevent.ts +++ b/src/polyfills/customevent.ts @@ -3,7 +3,7 @@ // EventTarget import "event-target-polyfill"; -export class CustomEvent +export class CustomEvent extends Event implements globalThis.CustomEvent { @@ -14,12 +14,7 @@ export class CustomEvent this.detail = eventInitDict?.detail ?? (null as T); } - initCustomEvent( - _type: string, - _bubbles?: boolean | undefined, - _cancelable?: boolean | undefined, - _detail?: any, - ): void { + initCustomEvent(): void { throw new Error("Method not implemented."); } } diff --git a/src/polyfills/fetch.ts b/src/polyfills/fetch.ts index a4505541..bf3b0811 100644 --- a/src/polyfills/fetch.ts +++ b/src/polyfills/fetch.ts @@ -139,6 +139,8 @@ export class GResponse { const reader = this._body.getReader(); const chunks: Uint8Array[] = []; + // TODO: find a better way to do this + // eslint-disable-next-line no-constant-condition while (true) { const { done, value } = await reader.read(); if (done) break; @@ -240,6 +242,8 @@ export async function fetch(url: string | URL, options: FetchOptions = {}) { }); } + // TODO: find a better way to do this + // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { const inputStream = await SESSION.send_async( message, @@ -300,5 +304,5 @@ export async function fetch(url: string | URL, options: FetchOptions = {}) { }); } -// @ts-ignore +// @ts-expect-error polluting the globals window.fetch = fetch; diff --git a/src/util/action.ts b/src/util/action.ts index 0116d5b2..db8bea5a 100644 --- a/src/util/action.ts +++ b/src/util/action.ts @@ -20,15 +20,15 @@ export type AddActionEntries = (entries: ActionEntry[]) => void; export interface ActionDeclaration { name: string; - parameter_type: GLib.VariantType | null; - state?: GLib.Variant | null; - activate?(action: Gio.SimpleAction, parameter: GLib.Variant): void; + parameter_type: GLib.VariantType | null; + state?: GLib.Variant | null; + activate?(action: Gio.SimpleAction, parameter: GLib.Variant): void; bind_state_full?: [ object: GObject.Object, property: string, transform: ( binding: GObject.Binding, - from_value: any, + from_value: unknown, ) => [boolean, GLib.Variant], ]; } @@ -36,7 +36,7 @@ export interface ActionDeclaration { export function build_action(decl: ActionDeclaration) { const action = new Gio.SimpleAction({ name: decl.name, - parameter_type: decl.parameter_type ?? (null as any), + parameter_type: decl.parameter_type ?? (null as unknown as undefined), state: decl.state ?? undefined, }); diff --git a/src/util/label.ts b/src/util/label.ts index cd16d550..46495fa2 100644 --- a/src/util/label.ts +++ b/src/util/label.ts @@ -11,6 +11,7 @@ export function setup_link_label( function connect( widget: Obj, signal: Signal, + // eslint-disable-next-line @typescript-eslint/no-explicit-any fn: (...args: any[]) => any, ) { if (listeners) { diff --git a/src/util/list.ts b/src/util/list.ts index 0f90b0cb..f152ddd1 100644 --- a/src/util/list.ts +++ b/src/util/list.ts @@ -30,9 +30,7 @@ export function get_selected( const selected: number[] = []; - const [has_selection, bitset, first] = Gtk.BitsetIter.init_first( - model.get_selection(), - ); + const [, bitset] = Gtk.BitsetIter.init_first(model.get_selection()); while (bitset.is_valid()) { selected.push(bitset.get_value()); diff --git a/src/util/menu/index.ts b/src/util/menu/index.ts index 2cb96d86..e313644d 100644 --- a/src/util/menu/index.ts +++ b/src/util/menu/index.ts @@ -44,7 +44,7 @@ export type MenuProp = | MenuSubmenu | MenuSection; -function is_gio_menu_item(item: any): item is Gio.MenuItem { +function is_gio_menu_item(item: unknown): item is Gio.MenuItem { return typeof item === "object" && item instanceof Gio.MenuItem; } @@ -86,18 +86,18 @@ function generate_menu_item(props: NonNullable) { } } -function filter_null(menu_props: T[]) { +function filter_null(menu_props: T[]) { return menu_props.filter((prop) => prop !== null) as NonNullable[]; } -type PopoverChildren = Record Gtk.Widget>; +type MenuChildrenRenderer = (popover: Gtk.Popover) => Gtk.Widget; export function generate_menu(props: MenuProp[]) { - const menu = new Gio.Menu(); + const menu = new Gio.Menu() as MenuWithChildrenRenderers; - const children: PopoverChildren = {}; + const children: Record = {}; - (menu as any).children = children; + menu.children = children; filter_null(props).forEach((item) => { if (is_gio_menu_item(item)) { @@ -105,7 +105,7 @@ export function generate_menu(props: MenuProp[]) { if (item.get_attribute_value("custom", GLib.VariantType.new("s"))) { const child = item.get_attribute_value("custom", null)!.get_string()[0]; - children[child] = (item as any)["__child"]; + children[child] = (item as MenuItemWithChildRenderer)["__child"]; } } else if (is_submenu(item)) { const submenu = new Gio.Menu(); @@ -215,7 +215,7 @@ export class MenuHelper { this.popover_menu = null; } - const menu = generate_menu(props); + const menu = generate_menu(props) as MenuWithChildrenRenderers; this.popover_menu = new Gtk.PopoverMenu({ has_arrow: false, @@ -225,7 +225,7 @@ export class MenuHelper { }); // generate and set custom popover children - const children = (menu as any).children as PopoverChildren; + const children = menu.children; if (children && Object.keys(children).length > 0) { for (const [name, child] of Object.entries(children)) { this.popover_menu.add_child(child(this.popover_menu), name); @@ -245,3 +245,11 @@ export class MenuHelper { } export type PropsBuilder = () => MenuProp[]; + +export interface MenuItemWithChildRenderer extends Gio.MenuItem { + __child: MenuChildrenRenderer; +} + +export interface MenuWithChildrenRenderers extends Gio.Menu { + children: Record; +} diff --git a/src/util/menu/like.ts b/src/util/menu/like.ts index c88b7930..352666f0 100644 --- a/src/util/menu/like.ts +++ b/src/util/menu/like.ts @@ -3,6 +3,7 @@ import GLib from "gi://GLib"; import Gtk from "gi://Gtk?version=4.0"; import { LikeStatus } from "libmuse"; +import { MenuItemWithChildRenderer } from "."; export type LikeRowCallback = (status: LikeStatus) => void; @@ -12,11 +13,11 @@ export function menuLikeRow( cb?: LikeRowCallback, ) { if (!status) return null; - const menu = new Gio.MenuItem(); + const menu = new Gio.MenuItem() as MenuItemWithChildRenderer; menu.set_label(_("Change rating of track")); menu.set_attribute_value("custom", GLib.Variant.new_string("rate-button")); - (menu as any)["__child"] = (popover: Gtk.Popover) => { + menu.__child = (popover: Gtk.Popover) => { const box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, spacing: 3, diff --git a/src/util/objectcontainer.ts b/src/util/objectcontainer.ts index 09a05388..13d50aa5 100644 --- a/src/util/objectcontainer.ts +++ b/src/util/objectcontainer.ts @@ -1,6 +1,6 @@ import GObject from "gi://GObject"; -export class ObjectContainer extends GObject.Object { +export class ObjectContainer extends GObject.Object { static { if (!GObject.type_from_name("ObjectContainer")) { GObject.registerClass( @@ -30,7 +30,7 @@ export class ObjectContainer extends GObject.Object { } } -export class OptionalObjectContainer extends GObject.Object { +export class OptionalObjectContainer extends GObject.Object { static { GObject.registerClass( { diff --git a/src/util/playablelist.ts b/src/util/playablelist.ts index c2daba51..450a20a7 100644 --- a/src/util/playablelist.ts +++ b/src/util/playablelist.ts @@ -90,16 +90,14 @@ function get_search_content_props(item: SearchContent) { return props; } -export interface PlayableContainerProps { +export interface PlayableContainerProps { object: T; video_id?: string; playlist_id?: string; is_playlist?: boolean; } -export class PlayableContainer< - T extends Object = PlaylistItem, -> extends GObject.Object { +export class PlayableContainer extends GObject.Object { static { GObject.registerClass( { @@ -113,19 +111,19 @@ export class PlayableContainer< GObject.Object.$gtype, ), state: get_state_pspec(), - video_id: GObject.ParamSpec.string( + video_id: GObject.param_spec_string( "video-id", "Video ID", "The video ID of the item", + null, GObject.ParamFlags.READWRITE, - null as any, ), - playlist_id: GObject.ParamSpec.string( + playlist_id: GObject.param_spec_string( "playlist-id", "Playlist ID", "The playlist ID of the item", + null, GObject.ParamFlags.READWRITE, - null as any, ), is_playlist: GObject.ParamSpec.boolean( "is-playlist", @@ -157,7 +155,7 @@ export class PlayableContainer< if (props.is_playlist != null) this.is_playlist = props.is_playlist; } - static new(object: T): PlayableContainer { + static new(object: T): PlayableContainer { return new PlayableContainer({ object }); } @@ -184,15 +182,15 @@ export class PlayableContainer< } export interface SectionedPlayableContainerProps< - T extends Object = PlaylistItem, - Section extends Object = Object, + T = PlaylistItem, + Section = unknown, > extends PlayableContainerProps { section?: ObjectContainer
| null; } export class SectionedPlayableContainer< - T extends Object = PlaylistItem, - Section extends Object = Object, + T = PlaylistItem, + Section = unknown, > extends PlayableContainer { static { GObject.registerClass( @@ -239,7 +237,7 @@ export class SectionedPlayableContainer< return this.section?.object != null; } - static new( + static new( item: T, section: Section | null = null, ): SectionedPlayableContainer { @@ -249,7 +247,7 @@ export class SectionedPlayableContainer< }); } - static new_from_playlist_item
( + static new_from_playlist_item
( item: PlaylistItem, section: Section | null = null, ) { @@ -260,7 +258,7 @@ export class SectionedPlayableContainer< }); } - static new_from_mixed_card_item
( + static new_from_mixed_card_item
( item: MixedCardItem, section: Section | null = null, ) { @@ -270,7 +268,7 @@ export class SectionedPlayableContainer< }); } - static new_from_search_content
( + static new_from_search_content
( item: SearchContent, section: Section | null = null, ) { @@ -286,7 +284,7 @@ export interface PlayableListProps { } export class PlayableList< - T extends Object = PlaylistItem, + T = PlaylistItem, Container extends PlayableContainer = PlayableContainer, > extends GObject.Object @@ -453,9 +451,10 @@ export class PlayableList< } } -export class SectionedPlayableList< - T extends Object = PlaylistItem, -> extends PlayableList> { +export class SectionedPlayableList extends PlayableList< + T, + SectionedPlayableContainer +> { static { GObject.registerClass( { diff --git a/src/util/signal-listener.ts b/src/util/signal-listener.ts index f354be4b..10c567e0 100644 --- a/src/util/signal-listener.ts +++ b/src/util/signal-listener.ts @@ -36,9 +36,9 @@ export class SignalListeners { connect( widget: Obj, signal: Signal, - fn: (...args: any[]) => any, + fn: (...args: unknown[]) => unknown, ) { - const listener = widget.connect(signal, fn as any); + const listener = widget.connect(signal, fn); this.add(widget, listener); return listener; } diff --git a/src/util/text.ts b/src/util/text.ts index 1db060ad..a23a14cf 100644 --- a/src/util/text.ts +++ b/src/util/text.ts @@ -78,6 +78,6 @@ export function pretty_subtitles( return { markup: merge(author_markup), plain: merge(author_plain) }; } -function is_artist_run(node: any): node is ArtistRun { - return node && typeof node === "object" && "name" in node; +function is_artist_run(node: unknown): node is ArtistRun { + return !!node && typeof node === "object" && "name" in node; } diff --git a/src/window.ts b/src/window.ts index 5f04916e..e3f69d93 100644 --- a/src/window.ts +++ b/src/window.ts @@ -190,19 +190,19 @@ export class Window extends Adw.ApplicationWindow { }, { name: "show-main-view", - activate: (_) => { + activate: () => { this.show_view("main"); }, }, { name: "toggle-show-video", - activate: (_) => { + activate: () => { this.toggle_show_video(); }, }, { name: "fullscreen", - activate: (_) => { + activate: () => { this.fullscreen_video(); }, }, diff --git a/types/ambient.d.ts b/types/ambient.d.ts index e505d46a..472382da 100644 --- a/types/ambient.d.ts +++ b/types/ambient.d.ts @@ -2,7 +2,7 @@ declare function _(id: string): string; declare function C_(context: string, id: string): string; declare function print(args: string): void; declare function log(obj: object, others?: object[]): void; -declare function log(msg: string, substitutions?: any[]): void; +declare function log(msg: string, substitutions?: unknown[]): void; declare const pkg: { version: string; @@ -18,9 +18,9 @@ declare interface Number { declare module imports { const format: { - format(this: string, ...args: any[]): string; - printf(fmt: string, ...args: any[]): string; - vprintf(fmt: string, args: any[]): string; + format(this: string, ...args: unknown[]): string; + printf(fmt: string, ...args: unknown[]): string; + vprintf(fmt: string, args: unknown[]): string; }; } From 81a62c76755cb6b25618aa60d73bb8812ac6ec36 Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Thu, 9 May 2024 05:36:09 +0200 Subject: [PATCH 5/6] ci: add CI for eslint --- .github/workflows/ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d626c079..b542688f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,3 +63,21 @@ jobs: with: folder: ${{ steps.build.outputs.repository }} target-folder: repo + + lint: + name: ESLint + runs-on: ubuntu-latest # on which machine to run + steps: # list of steps + - name: Install NodeJS + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Code Checkout + uses: actions/checkout@v4 + + - name: Install Dependencies + run: npm ci + + - name: Code Linting + run: npm run lint From deec8cc0eca1bf09f5f07ea835df9449e0555bdc Mon Sep 17 00:00:00 2001 From: Angelo Verlain Date: Thu, 9 May 2024 05:37:50 +0200 Subject: [PATCH 6/6] ci: use yarn for CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b542688f..8002e345 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: uses: actions/checkout@v4 - name: Install Dependencies - run: npm ci + run: yarn install --frozen-lockfile - name: Code Linting - run: npm run lint + run: yarn lint