@streamscloud/embeddable 16.0.7-1772046586256 → 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,5 +1,4 @@
1
- import type { ArticleFieldType, GalleryFieldMode, MediaFormat, TextFieldMode, TextFieldWeight } from '../../../core/enums';
2
- import type { MediaType } from '../../../core/enums';
1
+ import type { ArticleFieldType, GalleryFieldMode, MediaFormat, MediaType, TextFieldMode, TextFieldWeight } from '../../../core/enums';
3
2
  export type ArticleFieldMediaItem = {
4
3
  type: MediaType;
5
4
  url: string;
@@ -1 +1 @@
1
- export const getMediaItemImageUrl = (media) => (media.type === 'IMAGE' ? media.url : (media.thumbnailUrl ?? ''));
1
+ export const getMediaItemImageUrl = (media) => media.type === 'IMAGE' ? media.url : (media.thumbnailUrl ?? '');
@@ -1,8 +1,21 @@
1
1
  <script lang="ts">import { getMediaItemImageUrl } from '../types';
2
+ import IconDelete from '@fluentui/svg-icons/icons/delete_20_regular.svg?raw';
3
+ import IconEdit from '@fluentui/svg-icons/icons/edit_20_regular.svg?raw';
4
+ import { cardActionContainer, CardActions } from '@streamscloud/kit/ui/card-actions';
2
5
  import { Image } from '@streamscloud/kit/ui/image';
3
6
  import { ProportionalContainer } from '@streamscloud/kit/ui/proportional-container';
4
7
  import { Video } from '@streamscloud/kit/ui/video';
5
8
  let { media, ratio = 0, inert = false, on } = $props();
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
+ });
6
19
  const handleClick = (e) => {
7
20
  if (on?.click) {
8
21
  e.stopPropagation();
@@ -37,7 +50,12 @@ const parsedRatio = $derived.by(() => {
37
50
  {/if}
38
51
  {/snippet}
39
52
 
40
- <div class="media-item-view" class:media-item-view--clickable={on?.click} class:media-item-view--fit-parent={ratio === 'fit-parent'} inert={inert}>
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}>
41
59
  {#if parsedRatio}
42
60
  <ProportionalContainer ratio={parsedRatio}>
43
61
  {@render mediaView()}
@@ -45,6 +63,7 @@ const parsedRatio = $derived.by(() => {
45
63
  {:else}
46
64
  {@render mediaView()}
47
65
  {/if}
66
+ <CardActions actions={actions} />
48
67
  </div>
49
68
  {/if}
50
69
 
@@ -6,6 +6,8 @@ type Props = {
6
6
  inert?: boolean;
7
7
  on?: {
8
8
  click?: () => void;
9
+ edit?: () => void;
10
+ remove?: () => void;
9
11
  };
10
12
  };
11
13
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -1,5 +1,5 @@
1
- <script lang="ts">import {} from '../types';
2
- import { MediaItemView } from '../media-item-view';
1
+ <script lang="ts">import { MediaItemView } from '../media-item-view';
2
+ import {} from '../types';
3
3
  import { GalleryLayout } from './gallery-layout';
4
4
  import { openMediaViewer } from '@streamscloud/kit/ui/media-viewer-dialog';
5
5
  let { media, singleImageRatio = 0, inert = false, on } = $props();
@@ -52,7 +52,9 @@ const handleGalleryItemClick = (index) => {
52
52
  ratio={singleImageRatio}
53
53
  inert={inert}
54
54
  on={{
55
- click: on?.click ? () => on?.click(0) : undefined
55
+ click: on?.click ? () => on?.click?.(0) : undefined,
56
+ edit: on?.edit ? () => on?.edit?.(0) : undefined,
57
+ remove: on?.remove ? () => on?.remove?.(0) : undefined
56
58
  }} />
57
59
  {:else}
58
60
  <div class="gallery-container" inert={inert}>
@@ -62,7 +64,9 @@ const handleGalleryItemClick = (index) => {
62
64
  media={media[index]}
63
65
  ratio="fit-parent"
64
66
  on={{
65
- click: () => handleGalleryItemClick(index)
67
+ click: () => handleGalleryItemClick(index),
68
+ edit: on?.edit ? () => on?.edit?.(index) : undefined,
69
+ remove: on?.remove ? () => on?.remove?.(index) : undefined
66
70
  }} />
67
71
  </div>
68
72
  {/snippet}
@@ -5,7 +5,9 @@ type Props = {
5
5
  singleImageRatio?: number | MediaFormat;
6
6
  inert?: boolean;
7
7
  on?: {
8
- click: (index: number) => void;
8
+ click?: (index: number) => void;
9
+ edit?: (index: number) => void;
10
+ remove?: (index: number) => void;
9
11
  };
10
12
  };
11
13
  declare const Cmp: import("svelte").Component<Props, {}, "">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "16.0.7-1772046586256",
3
+ "version": "16.0.7-1772051881364",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",