Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Enable audio interactions on the audio track component (#1593)

Dhruv Bhanushali56d8f8781eda
diff --git a/package.json b/package.json
index a522c7fe3..ba6dea59e 100644
--- a/package.json
+++ b/package.json
@@ -156,6 +156,7 @@
"rimraf": "^3.0.2",
"tailwind-config-viewer": "^1.6.3",
"tailwindcss": "^3.0.23",
+ "tailwindcss-labeled-groups": "^0.0.2",
"tailwindcss-rtl": "^0.9.0",
"talkback": "^3.0.1",
"ts-node": "^10.7.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bc34b2f51..328797057 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -92,6 +92,7 @@ specifiers:
seeded-rand: ^2.0.1
tailwind-config-viewer: ^1.6.3
tailwindcss: ^3.0.23
+ tailwindcss-labeled-groups: ^0.0.2
tailwindcss-rtl: ^0.9.0
talkback: ^3.0.1
throttle-debounce: ^5.0.0
@@ -114,7 +115,7 @@ dependencies:
'@nuxt/postcss8': [email protected]
'@nuxt/vue-app': 2.15.8
'@nuxtjs/composition-api': 0.33.1_cche4dkf5nk7uchm2m2hnrg5am
- '@nuxtjs/i18n': [email protected]
+ '@nuxtjs/i18n': 7.2.0
'@nuxtjs/redirect-module': 0.3.1
'@nuxtjs/sentry': 5.1.7
'@nuxtjs/sitemap': 2.4.0
@@ -150,7 +151,7 @@ dependencies:
throttle-debounce: 5.0.0
uuid: 8.3.2
vue: 2.7.10
- vue-i18n: [email protected]
+ vue-i18n: 8.26.7
devDependencies:
'@babel/core': 7.17.10
@@ -206,7 +207,8 @@ devDependencies:
prettier-plugin-tailwindcss: [email protected]
rimraf: 3.0.2
tailwind-config-viewer: [email protected]
- tailwindcss: 3.0.23_2len4mt2evkrddr6nmldbp7wpa
+ tailwindcss: 3.0.23_z4yclaatiobtrs75ftybxflkiu
+ tailwindcss-labeled-groups: [email protected]
tailwindcss-rtl: 0.9.0
talkback: 3.0.1
ts-node: 10.7.0_cbygeln5s5sjlseyk3kbidkfny
@@ -1717,12 +1719,14 @@ packages:
/@cspotcode/source-map-consumer/0.8.0:
resolution: {integrity: sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==}
engines: {node: '>= 12'}
+ dev: true
/@cspotcode/source-map-support/0.7.0:
resolution: {integrity: sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==}
engines: {node: '>=12'}
dependencies:
'@cspotcode/source-map-consumer': 0.8.0
+ dev: true
/@csstools/convert-colors/1.4.0:
resolution: {integrity: sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw==}
@@ -2609,7 +2613,7 @@ packages:
vue-client-only: 2.1.0
vue-meta: 2.4.0
vue-no-ssr: 1.1.1
- vue-router: [email protected]
+ vue-router: 3.5.3
vue-template-compiler: 2.7.10
transitivePeerDependencies:
@@ -2775,7 +2779,7 @@ packages:
- webpack
dev: true
- /@nuxtjs/i18n/[email protected]:
+ /@nuxtjs/i18n/7.2.0:
resolution: {integrity: sha512-fO/QRMxZ0t6LpYJ7ti6mHc0lsog4SMr7Xll3d45zdVSI7+5eBE1YcoG8yXv1sndGQZoq8k0iD1dXuAJA6UL5ww==}
dependencies:
'@babel/parser': 7.17.3
@@ -2789,10 +2793,9 @@ packages:
klona: 2.0.5
lodash.merge: 4.6.2
ufo: 0.7.9
- vue-i18n: [email protected]
+ vue-i18n: 8.26.7
transitivePeerDependencies:
- supports-color
- - vue
dev: false
/@nuxtjs/redirect-module/0.3.1:
@@ -4597,7 +4600,7 @@ packages:
peerDependencies:
tailwindcss: '>=2.0.0 || >=3.0.0 || >=3.0.0-alpha.1'
dependencies:
- tailwindcss: 3.0.23_2len4mt2evkrddr6nmldbp7wpa
+ tailwindcss: 3.0.23_z4yclaatiobtrs75ftybxflkiu
dev: false
/@tailwindcss/typography/[email protected]:
@@ -4608,7 +4611,7 @@ packages:
lodash.castarray: 4.4.0
lodash.isplainobject: 4.0.6
lodash.merge: 4.6.2
- tailwindcss: 3.0.23_2len4mt2evkrddr6nmldbp7wpa
+ tailwindcss: 3.0.23_z4yclaatiobtrs75ftybxflkiu
dev: false
/@testing-library/dom/7.31.2:
@@ -4685,15 +4688,19 @@ packages:
/@tsconfig/node10/1.0.8:
resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==}
+ dev: true
/@tsconfig/node12/1.0.9:
resolution: {integrity: sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==}
+ dev: true
/@tsconfig/node14/1.0.1:
resolution: {integrity: sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==}
+ dev: true
/@tsconfig/node16/1.0.2:
resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==}
+ dev: true
/@types/anymatch/3.0.0:
resolution: {integrity: sha512-qLChUo6yhpQ9k905NwL74GU7TxH+9UODwwQ6ICNI+O6EDMExqH/Cv9NsbmcZ7yC/rRXJ/AHCzfgjsFRY5fKjYw==}
@@ -5432,6 +5439,7 @@ packages:
'@babel/parser': 7.18.13
postcss: 8.4.16
source-map: 0.6.1
+ dev: false
/@vue/compiler-sfc/3.2.37:
resolution: {integrity: sha512-+7i/2+9LYlpqDv+KTtWhOZH+pa8/HnX/905MdVmAcI/mPQOBwkHHIzrsEsucyOIZQYMkXUiTkmZq5am/NyXKkg==}
@@ -5595,6 +5603,7 @@ packages:
/@vue/devtools-api/6.2.1:
resolution: {integrity: sha512-OEgAMeQXvCoJ+1x8WyQuVZzFo0wcyCmUR3baRVLmKBo1LmYZWMlRiXlux5jd0fqVJu6PfDbOrZItVqUEzLobeQ==}
+ dev: false
/@vue/reactivity-transform/3.2.37:
resolution: {integrity: sha512-IWopkKEb+8qpu/1eMKVeXrK0NLw9HicGviJzhJDEyfxTR9e1WtpnnbYkJWurX6WwoFP0sz10xQg8yL8lgskAZg==}
@@ -5820,10 +5829,12 @@ packages:
acorn: 7.4.1
acorn-walk: 7.2.0
xtend: 4.0.2
+ dev: true
/acorn-walk/7.2.0:
resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==}
engines: {node: '>=0.4.0'}
+ dev: true
/acorn-walk/8.2.0:
resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
@@ -5838,11 +5849,13 @@ packages:
resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==}
engines: {node: '>=0.4.0'}
hasBin: true
+ dev: true
/acorn/8.7.0:
resolution: {integrity: sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==}
engines: {node: '>=0.4.0'}
hasBin: true
+ dev: true
/acorn/8.7.1:
resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==}
@@ -6947,6 +6960,7 @@ packages:
/camelcase-css/2.0.1:
resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==}
engines: {node: '>= 6'}
+ dev: true
/camelcase-keys/2.1.0:
resolution: {integrity: sha512-bA/Z/DERHKqoEOrp+qeGKw1QlvEQkGZSc0XaY6VnTxZr+Kv1G5zFwttpjv8qxZ/sBPT4nthwZaAcsAZTJlSKXQ==}
@@ -7471,7 +7485,7 @@ packages:
lodash: ^4.17.20
marko: ^3.14.4
mote: ^0.2.0
- mustache: ^3.0.0
+ mustache: ^4.0.1
nunjucks: ^3.2.2
plates: ~0.4.11
pug: ^3.0.0
@@ -7640,7 +7654,7 @@ packages:
lodash: ^4.17.20
marko: ^3.14.4
mote: ^0.2.0
- mustache: ^3.0.0
+ mustache: ^4.0.1
nunjucks: ^3.2.2
plates: ~0.4.11
pug: ^3.0.0
@@ -8281,6 +8295,7 @@ packages:
/csstype/3.1.0:
resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
+ dev: false
/cuint/0.2.2:
resolution: {integrity: sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=}
@@ -8451,6 +8466,7 @@ packages:
/defined/1.0.0:
resolution: {integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=}
+ dev: true
/defu/2.0.4:
resolution: {integrity: sha512-G9pEH1UUMxShy6syWk01VQSRVs3CDWtlxtZu7A+NyqjxaCA4gSlWAKDBx6QiUEKezqS8+DUlXLI14Fp05Hmpwg==}
@@ -8549,6 +8565,7 @@ packages:
acorn-node: 1.8.2
defined: 1.0.0
minimist: 1.2.5
+ dev: true
/devalue/2.0.1:
resolution: {integrity: sha512-I2TiqT5iWBEyB8GRfTDP0hiLZ0YeDJZ+upDxjBfOC2lebO5LezQMv7QvIUTzdb64jQyAKLf1AHADtGN+jw6v8Q==}
@@ -8556,6 +8573,7 @@ packages:
/didyoumean/1.2.2:
resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==}
+ dev: true
/diff-sequences/26.6.2:
resolution: {integrity: sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q==}
@@ -8565,6 +8583,7 @@ packages:
/diff/4.0.2:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'}
+ dev: true
/diffie-hellman/5.0.3:
resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==}
@@ -8588,6 +8607,7 @@ packages:
/dlv/1.1.3:
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
+ dev: true
/doctrine/2.1.0:
resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==}
@@ -10048,6 +10068,7 @@ packages:
engines: {node: '>=10.13.0'}
dependencies:
is-glob: 4.0.3
+ dev: true
/glob-promise/[email protected]:
resolution: {integrity: sha512-q08RJ6O+eJn+dVanerAndJwIcumgbDdYiUT7zFQl3Wm1xD6fBKtah7H8ZJChj4wP+8C+QfeVy8xautR7rdmKEw==}
@@ -10607,6 +10628,7 @@ packages:
engines: {node: '>=8'}
dependencies:
import-from: 3.0.0
+ dev: true
/import-fresh/2.0.0:
resolution: {integrity: sha1-2BNVwVYS04bGH53dOSLUMEgipUY=}
@@ -10635,6 +10657,7 @@ packages:
engines: {node: '>=8'}
dependencies:
resolve-from: 5.0.0
+ dev: true
/import-local/3.0.3:
resolution: {integrity: sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==}
@@ -12093,6 +12116,7 @@ packages:
/lilconfig/2.0.4:
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
engines: {node: '>=10'}
+ dev: true
/lines-and-columns/1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
@@ -12366,6 +12390,7 @@ packages:
/make-error/1.3.6:
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
+ dev: true
/makeerror/1.0.12:
resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==}
@@ -13181,6 +13206,7 @@ packages:
/object-hash/2.2.0:
resolution: {integrity: sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==}
engines: {node: '>= 6'}
+ dev: true
/object-inspect/1.12.0:
resolution: {integrity: sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==}
@@ -13709,6 +13735,7 @@ packages:
typescript: 4.6.2
vue: 2.7.10
+ dev: false
/pinkie-promise/2.0.1:
resolution: {integrity: sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==}
@@ -14042,14 +14069,15 @@ packages:
postcss: 7.0.39
dev: false
- /postcss-js/[email protected]:
+ /postcss-js/[email protected]:
resolution: {integrity: sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==}
engines: {node: ^12 || ^14 || >= 16}
peerDependencies:
postcss: ^8.3.3 || 5.2.18
dependencies:
camelcase-css: 2.0.1
- postcss: 8.4.12
+ postcss: 8.4.16
+ dev: true
/postcss-lab-function/2.0.1:
resolution: {integrity: sha512-whLy1IeZKY+3fYdqQFuDBf8Auw+qFuVnChWjmxm/UhHWqNHZx+B99EwxTvGYmUBqe3Fjxs4L1BoZTJmPu6usVg==}
@@ -14081,6 +14109,7 @@ packages:
lilconfig: 2.0.4
ts-node: 10.7.0_cbygeln5s5sjlseyk3kbidkfny
yaml: 1.10.2
+ dev: true
/postcss-loader/3.0.0:
resolution: {integrity: sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==}
@@ -14264,14 +14293,15 @@ packages:
icss-utils: [email protected]
postcss: 8.4.12
- /postcss-nested/[email protected]:
+ /postcss-nested/[email protected]:
resolution: {integrity: sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==}
engines: {node: '>=12.0'}
peerDependencies:
postcss: ^8.2.14 || 5.2.18
dependencies:
- postcss: 8.4.12
+ postcss: 8.4.16
postcss-selector-parser: 6.0.9
+ dev: true
/postcss-nesting/7.0.1:
resolution: {integrity: sha512-FrorPb0H3nuVq0Sff7W2rnc3SmIcruVC6YwpcS+k687VxyxO33iE1amna7wHuRVzM8vfiYofXSBHNAZ3QhLvYg==}
@@ -15046,6 +15076,7 @@ packages:
/quick-lru/5.1.1:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
+ dev: true
/ramda/0.21.0:
resolution: {integrity: sha512-HGd5aczYKQXGILB+abY290V7Xz62eFajpa6AtMdwEmQSakJmgSO7ks4eI3HdR34j+X2Vz4Thp9VAJbrCAMbO2w==}
@@ -15472,6 +15503,7 @@ packages:
/resolve-from/5.0.0:
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
engines: {node: '>=8'}
+ dev: true
/resolve-path/1.4.0:
resolution: {integrity: sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=}
@@ -16563,22 +16595,29 @@ packages:
open: 7.4.2
portfinder: 1.0.28
replace-in-file: 6.3.2
- tailwindcss: 3.0.23_2len4mt2evkrddr6nmldbp7wpa
+ tailwindcss: 3.0.23_z4yclaatiobtrs75ftybxflkiu
transitivePeerDependencies:
- supports-color
dev: true
+ /tailwindcss-labeled-groups/[email protected]:
+ resolution: {integrity: sha512-leOVv9h2K9WDHoXPXVBOmTJgWECVkpVFc/hjrwuqGUEtNxvRvuOtCjenu9ppY+pJtky5INJUqDCNa8pS3AbYmw==}
+ peerDependencies:
+ tailwindcss: ^3.0.23
+ dependencies:
+ tailwindcss: 3.0.23_z4yclaatiobtrs75ftybxflkiu
+ dev: true
+
/tailwindcss-rtl/0.9.0:
resolution: {integrity: sha512-y7yC8QXjluDBEFMSX33tV6xMYrf0B3sa+tOB5JSQb6/G6laBU313a+Z+qxu55M1Qyn8tDMttjomsA8IsJD+k+w==}
dev: true
- /tailwindcss/3.0.23_2len4mt2evkrddr6nmldbp7wpa:
+ /tailwindcss/3.0.23_z4yclaatiobtrs75ftybxflkiu:
resolution: {integrity: sha512-+OZOV9ubyQ6oI2BXEhzw4HrqvgcARY38xv3zKcjnWtMIZstEsXdI9xftd1iB7+RbOnj2HOEzkA0OyB5BaSxPQA==}
engines: {node: '>=12.13.0'}
hasBin: true
peerDependencies:
autoprefixer: ^10.0.2
- postcss: ^8.0.9 || 5.2.18
dependencies:
arg: 5.0.1
autoprefixer: [email protected]
@@ -16594,16 +16633,17 @@ packages:
is-glob: 4.0.3
normalize-path: 3.0.0
object-hash: 2.2.0
- postcss: 8.4.12
- postcss-js: [email protected]
+ postcss: 8.4.16
+ postcss-js: [email protected]
postcss-load-config: [email protected]
- postcss-nested: [email protected]
+ postcss-nested: [email protected]
postcss-selector-parser: 6.0.9
postcss-value-parser: 4.2.0
quick-lru: 5.1.1
resolve: 1.22.0
transitivePeerDependencies:
- ts-node
+ dev: true
/talkback/3.0.1:
resolution: {integrity: sha512-2/mBW8vhcNw3JN5q8Pvq9QLdd3seks859EVabmRpSev2cyCPX4A7eU87jUnlBDOyXYdXPAflJ7cRkyTHmSKNGQ==}
@@ -16954,6 +16994,7 @@ packages:
typescript: 4.6.2
v8-compile-cache-lib: 3.0.0
yn: 3.1.1
+ dev: true
resolution: {integrity: sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==}
@@ -17066,6 +17107,7 @@ packages:
resolution: {integrity: sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==}
engines: {node: '>=4.2.0'}
hasBin: true
+ dev: true
/ua-parser-js/0.7.31:
resolution: {integrity: sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==}
@@ -17357,6 +17399,7 @@ packages:
/v8-compile-cache-lib/3.0.0:
resolution: {integrity: sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==}
+ dev: true
/v8-compile-cache/2.3.0:
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
@@ -17517,12 +17560,8 @@ packages:
js-yaml: 4.1.0
dev: true
- /vue-i18n/[email protected]:
+ /vue-i18n/8.26.7:
resolution: {integrity: sha512-7apa5PvRg1YCLoraE3lOgpCG8hJGupLCtywQWedWsgBbvF0TOgFvhitqK9xRH0PBGG1G8aiJz9oklyNDFfDxLg==}
- peerDependencies:
- vue: ^2
- dependencies:
- vue: 2.7.10
dev: false
/vue-inbrowser-compiler-utils/[email protected]:
@@ -17730,12 +17769,8 @@ packages:
resolution: {integrity: sha512-ZMjqRpWabMPqPc7gIrG0Nw6vRf1+itwf0Itft7LbMXs2g3Zs/NFmevjZGN1x7K3Q95GmIjWbQZTVerxiBxI+0g==}
dev: false
- /vue-router/[email protected]:
+ /vue-router/3.5.3:
resolution: {integrity: sha512-FUlILrW3DGitS2h+Xaw8aRNvGTwtuaxrRkNSHWTizOfLUie7wuYwezeZ50iflRn8YPV5kxmU2LQuu3nM/b3Zsg==}
- peerDependencies:
- vue: ^2
- dependencies:
- vue: 2.7.10
dev: false
/vue-server-renderer/2.7.10:
@@ -17791,6 +17826,7 @@ packages:
dependencies:
'@vue/compiler-sfc': 2.7.10
csstype: 3.1.0
+ dev: false
resolution: {integrity: sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==}
@@ -18292,6 +18328,7 @@ packages:
/yn/3.1.1:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'}
+ dev: true
/yocto-queue/0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
diff --git a/src/components/VAllResultsGrid/VAllResultsGrid.vue b/src/components/VAllResultsGrid/VAllResultsGrid.vue
index 9213f25d5..beb13b413 100644
--- a/src/components/VAllResultsGrid/VAllResultsGrid.vue
+++ b/src/components/VAllResultsGrid/VAllResultsGrid.vue
@@ -14,6 +14,13 @@
@shift-tab="handleShiftTab($event, i)"
/>
</div>
+ <VSnackbar size="large" :is-visible="isSnackbarVisible">
+ <i18n path="all-results.snackbar.text" tag="p">
+ <template #spacebar>
+ <kbd class="font-sans">{{ $t(`all-results.snackbar.spacebar`) }}</kbd>
+ </template>
+ </i18n>
+ </VSnackbar>
<VGridSkeleton
v-if="resultsLoading && allMedia.length === 0"
is-for-tab="all"
@@ -32,6 +39,8 @@
v-if="item.frontendMediaType === 'audio'"
:key="item.id"
:audio="item"
+ @interacted="hideSnackbar"
+ @focus.native="showSnackbar"
/>
</div>
</div>
@@ -49,6 +58,9 @@ import { Focus } from '~/utils/focus-management'
import { useI18n } from '~/composables/use-i18n'
+import { useUiStore } from '~/stores/ui'
+
+import VSnackbar from '~/components/VSnackbar.vue'
import VImageCellSquare from '~/components/VAllResultsGrid/VImageCellSquare.vue'
import VAudioCell from '~/components/VAllResultsGrid/VAudioCell.vue'
import VLoadMore from '~/components/VLoadMore.vue'
@@ -58,6 +70,7 @@ import VGridSkeleton from '~/components/VSkeleton/VGridSkeleton.vue'
export default defineComponent({
name: 'VAllResultsGrid',
components: {
+ VSnackbar,
VImageCellSquare,
VAudioCell,
VLoadMore,
@@ -103,6 +116,15 @@ export default defineComponent({
}
}
+ const uiStore = useUiStore()
+ const isSnackbarVisible = computed(() => uiStore.areInstructionsVisible)
+ const showSnackbar = () => {
+ uiStore.showInstructionsSnackbar()
+ }
+ const hideSnackbar = () => {
+ uiStore.hideInstructionsSnackbar()
+ }
+
return {
isError,
errorHeader,
@@ -112,6 +134,10 @@ export default defineComponent({
resultCounts,
noResults,
handleShiftTab,
+
+ isSnackbarVisible,
+ showSnackbar,
+ hideSnackbar,
}
},
})
diff --git a/src/components/VAllResultsGrid/VAudioCell.vue b/src/components/VAllResultsGrid/VAudioCell.vue
index 1e863c4d1..51d0e53c1 100644
--- a/src/components/VAllResultsGrid/VAudioCell.vue
+++ b/src/components/VAllResultsGrid/VAudioCell.vue
@@ -1,5 +1,5 @@
<template>
- <VAudioTrack :audio="audio" layout="box" />
+ <VAudioTrack :audio="audio" layout="box" v-on="$listeners" />
</template>
<script lang="ts">
diff --git a/src/components/VAudioDetails/VRelatedAudio.vue b/src/components/VAudioDetails/VRelatedAudio.vue
index a93a53f98..64ea386c6 100644
--- a/src/components/VAudioDetails/VRelatedAudio.vue
+++ b/src/components/VAudioDetails/VRelatedAudio.vue
@@ -3,9 +3,10 @@
<h2 class="mb-6 text-2xl lg:text-3xl">
{{ $t('audio-details.related-audios') }}
</h2>
+ <!-- Negative margin compensates for the `p-4` padding in row layout. -->
<div
v-if="!fetchState.fetchingError"
- class="mb-12 flex flex-col gap-8 lg:gap-12"
+ class="-mx-4 mb-12 flex flex-col gap-4"
>
<VAudioTrack
v-for="audio in media"
diff --git a/src/components/VAudioTrack/VAudioTrack.vue b/src/components/VAudioTrack/VAudioTrack.vue
index 022ec23d8..63ab641da 100644
--- a/src/components/VAudioTrack/VAudioTrack.vue
+++ b/src/components/VAudioTrack/VAudioTrack.vue
@@ -1,12 +1,14 @@
<template>
+ <!-- eslint-disable vue/use-v-on-exact -->
<Component
- :is="isBoxed ? 'VLink' : 'VWarningSuppressor'"
- class="audio-track group"
+ :is="isComposite ? 'VLink' : 'VWarningSuppressor'"
+ v-bind="containerAttributes"
+ class="audio-track group block overflow-hidden rounded-sm ring-pink hover:no-underline focus:border-tx focus:bg-white focus:outline-none"
:aria-label="ariaLabel"
- role="region"
- v-bind="layoutBasedProps"
+ :role="isComposite ? 'application' : undefined"
@keydown.native.shift.tab.exact="$emit('shift-tab', $event)"
- @keydown.native.space="handleSpace"
+ @keydown.native="handleKeydown"
+ @blur.native="handleBlur"
>
<Component
:is="layoutComponent"
@@ -18,6 +20,7 @@
<template #controller="waveformProps">
<VWaveform
v-bind="waveformProps"
+ :is-parent-seeking="isSeeking"
:peaks="audio.peaks"
:audio-id="audio.id"
:current-time="currentTime"
@@ -68,6 +71,9 @@ import {
activeAudioStatus,
layoutMappings,
} from '~/constants/audio'
+import { useSeekable } from '~/composables/use-seekable'
+
+import { defineEvent } from '~/types/emits'
import VPlayPause from '~/components/VAudioTrack/VPlayPause.vue'
import VWaveform from '~/components/VAudioTrack/VWaveform.vue'
@@ -120,7 +126,13 @@ export default defineComponent({
type: String as PropType<AudioSize>,
},
},
- setup(props) {
+ emits: {
+ 'shift-tab': defineEvent<[KeyboardEvent]>(),
+ interacted: defineEvent<[]>(),
+ },
+ setup(props, { emit }) {
+ const i18n = useI18n()
+
const activeMediaStore = useActiveMediaStore()
const route = useRoute()
@@ -360,6 +372,7 @@ export default defineComponent({
pause()
break
}
+ emit('interacted')
}
/* Interface with VWaveform */
@@ -376,6 +389,7 @@ export default defineComponent({
if (localAudio) {
localAudio.currentTime = frac * duration.value
}
+ emit('interacted')
}
/* Layout */
@@ -385,7 +399,7 @@ export default defineComponent({
* Sets default size if not provided.
*/
const layoutSize = computed(() => {
- if (isBoxed.value && !props.size) {
+ if (props.layout === 'box' && !props.size) {
return undefined
}
return props.size ?? 'm'
@@ -401,43 +415,68 @@ export default defineComponent({
/**
* These layout-conditional props and listeners allow us
* to set properties on the parent element depending on
- * the layout in use. This is currently relevant for the
- * boxed layout exclusively.
+ * the layout in use.
*/
- const isBoxed = computed(() => props.layout === 'box')
- const i18n = useI18n()
- const layoutBasedProps = computed(() => {
- if (!isBoxed.value) return {}
- return {
- href: `/audio/${props.audio.id}`,
- class:
- 'block focus:bg-white focus:border-tx focus:ring-[3px] focus:ring-pink focus:ring-offset-[3px] focus:outline-none rounded-sm overflow-hidden cursor-pointer',
- }
- })
+ const isComposite = computed(() => ['box', 'row'].includes(props.layout))
+ const layoutBasedProps = computed(() =>
+ isComposite.value
+ ? {
+ href: `/audio/${props.audio.id}`,
+ class: [
+ 'cursor-pointer',
+ {
+ 'focus:ring-offset-[3px] focus:ring-[3px]':
+ props.layout === 'box',
+ 'focus:ring-offset-0 focus:ring-[1.5px]':
+ props.layout === 'row',
+ },
+ ],
+ }
+ : {}
+ )
const ariaLabel = computed(() =>
- isBoxed.value
+ isComposite.value
? i18n.t('audio-track.aria-label-interactive', {
title: props.audio.title,
})
: i18n.t('audio-track.aria-label', { title: props.audio.title })
)
- const handleSpace = (event: KeyboardEvent) => {
- if (!isBoxed.value) return
- event.preventDefault()
+ const togglePlayback = () => {
status.value = activeAudioStatus.includes(status.value)
? 'paused'
: 'playing'
handleToggle(status.value)
}
+ const { isSeeking, ...seekable } = useSeekable({
+ duration,
+ currentTime,
+ isReady: ref(true),
+ onSeek: handleSeeked,
+ onTogglePlayback: togglePlayback,
+ })
+ const handleKeydown = (event: KeyboardEvent) => {
+ if (seekable.willBeHandled(event)) emit('interacted')
+ seekable.listeners.keydown(event)
+ }
+
+ const containerAttributes = computed(() => ({
+ // ARIA slider attributes are only added when interactive
+ ...(isComposite.value ? seekable.attributes.value : {}),
+ ...layoutBasedProps.value,
+ }))
+
return {
status,
message,
ariaLabel,
handleToggle,
handleSeeked,
- handleSpace,
+ handleKeydown,
+ handleBlur: seekable.listeners.blur,
+
+ isSeeking,
currentTime,
duration,
@@ -445,8 +484,8 @@ export default defineComponent({
layoutComponent,
layoutSize,
- isBoxed,
- layoutBasedProps,
+ isComposite,
+ containerAttributes,
playPauseRef,
}
diff --git a/src/components/VAudioTrack/VPlayPause.vue b/src/components/VAudioTrack/VPlayPause.vue
index a75fa0e11..282e32d0b 100644
--- a/src/components/VAudioTrack/VPlayPause.vue
+++ b/src/components/VAudioTrack/VPlayPause.vue
@@ -1,12 +1,13 @@
<template>
<VIconButton
v-bind="$attrs"
- :tabindex="layout === 'box' ? -1 : 0"
+ :tabindex="isTabbable ? 0 : -1"
class="play-pause flex-shrink-0 border-dark-charcoal bg-dark-charcoal text-white focus-visible:border-pink focus-visible:shadow-ring focus-visible:outline-none disabled:opacity-70"
:icon-props="icon === undefined ? undefined : { iconPath: icon }"
:aria-label="$t(label)"
:button-props="buttonProps"
@click.stop.prevent="handleClick"
+ @mousedown="handleMouseDown"
>
<template #default="{ iconSizeClasses }">
<svg
@@ -82,6 +83,13 @@ export default defineComponent({
type: String as PropType<AudioLayout>,
default: 'full',
},
+ /**
+ * whether the play-pause button can be focused by using the `Tab` key
+ */
+ isTabbable: {
+ type: Boolean,
+ default: true,
+ },
},
emits: {
toggle: defineEvent<['paused' | 'playing']>(),
@@ -108,6 +116,9 @@ export default defineComponent({
return { variant, connections: layoutConnectionsMap[props.layout] }
})
+ const handleMouseDown = (event: MouseEvent) => {
+ if (!props.isTabbable) event.preventDefault() // to prevent focus
+ }
const handleClick = () => {
emit('toggle', isPlaying.value || isLoading.value ? 'paused' : 'playing')
}
@@ -118,6 +129,7 @@ export default defineComponent({
isLoading,
handleClick,
+ handleMouseDown,
}
},
})
diff --git a/src/components/VAudioTrack/VWaveform.vue b/src/components/VAudioTrack/VWaveform.vue
index 9e068af55..d535b001d 100644
--- a/src/components/VAudioTrack/VWaveform.vue
+++ b/src/components/VAudioTrack/VWaveform.vue
@@ -1,23 +1,18 @@
<template>
<div
+ v-bind="waveformAttributes"
ref="el"
- class="waveform bg-background-var group relative overflow-hidden focus:outline-none"
+ class="waveform bg-background-var group-waveform relative overflow-hidden text-dark-charcoal focus:outline-none"
:style="heightProperties"
- :tabIndex="isInteractive ? 0 : -1"
- :role="isInteractive ? 'slider' : undefined"
+ :tabIndex="isTabbable && isInteractive ? 0 : -1"
:aria-disabled="!isInteractive"
:aria-label="$t('waveform.label').toString()"
- aria-orientation="horizontal"
- aria-valuemin="0"
- :aria-valuemax="duration"
- :aria-valuenow="currentTime"
- :aria-valuetext="currentTimeText"
v-on="eventHandlers"
>
<!-- Focus ring -->
<svg
v-if="isInteractive"
- class="shadow-ring-1 absolute inset-0 z-20 hidden h-full w-full group-focus:block"
+ class="shadow-ring-1 absolute inset-0 z-20 hidden h-full w-full group-waveform-focus:block"
xmlns="http://www.w3.org/2000/svg"
:viewBox="viewBox"
preserveAspectRatio="none"
@@ -89,8 +84,8 @@
<!-- Focus bar -->
<div
- v-if="isInteractive"
- class="focus-indicator absolute top-0 z-20 flex hidden h-full flex-col items-center justify-between bg-black"
+ v-if="isInteractive && isSeeking"
+ class="absolute top-0 z-20 hidden h-full flex-col items-center justify-between bg-black group-focus:flex group-waveform-focus:flex"
:style="{ width: `${barWidth}px`, left: `${progressBarWidth}px` }"
>
<div
@@ -157,10 +152,12 @@ import {
onMounted,
PropType,
ref,
+ toRef,
} from '@nuxtjs/composition-api'
import { downsampleArray, upsampleArray } from '~/utils/resampling'
-import { keycodes } from '~/constants/key-codes'
+import { timeFmt } from '~/utils/time-fmt'
+import { useSeekable } from '~/composables/use-seekable'
import type { AudioFeature } from '~/constants/audio'
@@ -244,6 +241,21 @@ export default defineComponent({
type: String,
required: true,
},
+ /**
+ * whether the waveform can be focused by using the `Tab` key
+ */
+ isTabbable: {
+ type: Boolean,
+ default: true,
+ },
+ /**
+ * whether the waveform should render as seeking when it is controlled by
+ * the parent audio track
+ */
+ isParentSeeking: {
+ type: Boolean,
+ default: false,
+ },
},
emits: {
/**
@@ -260,24 +272,6 @@ export default defineComponent({
setup(props, { emit }) {
/* Utils */
- /**
- * Format the time as hh:mm:ss:ms.
- * We drop the hour part if it is zero, and the ms part if the audio
- * is longer than MAX_SECONDS_FOR_MS seconds.
- *
- * @param seconds - the number of seconds in the duration
- * @returns the duration in a human-friendly format
- */
- const timeFmt = (seconds: number): string => {
- const date = new Date(0)
- const timeInSeconds = Number.isFinite(seconds) ? seconds : 0
- date.setSeconds(0, timeInSeconds * 1000)
-
- return date
- .toISOString()
- .substr(11, showMsInTimestamp.value ? 12 : 8)
- .replace(/^00:/, '')
- }
/**
* Get the x-coordinate of the event with respect to the bounding box of the
* waveform.
@@ -342,6 +336,9 @@ export default defineComponent({
const isReady = computed(() => !props.message)
const isInteractive = computed(() => isSeekable.value && isReady.value)
+ const isSeeking = computed(
+ () => (!props.isTabbable && props.isParentSeeking) || isSelfSeeking.value
+ )
/* Resampling */
@@ -384,10 +381,6 @@ export default defineComponent({
waveformDimens.value.height - normalizedPeaks.value[index]
/* Progress bar */
-
- const currentFrac = computed(() =>
- isReady.value ? props.currentTime / props.duration : 0
- )
const progressBarWidth = computed(() => {
const frac = isDragging.value ? seekFrac.value ?? 0 : currentFrac.value
return waveformDimens.value.width * frac
@@ -437,19 +430,27 @@ export default defineComponent({
return barWidth < timestampWidth + 2
})
+ const { isSeeking: isSelfSeeking, ...seekable } = useSeekable({
+ duration: toRef(props, 'duration'),
+ currentTime: toRef(props, 'currentTime'),
+ isReady,
+ onSeek: (frac) => {
+ clearSeekProgress()
+ emit('seeked', frac)
+ },
+ onTogglePlayback: () => emit('toggle-playback'),
+ })
+ const waveformAttributes = computed(() => ({
+ // ARIA slider attributes are only added when interactive
+ ...(isInteractive.value ? seekable.attributes.value : {}),
+ }))
+
/* Seeking */
- const seekDelta = 1 // s
- const modSeekDelta = 15 // s
/**
* the seek jump length as a % of the track
*/
- const seekDeltaFrac = computed(() => {
- return isReady.value ? seekDelta / props.duration : 0
- })
- const modSeekDeltaFrac = computed(() =>
- isReady.value ? modSeekDelta / props.duration : 0
- )
+ const { currentFrac } = seekable.meta
const setSeekProgress = (event: MouseEvent) => {
seekFrac.value = getPositionFrac(event)
}
@@ -466,6 +467,7 @@ export default defineComponent({
let startPos: null | number = null
const isDragging = ref(false)
const handleMouseDown = (event: MouseEvent) => {
+ if (!props.isTabbable) event.preventDefault() // to prevent focus
isDragging.value = false
startPos = getPosition(event)
setSeekProgress(event)
@@ -487,63 +489,10 @@ export default defineComponent({
const handleMouseLeave = () => {
clearSeekProgress()
}
-
- /* Keyboard */
-
- const handlePosKeys = (frac: number) => {
- clearSeekProgress()
- emit('seeked', frac)
- }
- const handleArrowKeys = (event: KeyboardEvent) => {
- const { key, shiftKey, metaKey } = event
- if (metaKey) {
- // Always false on Windows
- handlePosKeys(key.includes('Left') ? 0 : 1)
- } else {
- clearSeekProgress()
- const direction = key.includes('Left') ? -1 : 1
- const magnitude = shiftKey
- ? modSeekDeltaFrac.value
- : seekDeltaFrac.value
- const delta = magnitude * direction
- emit('seeked', currentFrac.value + delta)
- }
- }
-
- const handleSpacebar = () => {
- emit('toggle-playback')
- }
-
- /**
- * @param event
- */
- const willBeHandled = (event: KeyboardEvent) =>
- (
- [
- keycodes.ArrowLeft,
- keycodes.ArrowRight,
- keycodes.Home,
- keycodes.End,
- keycodes.Spacebar,
- ] as string[]
- ).includes(event.key)
-
- /**
- * @param event
- */
- const handleKeys = (event: KeyboardEvent) => {
- if (!willBeHandled(event)) return
-
+ const handleClick = (event: MouseEvent) => {
+ // Prevent event from bubbling to the parent anchor tag.
+ event.stopPropagation()
event.preventDefault()
- if (
- ([keycodes.ArrowLeft, keycodes.ArrowRight] as string[]).includes(
- event.key
- )
- )
- return handleArrowKeys(event)
- if (event.key === keycodes.Home) return handlePosKeys(0)
- if (event.key === keycodes.End) return handlePosKeys(1)
- if (event.key === keycodes.Spacebar) return handleSpacebar()
}
/* v-on */
@@ -555,7 +504,8 @@ export default defineComponent({
mousemove: handleMouseMove,
mouseup: handleMouseUp,
mouseleave: handleMouseLeave,
- keydown: handleKeys,
+ click: handleClick,
+ ...seekable.listeners,
}
} else {
return {}
@@ -586,6 +536,7 @@ export default defineComponent({
isReady,
isInteractive,
+ isSeeking,
barWidth,
normalizedPeaks,
@@ -608,14 +559,7 @@ export default defineComponent({
seekTimestamp,
seekTimestampEl,
isSeekTimestampCutoff,
-
- handleMouseDown,
- handleMouseMove,
- handleMouseUp,
- handleMouseLeave,
-
- handlePosKeys,
- handleArrowKeys,
+ waveformAttributes,
eventHandlers,
@@ -624,16 +568,6 @@ export default defineComponent({
seekTimeLeft,
}
},
- computed: {
- /**
- * the waveform current time as a text string; This function was placed
- * outside because `this` is not accessible inside the `setup`.
- */
- currentTimeText(): string {
- const time = this.timeFmt(this.currentTime)
- return this.$t('waveform.current-time', { time }).toString()
- },
- },
})
</script>
@@ -670,10 +604,6 @@ export default defineComponent({
left: var(--seek-time-left);
}
-.waveform:focus-visible .focus-indicator {
- display: flex;
-}
-
.fill-dark-charcoal-20-alpha {
fill: rgba(48, 39, 46, 0.2);
}
diff --git a/src/components/VAudioTrack/layouts/VBoxLayout.vue b/src/components/VAudioTrack/layouts/VBoxLayout.vue
index 54f95a031..ce9bd7264 100644
--- a/src/components/VAudioTrack/layouts/VBoxLayout.vue
+++ b/src/components/VAudioTrack/layouts/VBoxLayout.vue
@@ -24,8 +24,13 @@
</div>
<div class="player hidden flex-row md:flex">
- <slot name="play-pause" size="small" layout="box" />
- <slot name="controller" :features="[]" />
+ <slot
+ name="play-pause"
+ size="small"
+ layout="box"
+ :is-tabbable="false"
+ />
+ <slot name="controller" :features="[]" :is-tabbable="false" />
</div>
</div>
</div>
diff --git a/src/components/VAudioTrack/layouts/VFullLayout.vue b/src/components/VAudioTrack/layouts/VFullLayout.vue
index 32f030459..ce6619407 100644
--- a/src/components/VAudioTrack/layouts/VFullLayout.vue
+++ b/src/components/VAudioTrack/layouts/VFullLayout.vue
@@ -46,7 +46,7 @@
$t('interpunct')
}}</span>
- <div>{{ timeFmt(audio.duration || 0) }}</div>
+ <div>{{ timeFmt(audio.duration || 0, true) }}</div>
</div>
</div>
@@ -72,6 +72,7 @@
import { computed, defineComponent, PropType } from '@nuxtjs/composition-api'
import type { AudioDetail } from '~/models/media'
+import { timeFmt } from '~/utils/time-fmt'
import { AudioSize, AudioStatus, audioFeatures } from '~/constants/audio'
import VButton from '~/components/VButton.vue'
@@ -100,20 +101,6 @@ export default defineComponent({
},
},
setup(props) {
- /**
- * Format the time as hh:mm:ss, dropping the hour part if it is zero.
- * @param ms - the number of milliseconds in the duration
- * @returns the duration in a human-friendly format
- */
- const timeFmt = (ms: number): string => {
- if (ms) {
- const date = new Date(0)
- date.setSeconds(ms / 1e3)
- return date.toISOString().substr(11, 8).replace(/^00:/, '')
- }
- return '--:--'
- }
-
const isSmall = computed(() => props.size === 's')
return {
diff --git a/src/components/VAudioTrack/layouts/VRowLayout.vue b/src/components/VAudioTrack/layouts/VRowLayout.vue
index 20d52b5ea..bce408454 100644
--- a/src/components/VAudioTrack/layouts/VRowLayout.vue
+++ b/src/components/VAudioTrack/layouts/VRowLayout.vue
@@ -1,6 +1,7 @@
<template>
+ <!-- `pages/search/audio` has negative margin `-mx-4` to compensate for this padding. -->
<article
- class="row-track flex flex-row"
+ class="row-track flex flex-row p-2 hover:bg-dark-charcoal-06 md:p-4"
:class="[`size-${size}`, { 'items-start': isSmall }]"
>
<div
@@ -9,7 +10,7 @@
>
<VAudioThumbnail :audio="audio" />
<div v-show="isSmall" class="absolute bottom-0 ltr:right-0 rtl:left-0">
- <slot name="play-pause" size="tiny" layout="row" />
+ <slot name="play-pause" size="tiny" layout="row" :is-tabbable="false" />
</div>
</div>
@@ -21,15 +22,15 @@
}"
>
<div class="flex-shrink-0" :class="{ 'w-70': isMedium }">
- <VLink
- :href="`/audio/${audio.id}`"
- class="block rounded-sm p-px font-heading font-semibold text-dark-charcoal line-clamp-2 hover:text-dark-charcoal focus:outline-none focus:ring focus:ring-pink md:line-clamp-1"
+ <div
+ class="decoration-inherit block rounded-sm p-px font-heading font-semibold text-dark-charcoal line-clamp-2 hover:text-dark-charcoal focus:outline-none focus:ring focus:ring-pink group-hover:underline md:line-clamp-1"
:class="{
'text-2xl': isMedium || isLarge,
'leading-snug': isSmall,
}"
- >{{ audio.title }}</VLink
>
+ {{ audio.title }}
+ </div>
<div
class="mt-2 flex text-dark-charcoal-70"
@@ -50,7 +51,7 @@
<span v-show="isSmall">
<span
class="inline-block rounded-sm bg-dark-charcoal-06 p-1 font-semibold text-dark-charcoal"
- >{{ timeFmt(audio.duration || 0) }}</span
+ >{{ timeFmt(audio.duration || 0, true) }}</span
><span class="mx-2">{{ $t('interpunct') }}</span>
</span>
@@ -75,11 +76,13 @@
name="play-pause"
:size="isLarge ? 'medium' : 'large'"
:layout="'row'"
+ :is-tabbable="false"
/>
<slot
name="controller"
:features="features"
:feature-notices="featureNotices"
+ :is-tabbable="false"
/>
</div>
</div>
@@ -89,19 +92,18 @@
<script lang="ts">
import { computed, defineComponent, PropType } from '@nuxtjs/composition-api'
+import { timeFmt } from '~/utils/time-fmt'
import type { AudioDetail } from '~/models/media'
import type { AudioSize } from '~/constants/audio'
import VAudioThumbnail from '~/components/VAudioThumbnail/VAudioThumbnail.vue'
import VLicense from '~/components/VLicense/VLicense.vue'
-import VLink from '~/components/VLink.vue'
export default defineComponent({
name: 'VRowLayout',
components: {
VAudioThumbnail,
VLicense,
- VLink,
},
props: {
audio: {
@@ -121,20 +123,6 @@ export default defineComponent({
} = {}
const features = ['timestamps', 'duration', 'seek']
- /**
- * Format the time as hh:mm:ss, dropping the hour part if it is zero.
- * @param ms - the number of milliseconds in the duration
- * @returns the duration in a human-friendly format
- */
- const timeFmt = (ms: number): string => {
- if (ms) {
- const date = new Date(0)
- date.setSeconds(ms / 1e3)
- return date.toISOString().substr(11, 8).replace(/^00:/, '')
- }
- return '--:--'
- }
-
const isSmall = computed(() => props.size === 's')
const isMedium = computed(() => props.size === 'm')
const isLarge = computed(() => props.size === 'l')
@@ -160,7 +148,7 @@ export default defineComponent({
.row-track .waveform {
@apply flex-grow;
- --waveform-background-color: theme('colors.white');
+ --waveform-background-color: theme('colors.tx');
}
.row-track .waveform {
diff --git a/src/components/VContentSwitcher/VSearchTypeButton.vue b/src/components/VContentSwitcher/VSearchTypeButton.vue
index 15591f191..27eaecd15 100644
--- a/src/components/VContentSwitcher/VSearchTypeButton.vue
+++ b/src/components/VContentSwitcher/VSearchTypeButton.vue
@@ -14,7 +14,7 @@
<VIcon :icon-path="icon" />
<span
class="md:block md:truncate md:ms-2 md:text-start"
- :class="isHeaderScrolled ? 'hidden' : 'ms-2 block truncate text-start'"
+ :class="isHeaderScrolled ? 'hidden' : 'block truncate ms-2 text-start'"
>{{ buttonLabel }}</span
>
<VIcon
diff --git a/src/components/VMetaSearch/VMetaSearchForm.vue b/src/components/VMetaSearch/VMetaSearchForm.vue
index 24ab81264..59b24f420 100644
--- a/src/components/VMetaSearch/VMetaSearchForm.vue
+++ b/src/components/VMetaSearch/VMetaSearchForm.vue
@@ -34,7 +34,7 @@
</i18n>
<VMetaSourceList
- class="ms-2 inline-flex md:justify-center"
+ class="inline-flex ms-2 md:justify-center"
:type="type"
:query="query"
/>
diff --git a/src/components/VSkipToContentContainer.vue b/src/components/VSkipToContentContainer.vue
index a7b9600d0..2d59c44ac 100644
--- a/src/components/VSkipToContentContainer.vue
+++ b/src/components/VSkipToContentContainer.vue
@@ -3,7 +3,7 @@
<slot />
<VTeleport to="skip-to-content">
<VButton
- class="ms-2 z-50 mt-2 focus:fixed focus:absolute"
+ class="z-50 mt-2 ms-2 focus:fixed focus:absolute"
:class="$style.skipButton"
@click="skipToContent"
>{{ $t('skip-to-content') }}</VButton
diff --git a/src/components/VSnackbar.vue b/src/components/VSnackbar.vue
index 86a0d21df..cd82b3a71 100644
--- a/src/components/VSnackbar.vue
+++ b/src/components/VSnackbar.vue
@@ -1,5 +1,14 @@
<template>
- <div role="alert" :class="[$style.snackbar, $style[size]]">
+ <div
+ role="alert"
+ :class="[
+ $style.snackbar,
+ $style[size],
+ isVisible
+ ? 'translate-y-0 opacity-100'
+ : 'translate-y-[4rem] opacity-0 motion-reduce:translate-y-0',
+ ]"
+ >
<!-- @slot Your message or subcomponent goes passed here. -->
<slot />
</div>
@@ -15,6 +24,13 @@ export default defineComponent({
type: String as PropType<'small' | 'large'>,
default: 'small',
},
+ /**
+ * whether the snackbar is visible or hidden
+ */
+ isVisible: {
+ type: Boolean,
+ default: true,
+ },
},
})
</script>
@@ -22,11 +38,11 @@ export default defineComponent({
<style module>
.snackbar {
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.3);
- @apply fixed bottom-4 rounded-sm bg-black text-white ltr:left-4 rtl:right-4;
+ @apply fixed bottom-4 z-10 rounded-sm bg-black text-white transition-[opacity,transform] duration-500 ltr:left-4 rtl:right-4 motion-reduce:transition-opacity;
}
.large {
- @apply w-max max-w-full flex-row items-center py-4 px-8 text-sm;
+ @apply w-max max-w-full flex-row items-center py-4 px-6 text-sm;
}
.small {
diff --git a/src/components/meta/VSnackbar.stories.mdx b/src/components/meta/VSnackbar.stories.mdx
index 697ab0508..ebc4aed4d 100644
--- a/src/components/meta/VSnackbar.stories.mdx
+++ b/src/components/meta/VSnackbar.stories.mdx
@@ -5,6 +5,7 @@ import {
Meta,
Story,
} from '@storybook/addon-docs'
+import { ref } from '@nuxtjs/composition-api'
import VSnackbar from '~/components/VSnackbar.vue'
@@ -22,12 +23,17 @@ import VSnackbar from '~/components/VSnackbar.vue'
export const Template = (args) => ({
components: { VSnackbar },
template: `
- <VSnackbar v-bind="args">
- <template v-slot>${args.defaultSlot}</template>
- </Vsnackbar>
+ <div>
+ <input type="checkbox" id="show" v-model="isVisible">
+ <label for="show">Show snackbar</label>
+ <VSnackbar v-bind="args" :is-visible="isVisible">
+ <template v-slot>${args.defaultSlot}</template>
+ </Vsnackbar>
+ </div>
`,
setup() {
- return { args }
+ const isVisible = ref(true)
+ return { args, isVisible }
},
})
@@ -37,10 +43,13 @@ export const Template = (args) => ({
<ArgsTable of={VSnackbar} />
+<!-- Use inline={false} to keep the snackbar within the preview area. -->
+
<Canvas>
<Story
name="Default"
args={{ defaultSlot: 'Your message goes here.', size: 'small' }}
+ inline={false}
>
{Template.bind({})}
</Story>
diff --git a/src/composables/use-seekable.ts b/src/composables/use-seekable.ts
new file mode 100644
index 000000000..4e5888f65
--- /dev/null
+++ b/src/composables/use-seekable.ts
@@ -0,0 +1,101 @@
+import { computed, ToRefs, ref } from '@nuxtjs/composition-api'
+
+import { useI18n } from '~/composables/use-i18n'
+import { keycodes } from '~/constants/key-codes'
+
+export interface UseSeekableOptions
+ extends ToRefs<{
+ duration: number
+ currentTime: number
+ isReady: boolean
+ }> {
+ onSeek: (frac: number) => void
+ onTogglePlayback: () => void
+}
+
+export const useSeekable = ({
+ duration,
+ currentTime,
+ isReady,
+ onSeek,
+ onTogglePlayback,
+}: UseSeekableOptions) => {
+ const i18n = useI18n()
+
+ const attributes = computed(() => ({
+ 'aria-role': 'slider',
+ 'aria-valuemax': duration.value,
+ 'aria-valuenow': currentTime.value,
+ 'aria-valuetext': i18n
+ .tc('waveform.current-time', currentTime.value, {
+ time: currentTime.value,
+ })
+ .toString(),
+ 'aria-orientation': 'horizontal' as const,
+ 'aria-valuemin': '0',
+ }))
+
+ const seekDelta = 1 // seconds
+ const modSeekDelta = 15 // seconds
+ const modSeekDeltaFrac = computed(() =>
+ isReady.value ? modSeekDelta / duration.value : 0
+ )
+ const seekDeltaFrac = computed(() =>
+ isReady.value ? seekDelta / duration.value : 0
+ )
+ const currentFrac = computed(() =>
+ isReady.value ? currentTime.value / duration.value : 0
+ )
+ const isSeeking = ref(false)
+
+ const handleArrowKeys = (event: KeyboardEvent) => {
+ const { key, shiftKey, metaKey } = event
+ if (metaKey) {
+ // Always false on Windows
+ onSeek(key.includes('Left') ? 0 : 1)
+ } else {
+ const direction = key.includes('Left') ? -1 : 1
+ const magnitude = shiftKey ? modSeekDeltaFrac.value : seekDeltaFrac.value
+ const delta = magnitude * direction
+ onSeek(currentFrac.value + delta)
+ }
+ }
+
+ const arrowKeys = [keycodes.ArrowLeft, keycodes.ArrowRight]
+ const seekingKeys = [...arrowKeys, keycodes.Home, keycodes.End]
+ const handledKeys = [...seekingKeys, keycodes.Spacebar]
+ const willBeHandled = (event: KeyboardEvent) =>
+ (handledKeys as string[]).includes(event.key)
+
+ const handleKeys = (event: KeyboardEvent) => {
+ if (!willBeHandled(event)) return
+
+ event.preventDefault()
+
+ isSeeking.value = (seekingKeys as string[]).includes(event.key)
+
+ if ((arrowKeys as string[]).includes(event.key))
+ return handleArrowKeys(event)
+ if (event.key === keycodes.Home) return onSeek(0)
+ if (event.key === keycodes.End) return onSeek(1)
+ if (event.key === keycodes.Spacebar) {
+ return onTogglePlayback()
+ }
+ }
+ const handleBlur = () => {
+ isSeeking.value = false
+ }
+
+ const listeners = {
+ keydown: handleKeys,
+ blur: handleBlur,
+ }
+
+ const meta = {
+ modSeekDeltaFrac,
+ seekDeltaFrac,
+ currentFrac,
+ }
+
+ return { attributes, listeners, meta, willBeHandled, isSeeking }
+}
diff --git a/src/locales/en.json b/src/locales/en.json
index 9bae9e870..b874d9b88 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -511,6 +511,20 @@
"information": "Audio information",
"weblink": "Get this audio"
},
+ "all-results": {
+ "snackbar": {
+ "text": "Press {spacebar} to play or pause the track.",
+ "spacebar": "Spacebar"
+ }
+ },
+ "audio-results": {
+ "snackbar": {
+ "text": "Press {spacebar} to play or pause, and {left} & {right} to seek through the track.",
+ "spacebar": "Spacebar",
+ "left": "←",
+ "right": "→"
+ }
+ },
"meta-search": {
"caption": "{openverse} can not guarantee the accuracy of license information. Always verify that the work is actually under a CC license.",
"button": "Source list",
@@ -554,6 +568,7 @@
"audio-track": {
"aria-label": "{title} - Audio Player",
"aria-label-interactive": "{title} - audio player - press the spacebar to play and pause a preview of the audio",
+ "aria-label-interactive-seekable": "{title} - audio player - press the spacebar to play and pause a preview of the audio; use the left and right arrow keys to seek through the track.",
"messages": {
"err_aborted": "You aborted playback.",
"err_network": "A network error occurred.",
diff --git a/src/pages/search/audio.vue b/src/pages/search/audio.vue
index 84995e911..ea7f5033a 100644
--- a/src/pages/search/audio.vue
+++ b/src/pages/search/audio.vue
@@ -1,5 +1,18 @@
<template>
- <section>
+ <!-- Negative margin compensates for the `p-4` padding in row layout. -->
+ <section class="-mx-2 md:-mx-4">
+ <VSnackbar size="large" :is-visible="isSnackbarVisible">
+ <i18n path="audio-results.snackbar.text" tag="p">
+ <template
+ v-for="keyboardKey in ['spacebar', 'left', 'right']"
+ #[keyboardKey]
+ >
+ <kbd :key="keyboardKey" class="font-sans">{{
+ $t(`audio-results.snackbar.${keyboardKey}`)
+ }}</kbd>
+ </template>
+ </i18n>
+ </VSnackbar>
<VGridSkeleton
v-if="results.length === 0 && !fetchState.isFinished"
is-for-tab="audio"
@@ -7,11 +20,13 @@
<VAudioTrack
v-for="(audio, i) in results"
:key="audio.id"
- class="mb-8 md:mb-10"
+ class="mb-2 md:mb-1"
:audio="audio"
:size="audioTrackSize"
layout="row"
@shift-tab="handleShiftTab($event, i)"
+ @interacted="hideSnackbar"
+ @focus.native="showSnackbar"
/>
<VLoadMore />
</section>
@@ -32,6 +47,9 @@ import { useFocusFilters } from '~/composables/use-focus-filters'
import { useI18n } from '~/composables/use-i18n'
import { Focus } from '~/utils/focus-management'
+import { useUiStore } from '~/stores/ui'
+
+import VSnackbar from '~/components/VSnackbar.vue'
import VAudioTrack from '~/components/VAudioTrack/VAudioTrack.vue'
import VLoadMore from '~/components/VLoadMore.vue'
import VGridSkeleton from '~/components/VSkeleton/VGridSkeleton.vue'
@@ -41,6 +59,7 @@ import { propTypes } from './search-page.types'
export default defineComponent({
name: 'AudioSearch',
components: {
+ VSnackbar,
VAudioTrack,
VGridSkeleton,
VLoadMore,
@@ -80,6 +99,15 @@ export default defineComponent({
const searchTermRef = toRef(props, 'searchTerm')
const { canLoadMore, onLoadMore } = useLoadMore(searchTermRef)
+ const uiStore = useUiStore()
+ const isSnackbarVisible = computed(() => uiStore.areInstructionsVisible)
+ const showSnackbar = () => {
+ uiStore.showInstructionsSnackbar()
+ }
+ const hideSnackbar = () => {
+ uiStore.hideInstructionsSnackbar()
+ }
+
return {
results,
audioTrackSize,
@@ -89,6 +117,10 @@ export default defineComponent({
handleShiftTab,
canLoadMore,
onLoadMore,
+
+ isSnackbarVisible,
+ showSnackbar,
+ hideSnackbar,
}
},
head: {},
diff --git a/src/stores/ui.ts b/src/stores/ui.ts
new file mode 100644
index 000000000..2e7f2f7f4
--- /dev/null
+++ b/src/stores/ui.ts
@@ -0,0 +1,33 @@
+import { defineStore } from 'pinia'
+
+export type SnackbarState = 'not_shown' | 'visible' | 'dismissed'
+
+export interface UiState {
+ /**
+ * whether to show the instructions snackbar.
+ */
+ instructionsSnackbarState: SnackbarState
+}
+
+export const useUiStore = defineStore('ui', {
+ state: (): UiState => ({
+ instructionsSnackbarState: 'not_shown',
+ }),
+
+ getters: {
+ areInstructionsVisible(state) {
+ return state.instructionsSnackbarState === 'visible'
+ },
+ },
+
+ actions: {
+ showInstructionsSnackbar() {
+ if (this.instructionsSnackbarState === 'not_shown') {
+ this.instructionsSnackbarState = 'visible'
+ }
+ },
+ hideInstructionsSnackbar() {
+ this.instructionsSnackbarState = 'dismissed'
+ },
+ },
+})
diff --git a/src/utils/time-fmt.ts b/src/utils/time-fmt.ts
new file mode 100644
index 000000000..bf22bda02
--- /dev/null
+++ b/src/utils/time-fmt.ts
@@ -0,0 +1,23 @@
+/**
+ * Format the time as hh:mm:ss, dropping the hour part if it is zero. Unless
+ * specified to be milliseconds, the duration is assumed to be in seconds.
+ *
+ * @param duration - the duration to format as a human-readable timestamp
+ * @param isMs - whether the duration is in milliseconds
+ * @returns the duration in a human-friendly format
+ */
+export const timeFmt = (duration: number, isMs = false): string => {
+ const seconds = isMs ? duration / 1e3 : duration
+
+ const hrs = ~~(seconds / 3600)
+ let mins = (~~((seconds % 3600) / 60)).toString()
+ const secs = (~~seconds % 60).toString().padStart(2, '0') // always padded
+
+ const parts = []
+ if (hrs > 0) {
+ parts.push(hrs)
+ mins = mins.padStart(2, '0') // padded only if hours present
+ }
+ parts.push(mins, secs)
+ return parts.join(':')
+}
diff --git a/tailwind.config.js b/tailwind.config.js
index 7cd3260bf..f193b9f45 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -225,5 +225,6 @@ module.exports = {
require('tailwindcss-rtl'),
require('@tailwindcss/line-clamp'),
require('@tailwindcss/typography'),
+ require('tailwindcss-labeled-groups')(['waveform']),
],
}
diff --git a/test/playwright/utils/navigation.ts b/test/playwright/utils/navigation.ts
index d9593d826..e53b035cc 100644
--- a/test/playwright/utils/navigation.ts
+++ b/test/playwright/utils/navigation.ts
@@ -287,7 +287,12 @@ export const searchFromHeader = async (page: Page, term: string) => {
export const openFirstResult = async (page: Page, mediaType: MediaType) => {
await Promise.all([
page.waitForNavigation(),
- page.locator(`a[href*="/${mediaType}/"]`).first().click(),
+ page
+ .locator(`a[href*="/${mediaType}/"]`)
+ .first()
+ .click({
+ position: { x: 32, y: 32 },
+ }),
])
await scrollDownAndUp(page)
}
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-2xl-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-2xl-linux.png
index 6e1f1dbb9..2402b27f0 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-2xl-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-2xl-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-lg-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-lg-linux.png
index 3c5d66d3f..3a442e4f9 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-lg-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-lg-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-md-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-md-linux.png
index 2c81b894a..93b6175c8 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-md-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-md-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-xl-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-xl-linux.png
index 5c5c03cc7..5568657fc 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-xl-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-desktop-xl-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-sm-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-sm-linux.png
index 8bff3b796..b851b7b2e 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-sm-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-sm-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-xs-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-xs-linux.png
index bbc486992..d88fcd6fc 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-xs-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-desktop-UA-xs-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-sm-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-sm-linux.png
index f8e03b7ad..c4b58add2 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-sm-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-sm-linux.png differ
diff --git a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-xs-linux.png b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-xs-linux.png
index 7bff6efe9..6e3434449 100644
Binary files a/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-xs-linux.png and b/test/playwright/visual-regression/components/audio-results.spec.ts-snapshots/audio-results-narrow-viewport-mobile-UA-xs-linux.png differ
diff --git a/test/unit/specs/components/AudioTrack/v-audio-track.spec.js b/test/unit/specs/components/AudioTrack/v-audio-track.spec.js
index b89a1dae7..7be0943e3 100644
--- a/test/unit/specs/components/AudioTrack/v-audio-track.spec.js
+++ b/test/unit/specs/components/AudioTrack/v-audio-track.spec.js
@@ -15,17 +15,25 @@ import VAudioTrack from '~/components/VAudioTrack/VAudioTrack.vue'
const enMessages = require('~/locales/en.json')
+const mockI18n = new Vuei18n({
+ locale: 'en',
+ fallbackLocale: 'en',
+ messages: { en: enMessages },
+})
+
+jest.mock('~/composables/use-browser-detection', () => ({
+ useBrowserIsBlink: jest.fn(() => false),
+}))
+
+jest.mock('~/composables/use-i18n', () => ({
+ useI18n: jest.fn(() => mockI18n),
+}))
+
const useVueI18n = (vue) => {
vue.use(Vuei18n)
- const i18n = new Vuei18n({
- locale: 'en',
- fallbackLocale: 'en',
- messages: { en: enMessages },
- })
-
return {
- i18n,
+ i18n: mockI18n,
}
}
const useStore = (vue) => {
diff --git a/test/unit/specs/components/AudioTrack/waveform.spec.js b/test/unit/specs/components/AudioTrack/waveform.spec.js
index f5c297fcb..7c4bf9d00 100644
--- a/test/unit/specs/components/AudioTrack/waveform.spec.js
+++ b/test/unit/specs/components/AudioTrack/waveform.spec.js
@@ -1,7 +1,13 @@
import { mount } from '@vue/test-utils'
+import { useI18n } from '~/composables/use-i18n'
+
import VWaveform from '~/components/VAudioTrack/VWaveform.vue'
+jest.mock('~/composables/use-i18n', () => ({
+ useI18n: jest.fn(),
+}))
+
jest.mock('~/utils/resampling', () => {
return {
downsampleArray: jest.fn((data) => data),
@@ -14,6 +20,7 @@ describe('VWaveform', () => {
let props = null
beforeEach(() => {
+ useI18n.mockImplementation(() => ({ t: (v) => v, tc: (v) => v }))
props = {
peaks: [],
audioId: 'test',
@@ -23,6 +30,9 @@ describe('VWaveform', () => {
propsData: props,
}
})
+ afterEach(() => {
+ useI18n.mockReset()
+ })
it('should use given peaks when peaks array is provided', () => {
props.peaks = Array.from({ length: 5 }, () => 0)
diff --git a/test/unit/specs/utils/time-fmt.spec.ts b/test/unit/specs/utils/time-fmt.spec.ts
new file mode 100644
index 000000000..1e0dcc0bf
--- /dev/null
+++ b/test/unit/specs/utils/time-fmt.spec.ts
@@ -0,0 +1,33 @@
+import { timeFmt } from '~/utils/time-fmt'
+
+describe('timeFmt', () => {
+ it('omits hours if zero', () => {
+ expect(timeFmt(59)).toEqual('0:59')
+ expect(timeFmt(60)).toEqual('1:00')
+ expect(timeFmt(61)).toEqual('1:01')
+ })
+
+ it('handles zero minutes', () => {
+ expect(timeFmt(59)).toEqual('0:59')
+ expect(timeFmt(3600)).toEqual('1:00:00')
+ expect(timeFmt(3659)).toEqual('1:00:59')
+ })
+
+ it('handles zero seconds', () => {
+ expect(timeFmt(60)).toEqual('1:00')
+ expect(timeFmt(3600)).toEqual('1:00:00')
+ expect(timeFmt(3660)).toEqual('1:01:00')
+ })
+
+ it('pads minutes if hours present', () => {
+ expect(timeFmt(3661)).toEqual('1:01:01')
+ })
+
+ it('handles duration of zero', () => {
+ expect(timeFmt(0)).toEqual('0:00')
+ })
+
+ it('handles durations over 24 hours', () => {
+ expect(timeFmt(86469)).toEqual('24:01:09')
+ })
+})
diff --git a/tsconfig.json b/tsconfig.json
index d51ecbe55..e924ead7b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -54,7 +54,7 @@
"src/components/VSketchFabViewer.vue",
"src/components/VAudioThumbnail/**.vue",
- "src/components/VAudioTrack/**/*.vue",
+ "src/components/VAudioTrack/**.vue",
"src/components/VCheckbox/**.vue",
"src/components/VContentLink/**.vue",
"src/components/VGlobalAudioSection/**.vue",