summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkMediaRange.vue
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-01-15 18:17:01 +0900
committerGitHub <noreply@github.com>2024-01-15 18:17:01 +0900
commit8b0fdfcd69334dbf934a69cf707826b3be8cf2d0 (patch)
tree0ecd2004474980d90151a56952b97b6de94962f9 /packages/frontend/src/components/MkMediaRange.vue
parentenhance(frontend): dedicated games page (diff)
downloadsharkey-8b0fdfcd69334dbf934a69cf707826b3be8cf2d0.tar.gz
sharkey-8b0fdfcd69334dbf934a69cf707826b3be8cf2d0.tar.bz2
sharkey-8b0fdfcd69334dbf934a69cf707826b3be8cf2d0.zip
enhance: 動画・音声周りのUIと動作改良 (#12925)
* wip * (fix) `/files` をバイトレンジリクエストに対応させる * video * audio * fix * fix * spdx * fix (rangeRequest) * fix * Update CHANGELOG.md * (add) ボリュームを保存できるように * (fix) ミュート復帰時に音量が固定される * named export * tweak design * Add sensitive class for audio component * Refactor seekbar styles * Refactor hms * Revert "(add) ボリュームを保存できるように" This reverts commit 6271f9493b63f96d0dd9915207e97fe120ef9037. * Revert "(fix) ミュート復帰時に音量が固定される" This reverts commit a65002b56ecdcb10f76bcc2debbe38593a69643f. * revert revert changes --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend/src/components/MkMediaRange.vue')
-rw-r--r--packages/frontend/src/components/MkMediaRange.vue150
1 files changed, 150 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkMediaRange.vue b/packages/frontend/src/components/MkMediaRange.vue
new file mode 100644
index 0000000000..e6303a5c41
--- /dev/null
+++ b/packages/frontend/src/components/MkMediaRange.vue
@@ -0,0 +1,150 @@
+<!--
+SPDX-FileCopyrightText: syuilo and other misskey contributors
+SPDX-License-Identifier: AGPL-3.0-only
+-->
+
+<!-- Media系専用のinput range -->
+<template>
+<div :class="$style.controlsSeekbar" :style="sliderBgWhite ? '--sliderBg: rgba(255,255,255,.25);' : '--sliderBg: var(--scrollbarHandle);'">
+ <progress v-if="buffer !== undefined" :class="$style.buffer" :value="isNaN(buffer) ? 0 : buffer" min="0" max="1">{{ Math.round(buffer * 100) }}% buffered</progress>
+ <input v-model="model" :class="$style.seek" :style="`--value: ${modelValue * 100}%;`" type="range" min="0" max="1" step="any" @change="emit('dragEnded', modelValue)"/>
+</div>
+</template>
+
+<script setup lang="ts">
+import { computed, ModelRef } from 'vue';
+
+withDefaults(defineProps<{
+ buffer?: number;
+ sliderBgWhite?: boolean;
+}>(), {
+ buffer: undefined,
+ sliderBgWhite: false,
+});
+
+const emit = defineEmits<{
+ (ev: 'dragEnded', value: number): void;
+}>();
+
+// eslint-disable-next-line no-undef
+const model = defineModel({ required: true }) as ModelRef<string | number>;
+const modelValue = computed({
+ get: () => typeof model.value === 'number' ? model.value : parseFloat(model.value),
+ set: v => { model.value = v; },
+});
+</script>
+
+<style lang="scss" module>
+.controlsSeekbar {
+ position: relative;
+}
+
+.seek {
+ position: relative;
+ -webkit-appearance: none;
+ appearance: none;
+ background: transparent;
+ border: 0;
+ border-radius: 26px;
+ color: var(--accent);
+ display: block;
+ height: 19px;
+ margin: 0;
+ min-width: 0;
+ padding: 0;
+ transition: box-shadow .3s ease;
+ width: 100%;
+
+ &::-webkit-slider-runnable-track {
+ background-color: var(--sliderBg);
+ background-image: linear-gradient(to right,currentColor var(--value,0),transparent var(--value,0));
+ border: 0;
+ border-radius: 99rem;
+ height: 5px;
+ transition: box-shadow .3s ease;
+ user-select: none;
+ }
+
+ &::-moz-range-track {
+ background: transparent;
+ border: 0;
+ border-radius: 99rem;
+ height: 5px;
+ transition: box-shadow .3s ease;
+ user-select: none;
+ background-color: var(--sliderBg);
+ }
+
+ &::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ background: #fff;
+ border: 0;
+ border-radius: 100%;
+ box-shadow: 0 1px 1px rgba(35, 40, 47, .15),0 0 0 1px rgba(35, 40, 47, .2);
+ height: 13px;
+ margin-top: -4px;
+ position: relative;
+ transition: all .2s ease;
+ width: 13px;
+
+ &:active {
+ box-shadow: 0 1px 1px rgba(35, 40, 47, .15), 0 0 0 1px rgba(35, 40, 47, .15), 0 0 0 3px rgba(255, 255, 255, .5);
+ }
+ }
+
+ &::-moz-range-thumb {
+ background: #fff;
+ border: 0;
+ border-radius: 100%;
+ box-shadow: 0 1px 1px rgba(35, 40, 47, .15),0 0 0 1px rgba(35, 40, 47, .2);
+ height: 13px;
+ position: relative;
+ transition: all .2s ease;
+ width: 13px;
+
+ &:active {
+ box-shadow: 0 1px 1px rgba(35, 40, 47, .15), 0 0 0 1px rgba(35, 40, 47, .15), 0 0 0 3px rgba(255, 255, 255, .5);
+ }
+ }
+
+ &::-moz-range-progress {
+ background: currentColor;
+ border-radius: 99rem;
+ height: 5px;
+ }
+}
+
+.buffer {
+ appearance: none;
+ background: transparent;
+ color: var(--sliderBg);
+ border: 0;
+ border-radius: 99rem;
+ height: 5px;
+ left: 0;
+ margin-top: -2.5px;
+ padding: 0;
+ position: absolute;
+ top: 50%;
+ width: 100%;
+
+ &::-webkit-progress-bar {
+ background: transparent;
+ }
+
+ &::-webkit-progress-value {
+ background: currentColor;
+ border-radius: 100px;
+ min-width: 5px;
+ transition: width .2s ease;
+ }
+
+ &::-moz-progress-bar {
+ background: currentColor;
+ border-radius: 100px;
+ min-width: 5px;
+ transition: width .2s ease;
+ }
+}
+</style>