@streamscloud/embeddable 16.0.7-1772032308956 → 16.0.7-1772033370968

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.
@@ -2,7 +2,7 @@ import type { MediaType } from '../enums';
2
2
  export type MediaItemModel = {
3
3
  type: MediaType;
4
4
  url: string;
5
- thumbnailUrl: string | null;
5
+ thumbnailUrl?: string | null;
6
6
  };
7
7
  export type MediaItemMetadataModel = {
8
8
  width: number;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">import {} from '../../core/media';
2
2
  import { MediaItemView } from '../media-item-view';
3
3
  import { GalleryLayout } from './types';
4
+ import { openMediaViewer } from '@streamscloud/kit/ui/media-viewer-dialog';
4
5
  let { media, singleImageRatio = 0, inert = false, on } = $props();
5
6
  let layout = $state(null);
6
7
  const initLayout = async () => {
@@ -16,35 +17,31 @@ $effect(() => {
16
17
  });
17
18
  const upperTwoImages = $derived(media.length > 4 ? media.slice(0, 2) : []);
18
19
  const bottomThreeImages = $derived(media.length > 4 ? media.slice(2, 5) : []);
19
- const handleGalleryItemClick = (index) => {
20
- if (on?.click) {
21
- on?.click(index);
22
- return;
23
- }
24
- /*const toMediaViewerItemType = (type: MediaType) => {
25
- switch (type) {
26
- case 'IMAGE':
27
- return MediaViewerItemType.Image;
20
+ const toMediaViewerItemType = (type) => {
21
+ switch (type) {
28
22
  case 'VIDEO':
29
23
  case 'SHORT_VIDEO':
30
- return MediaViewerItemType.Video;
31
24
  case 'AUDIO':
32
- return MediaViewerItemType.Audio;
25
+ return 'video';
33
26
  default:
34
- Utils.assertUnreachable(type);
35
- }
36
- };
27
+ return 'image';
28
+ }
29
+ };
30
+ const handleGalleryItemClick = (index) => {
31
+ if (on?.click) {
32
+ on.click(index);
33
+ return;
34
+ }
37
35
  openMediaViewer({
38
- items: media.map((i) => ({
39
- id: randomNanoid(),
40
- url: i.url,
41
- thumbnailUrl: i.thumbnailUrl,
42
- type: toMediaViewerItemType(i.type),
43
- width: i.metadata.width,
44
- height: i.metadata.height
45
- })),
46
- index
47
- });*/
36
+ items: media.map((i) => ({
37
+ url: i.url,
38
+ thumbnailUrl: i.thumbnailUrl ?? null,
39
+ type: toMediaViewerItemType(i.type),
40
+ width: i.metadata.width,
41
+ height: i.metadata.height
42
+ })),
43
+ index
44
+ });
48
45
  };
49
46
  </script>
50
47
 
@@ -59,7 +56,7 @@ const handleGalleryItemClick = (index) => {
59
56
  }} />
60
57
  {:else}
61
58
  <div class="gallery-container" inert={inert}>
62
- {#snippet galleryItem(index: NumberType)}
59
+ {#snippet galleryItem(index: number)}
63
60
  <div class="gallery-item">
64
61
  <MediaItemView
65
62
  media={media[index]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "16.0.7-1772032308956",
3
+ "version": "16.0.7-1772033370968",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -158,7 +158,7 @@
158
158
  "@graphql-codegen/typescript": "^5.0.7",
159
159
  "@graphql-codegen/typescript-operations": "^5.0.7",
160
160
  "@graphql-typed-document-node/core": "^3.2.0",
161
- "@streamscloud/kit": "^0.1.12-1772032209109",
161
+ "@streamscloud/kit": "^0.1.12",
162
162
  "@streamscloud/streams-analytics-collector": "^4.0.1",
163
163
  "@sveltejs/package": "^2.5.7",
164
164
  "@sveltejs/vite-plugin-svelte": "^6.2.4",