@visualizevalue/mint-app-base 0.1.95 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/components/Embed.vue
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
class="embed"
|
|
4
4
|
@touchmove.stop.prevent="() => null"
|
|
5
5
|
>
|
|
6
|
-
<video
|
|
6
|
+
<video
|
|
7
|
+
v-if="isPlayable"
|
|
8
|
+
:autoplay="autoplay"
|
|
9
|
+
:loop="loop"
|
|
10
|
+
:muted="muted"
|
|
11
|
+
:controls="controls"
|
|
12
|
+
playsinline
|
|
13
|
+
crossorigin="anonymous"
|
|
14
|
+
>
|
|
7
15
|
<source :src="src" :type="mediaType">
|
|
8
16
|
Your browser does not support the video tag.
|
|
9
17
|
</video>
|
|
@@ -45,6 +53,22 @@ async function fetchMediaType(url: string): Promise<string | null> {
|
|
|
45
53
|
const config = useRuntimeConfig()
|
|
46
54
|
const props = defineProps({
|
|
47
55
|
src: String,
|
|
56
|
+
muted: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: true,
|
|
59
|
+
},
|
|
60
|
+
loop: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
autoplay: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true,
|
|
67
|
+
},
|
|
68
|
+
controls: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: false,
|
|
71
|
+
},
|
|
48
72
|
})
|
|
49
73
|
|
|
50
74
|
// Update on input change
|
|
@@ -74,16 +98,22 @@ watch(width, () => {
|
|
|
74
98
|
<style scoped>
|
|
75
99
|
.embed {
|
|
76
100
|
width: 100%;
|
|
77
|
-
|
|
78
|
-
|
|
101
|
+
display: grid;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
79
104
|
position: relative;
|
|
80
105
|
touch-action: none;
|
|
81
106
|
overflow: hidden;
|
|
107
|
+
container-type: inline-size;
|
|
82
108
|
|
|
109
|
+
video,
|
|
83
110
|
iframe {
|
|
84
111
|
width: 100%;
|
|
85
|
-
|
|
86
|
-
|
|
112
|
+
width: 100cqw;
|
|
113
|
+
aspect-ratio: 1/1 auto;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
iframe {
|
|
87
117
|
pointer-events: all;
|
|
88
118
|
}
|
|
89
119
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
class="image"
|
|
4
4
|
:class="{ loaded }"
|
|
5
5
|
@click="$emit('click')"
|
|
6
|
-
:style="{ padding: `0 0 ${height}` }"
|
|
7
6
|
v-intersection-observer="loadImage"
|
|
8
7
|
>
|
|
9
8
|
<Loading v-if="! loaded" txt=""/>
|
|
@@ -31,15 +30,6 @@ const emit = defineEmits(['click', 'loaded'])
|
|
|
31
30
|
const uri = ref('')
|
|
32
31
|
const loaded = ref(false)
|
|
33
32
|
const imageEl = ref(null)
|
|
34
|
-
const aspectRatio = ref(1)
|
|
35
|
-
const computeAspectRatio = () => {
|
|
36
|
-
aspectRatio.value = (
|
|
37
|
-
props.aspectRatio || // The passed aspect ratio
|
|
38
|
-
(imageEl.value?.naturalWidth / (imageEl.value?.naturalHeight || 1)) || // The natural image element ratio
|
|
39
|
-
1 // The default square ratio
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
computeAspectRatio()
|
|
43
33
|
const height = computed(() => (1 / aspectRatio.value) * 100 + '%')
|
|
44
34
|
|
|
45
35
|
const loadImage = ([{ isIntersecting }]) => {
|
|
@@ -55,7 +45,6 @@ watch(() => props.src, () => loadImage([{ isIntersecting: true }]))
|
|
|
55
45
|
const imageLoaded = () => {
|
|
56
46
|
loaded.value = true
|
|
57
47
|
emit('loaded')
|
|
58
|
-
computeAspectRatio()
|
|
59
48
|
}
|
|
60
49
|
</script>
|
|
61
50
|
|
|
@@ -63,11 +52,11 @@ const imageLoaded = () => {
|
|
|
63
52
|
article.image {
|
|
64
53
|
overflow: hidden;
|
|
65
54
|
background-color: var(--background);
|
|
55
|
+
aspect-ratio: auto 1;
|
|
66
56
|
overflow: hidden;
|
|
67
57
|
position: relative;
|
|
68
|
-
height: 0;
|
|
69
|
-
padding-bottom: 100%;
|
|
70
58
|
display: flex;
|
|
59
|
+
container-type: inline-size;
|
|
71
60
|
|
|
72
61
|
.loader {
|
|
73
62
|
position: absolute;
|
|
@@ -78,17 +67,12 @@ article.image {
|
|
|
78
67
|
}
|
|
79
68
|
|
|
80
69
|
img {
|
|
81
|
-
position: absolute;
|
|
82
|
-
top: 0;
|
|
83
|
-
left: 0;
|
|
84
|
-
right: 0;
|
|
85
|
-
bottom: 0;
|
|
86
70
|
width: 100%;
|
|
87
|
-
|
|
71
|
+
width: 100cqw;
|
|
72
|
+
height: auto;
|
|
88
73
|
object-fit: cover;
|
|
89
74
|
object-fit: contain;
|
|
90
75
|
transform: scale(1.2);
|
|
91
|
-
width: 100%;
|
|
92
76
|
opacity: 0;
|
|
93
77
|
transition: all var(--speed);
|
|
94
78
|
image-rendering: pixelated;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<article class="token-detail">
|
|
3
3
|
<div class="artifact">
|
|
4
4
|
<div>
|
|
5
|
-
<Embed v-if="token.animationUrl" :src="token.animationUrl" />
|
|
5
|
+
<Embed v-if="token.animationUrl" :src="token.animationUrl" :muted="false" controls />
|
|
6
6
|
<Image v-else-if="token.image" :src="token.image" :alt="token.name" />
|
|
7
7
|
<ImageVoid v-else />
|
|
8
8
|
</div>
|