@streamscloud/embeddable 16.0.7-1772050914349 → 16.0.7-1772051881364
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.
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
<script lang="ts">import { getMediaItemImageUrl } from '../types';
|
|
2
2
|
import IconDelete from '@fluentui/svg-icons/icons/delete_20_regular.svg?raw';
|
|
3
3
|
import IconEdit from '@fluentui/svg-icons/icons/edit_20_regular.svg?raw';
|
|
4
|
-
import {
|
|
4
|
+
import { cardActionContainer, CardActions } from '@streamscloud/kit/ui/card-actions';
|
|
5
5
|
import { Image } from '@streamscloud/kit/ui/image';
|
|
6
6
|
import { ProportionalContainer } from '@streamscloud/kit/ui/proportional-container';
|
|
7
7
|
import { Video } from '@streamscloud/kit/ui/video';
|
|
8
8
|
let { media, ratio = 0, inert = false, on } = $props();
|
|
9
|
-
const
|
|
9
|
+
const actions = $derived.by(() => {
|
|
10
|
+
const result = [];
|
|
11
|
+
if (on?.edit) {
|
|
12
|
+
result.push({ icon: IconEdit, iconColor: 'blue', callback: on.edit });
|
|
13
|
+
}
|
|
14
|
+
if (on?.remove) {
|
|
15
|
+
result.push({ icon: IconDelete, iconColor: 'red', callback: on.remove });
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
});
|
|
10
19
|
const handleClick = (e) => {
|
|
11
20
|
if (on?.click) {
|
|
12
21
|
e.stopPropagation();
|
|
13
22
|
on.click();
|
|
14
23
|
}
|
|
15
24
|
};
|
|
16
|
-
const handleEdit = (e) => {
|
|
17
|
-
e.stopPropagation();
|
|
18
|
-
on?.edit?.();
|
|
19
|
-
};
|
|
20
|
-
const handleRemove = (e) => {
|
|
21
|
-
e.stopPropagation();
|
|
22
|
-
on?.remove?.();
|
|
23
|
-
};
|
|
24
25
|
const parsedRatio = $derived.by(() => {
|
|
25
26
|
if (!ratio || ratio === 'fit-parent') {
|
|
26
27
|
return 0;
|
|
@@ -49,7 +50,12 @@ const parsedRatio = $derived.by(() => {
|
|
|
49
50
|
{/if}
|
|
50
51
|
{/snippet}
|
|
51
52
|
|
|
52
|
-
<div
|
|
53
|
+
<div
|
|
54
|
+
class="media-item-view"
|
|
55
|
+
class:media-item-view--clickable={on?.click}
|
|
56
|
+
class:media-item-view--fit-parent={ratio === 'fit-parent'}
|
|
57
|
+
use:cardActionContainer
|
|
58
|
+
inert={inert}>
|
|
53
59
|
{#if parsedRatio}
|
|
54
60
|
<ProportionalContainer ratio={parsedRatio}>
|
|
55
61
|
{@render mediaView()}
|
|
@@ -57,20 +63,7 @@ const parsedRatio = $derived.by(() => {
|
|
|
57
63
|
{:else}
|
|
58
64
|
{@render mediaView()}
|
|
59
65
|
{/if}
|
|
60
|
-
{
|
|
61
|
-
<div class="media-item-view__actions">
|
|
62
|
-
{#if on?.edit}
|
|
63
|
-
<button type="button" class="media-item-view__action" onclick={handleEdit} aria-label="edit">
|
|
64
|
-
<Icon src={IconEdit} />
|
|
65
|
-
</button>
|
|
66
|
-
{/if}
|
|
67
|
-
{#if on?.remove}
|
|
68
|
-
<button type="button" class="media-item-view__action" onclick={handleRemove} aria-label="remove">
|
|
69
|
-
<Icon src={IconDelete} />
|
|
70
|
-
</button>
|
|
71
|
-
{/if}
|
|
72
|
-
</div>
|
|
73
|
-
{/if}
|
|
66
|
+
<CardActions actions={actions} />
|
|
74
67
|
</div>
|
|
75
68
|
{/if}
|
|
76
69
|
|
|
@@ -100,28 +93,6 @@ const parsedRatio = $derived.by(() => {
|
|
|
100
93
|
height: 100%;
|
|
101
94
|
cursor: pointer;
|
|
102
95
|
}
|
|
103
|
-
.media-item-view__actions {
|
|
104
|
-
position: absolute;
|
|
105
|
-
top: 0.3125rem;
|
|
106
|
-
right: 0.3125rem;
|
|
107
|
-
opacity: 0;
|
|
108
|
-
transition: opacity ease-in-out 0.6s;
|
|
109
|
-
display: flex;
|
|
110
|
-
padding: 0 0.3125rem;
|
|
111
|
-
background: light-dark(#f2f2f3, #111827);
|
|
112
|
-
border-radius: 0.1875rem;
|
|
113
|
-
--sc-kit--icon--color: light-dark(#1f2937, #ffffff);
|
|
114
|
-
}
|
|
115
|
-
.media-item-view__action {
|
|
116
|
-
padding: 0.3125rem;
|
|
117
|
-
transition: transform 0.3s;
|
|
118
|
-
}
|
|
119
|
-
.media-item-view__action:hover {
|
|
120
|
-
transform: scale(1.2);
|
|
121
|
-
}
|
|
122
96
|
.media-item-view--clickable {
|
|
123
97
|
cursor: pointer;
|
|
124
|
-
}
|
|
125
|
-
.media-item-view:hover .media-item-view__actions {
|
|
126
|
-
opacity: 1;
|
|
127
98
|
}</style>
|