@streamscloud/embeddable 4.0.0 → 5.0.0

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.
Files changed (58) hide show
  1. package/dist/ads/ad-card/cmp.ad-card.svelte +34 -7
  2. package/dist/ads/ad-card/cmp.ad-card.svelte.d.ts +1 -1
  3. package/dist/ads/ad-card/mapper.js +1 -0
  4. package/dist/ads/ad-card/operations.generated.d.ts +1 -0
  5. package/dist/ads/ad-card/operations.generated.js +1 -0
  6. package/dist/ads/ad-card/operations.graphql +1 -0
  7. package/dist/ads/ad-card/types.d.ts +1 -0
  8. package/dist/products/product-card/cmp.product-card.svelte +3 -2
  9. package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte +24 -13
  10. package/dist/short-videos/short-video-viewer/cmp.short-video-controls.svelte.d.ts +2 -2
  11. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +4 -3
  12. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
  13. package/dist/short-videos/short-video-viewer/index.d.ts +2 -2
  14. package/dist/short-videos/short-video-viewer/index.js +1 -1
  15. package/dist/short-videos/short-video-viewer/mapper.d.ts +1 -1
  16. package/dist/short-videos/short-video-viewer/mapper.js +38 -5
  17. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +1 -0
  18. package/dist/short-videos/short-video-viewer/operations.generated.js +87 -98
  19. package/dist/short-videos/short-video-viewer/operations.graphql +40 -2
  20. package/dist/short-videos/short-video-viewer/types.d.ts +35 -6
  21. package/dist/short-videos/short-video-viewer/types.js +1 -1
  22. package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +2 -2
  23. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +3 -1
  24. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +4 -0
  25. package/dist/short-videos/short-videos-player/controls.svelte +37 -20
  26. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +2 -1
  27. package/dist/short-videos/short-videos-player/index.js +6 -0
  28. package/dist/short-videos/short-videos-player/operations.generated.d.ts +1 -0
  29. package/dist/short-videos/short-videos-player/operations.generated.js +73 -84
  30. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +19 -6
  31. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte.d.ts +4 -0
  32. package/dist/short-videos/short-videos-player/types.d.ts +9 -9
  33. package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +1 -0
  34. package/dist/short-videos/short-videos-player/ui-manager.svelte.js +2 -1
  35. package/dist/streams/layout/models/mapper.js +2 -1
  36. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +1 -0
  37. package/dist/streams/stream-player/cmp.stream-player.svelte +6 -4
  38. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +2 -0
  39. package/dist/streams/stream-player/controls.svelte +25 -5
  40. package/dist/streams/stream-player/controls.svelte.d.ts +2 -0
  41. package/dist/streams/stream-player/index.d.ts +2 -0
  42. package/dist/streams/stream-player/index.js +2 -1
  43. package/dist/streams/stream-player/mapper.d.ts +1 -1
  44. package/dist/streams/stream-player/mapper.js +1 -1
  45. package/dist/streams/stream-player/ui-manager.svelte.d.ts +1 -0
  46. package/dist/streams/stream-player/ui-manager.svelte.js +2 -1
  47. package/dist/ui/line-clamp/cmp.line-clamp.svelte +35 -13
  48. package/dist/ui/player/cmp.player-slider.svelte +74 -9
  49. package/dist/ui/progress/cmp.progress.svelte +4 -1
  50. package/dist/ui/seek-bar/cmp.seek-bar.svelte +112 -28
  51. package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +3 -0
  52. package/dist/ui/video/cmp.video.svelte +45 -37
  53. package/dist/ui/video/cmp.video.svelte.d.ts +2 -0
  54. package/dist/ui/video/index.d.ts +1 -0
  55. package/dist/ui/video/index.js +1 -0
  56. package/dist/ui/video/types.d.ts +4 -0
  57. package/dist/ui/video/types.js +5 -0
  58. package/package.json +5 -1
@@ -12,13 +12,14 @@ import { Icon, IconColor } from '../icon';
12
12
  import { MediaVolumeManager, PlaybackManager } from '../media-playback';
13
13
  import { Progress } from '../progress';
14
14
  import { SeekBar } from '../seek-bar';
15
+ import { ScrubberPosition } from './types';
15
16
  import IconPause from '@fluentui/svg-icons/icons/pause_20_regular.svg?raw';
16
17
  import IconPlay from '@fluentui/svg-icons/icons/play_20_regular.svg?raw';
17
18
  import IconSpeaker from '@fluentui/svg-icons/icons/speaker_2_20_regular.svg?raw';
18
19
  import IconSpeakerMute from '@fluentui/svg-icons/icons/speaker_mute_20_regular.svg?raw';
19
20
  import { onDestroy, onMount, untrack } from 'svelte';
20
- import { slide } from 'svelte/transition';
21
- let { src, poster, id = randomNanoid(), controls = true, autoplay = false, loop = false, inert = false, hideSpeaker = false, intersectionContainer, on } = $props();
21
+ import { fade } from 'svelte/transition';
22
+ let { src, poster, id = randomNanoid(), controls = true, autoplay = false, loop = false, inert = false, hideSpeaker = false, intersectionContainer, scrubberPosition = ScrubberPosition.Bottom, on } = $props();
22
23
  onMount(() => {
23
24
  var _a;
24
25
  PlaybackManager.registerMountedPlayer(id, {
@@ -29,12 +30,10 @@ onMount(() => {
29
30
  pause();
30
31
  },
31
32
  onStop: (inRespectToNewlyActivatedVideo) => {
32
- if (inRespectToNewlyActivatedVideo && autoplay === 'on-appearance') {
33
- pause();
34
- }
35
- else {
36
- stop();
33
+ if (autoplay === 'on-appearance' && inRespectToNewlyActivatedVideo) {
34
+ return;
37
35
  }
36
+ stop();
38
37
  },
39
38
  onToggle: () => {
40
39
  togglePlay();
@@ -50,8 +49,8 @@ onMount(() => {
50
49
  }
51
50
  });
52
51
  (_a = on === null || on === void 0 ? void 0 : on.loaded) === null || _a === void 0 ? void 0 : _a.call(on, { id, src });
53
- if (video) {
54
- intersectionObserver.observe(video);
52
+ if (videoContainerRef) {
53
+ intersectionObserver.observe(videoContainerRef);
55
54
  }
56
55
  });
57
56
  onDestroy(() => {
@@ -64,8 +63,8 @@ onDestroy(() => {
64
63
  }
65
64
  });
66
65
  let video = $state.raw(undefined);
66
+ let videoContainerRef = $state.raw(undefined);
67
67
  let showControlsOnHover = $state(false);
68
- let needShowProgress = $state(false);
69
68
  let isVideoPaused = $state(true);
70
69
  let percentageCompleted = $state(0);
71
70
  let everActivated = $state(false);
@@ -187,9 +186,7 @@ const onTimeUpdate = (e) => {
187
186
  percentageCompleted = video.currentTime / video.duration || 0;
188
187
  notifyProgress();
189
188
  };
190
- const onLoaded = (e) => __awaiter(void 0, void 0, void 0, function* () {
191
- const video = e.target;
192
- needShowProgress = video.duration >= 8;
189
+ const onLoaded = () => __awaiter(void 0, void 0, void 0, function* () {
193
190
  setVolume(MediaVolumeManager.volumeLevel);
194
191
  setMuted(MediaVolumeManager.isMuted);
195
192
  });
@@ -233,11 +230,13 @@ const notifyProgress = () => {
233
230
  const handleSeek = (percent) => {
234
231
  if (video) {
235
232
  video.currentTime = video.duration * percent;
233
+ percentageCompleted = percent;
234
+ notifyProgress();
236
235
  }
237
236
  };
238
237
  </script>
239
238
 
240
- <div class="video" onmouseenter={() => setShowControlsOnHover(true)} onmouseleave={() => setShowControlsOnHover(false)} role="none" inert={inert}>
239
+ <div class="video" role="none" inert={inert} bind:this={videoContainerRef}>
241
240
  <video
242
241
  class="video__video"
243
242
  class:video__video--not-activated={!everActivated}
@@ -281,18 +280,24 @@ const handleSeek = (percent) => {
281
280
  {/if}
282
281
 
283
282
  {#if everActivated}
284
- <div class="video__progress-container">
285
- {#if needShowProgress}
286
- {#if showControlsOnHover}
287
- <div class="video__seek-bar" onclick={(e) => e.stopPropagation()} onkeydown={() => ({})} role="none" transition:slide>
288
- <SeekBar value={percentageCompleted} on={{ seek: handleSeek }} />
289
- </div>
290
- {/if}
291
- {#if !showControlsOnHover}
292
- <div class="video__progress" in:slide>
293
- <Progress value={percentageCompleted} />
294
- </div>
295
- {/if}
283
+ <div
284
+ class="video__progress-container"
285
+ class:video__progress-container--top={scrubberPosition === ScrubberPosition.Top}
286
+ class:video__progress-container--bottom={scrubberPosition === ScrubberPosition.Bottom}
287
+ onmouseenter={() => setShowControlsOnHover(true)}
288
+ onmouseleave={() => setShowControlsOnHover(false)}
289
+ onclick={(e) => e.stopPropagation()}
290
+ onkeydown={() => ({})}
291
+ role="none">
292
+ {#if !showControlsOnHover && isVideoPaused}
293
+ <div class="video__progress">
294
+ <Progress value={percentageCompleted} />
295
+ </div>
296
+ {/if}
297
+ {#if showControlsOnHover}
298
+ <div class="video__progress" transition:fade={{ duration: isVideoPaused ? 0 : 300 }}>
299
+ <SeekBar value={percentageCompleted} listenParentClicks={true} on={{ seek: handleSeek }} />
300
+ </div>
296
301
  {/if}
297
302
  </div>
298
303
  {/if}
@@ -316,7 +321,7 @@ const handleSeek = (percent) => {
316
321
  --_video--border-radius: var(--video--border-radius, 0);
317
322
  --_video--media-fit: var(--video--media-fit, contain);
318
323
  --_video--poster--media-fit: var(--video--poster--media-fit, cover);
319
- --_video--progress--background-color: var(--video--progress--background-color, hsla(0, 0%, 0%, 0.5));
324
+ --_video--progress--background-color: var(--video--progress--background-color, transparent);
320
325
  --_video--progress--back-color: var(--video--progress--back-color);
321
326
  --_video--progress--front-color: var(--video--progress--front-color);
322
327
  height: 100%;
@@ -382,20 +387,23 @@ const handleSeek = (percent) => {
382
387
  }
383
388
  .video__progress-container {
384
389
  position: absolute;
385
- bottom: 0;
386
390
  left: 0;
387
391
  right: 0;
392
+ z-index: 1;
393
+ min-height: 1.5625rem;
394
+ padding: 0 0.25rem;
395
+ }
396
+ .video__progress-container--top {
397
+ top: 0.5625rem;
398
+ bottom: auto;
399
+ }
400
+ .video__progress-container--bottom {
401
+ top: auto;
402
+ bottom: 0;
388
403
  }
389
404
  .video__progress {
390
- margin-bottom: 1px;
391
- --progress--height: 0.125em;
405
+ --progress--height: 0.3125em;
392
406
  --progress--back-color: var(--_video--progress--back-color);
393
407
  --progress--front-color: var(--_video--progress--front-color);
394
- }
395
- .video__seek-bar {
396
- padding: 0.625em 0.5em;
397
- background: var(--_video--progress--background-color);
398
- cursor: default;
399
- --seek-bar--back-color: var(--_video--progress--back-color);
400
- --seek-bar--front-color: var(--_video--progress--front-color);
408
+ padding: 0.625rem 0;
401
409
  }</style>
@@ -1,3 +1,4 @@
1
+ import { ScrubberPosition } from './types';
1
2
  type Props = {
2
3
  src: string;
3
4
  poster: string | null;
@@ -8,6 +9,7 @@ type Props = {
8
9
  intersectionContainer?: HTMLElement;
9
10
  inert?: boolean;
10
11
  hideSpeaker?: boolean;
12
+ scrubberPosition?: ScrubberPosition;
11
13
  on?: {
12
14
  loaded?: (data: {
13
15
  id: string;
@@ -1 +1,2 @@
1
1
  export { default as Video } from './cmp.video.svelte';
2
+ export { ScrubberPosition } from './types';
@@ -1 +1,2 @@
1
1
  export { default as Video } from './cmp.video.svelte';
2
+ export { ScrubberPosition } from './types';
@@ -0,0 +1,4 @@
1
+ export declare enum ScrubberPosition {
2
+ Top = 0,
3
+ Bottom = 1
4
+ }
@@ -0,0 +1,5 @@
1
+ export var ScrubberPosition;
2
+ (function (ScrubberPosition) {
3
+ ScrubberPosition[ScrubberPosition["Top"] = 0] = "Top";
4
+ ScrubberPosition[ScrubberPosition["Bottom"] = 1] = "Bottom";
5
+ })(ScrubberPosition || (ScrubberPosition = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "author": "StreamsCloud",
5
5
  "repository": "https://github.com/StreamsCloud/streamscloud-frontend-packages.git",
6
6
  "type": "module",
@@ -36,6 +36,10 @@
36
36
  "types": "./dist/short-videos/short-videos-player/index.d.ts",
37
37
  "svelte": "./dist/short-videos/short-videos-player/index.js"
38
38
  },
39
+ "./short-video-viewer": {
40
+ "types": "./dist/short-videos/short-video-viewer/index.d.ts",
41
+ "svelte": "./dist/short-videos/short-video-viewer/index.js"
42
+ },
39
43
  "./stream-layout": {
40
44
  "types": "./dist/streams/layout/index.d.ts",
41
45
  "import": "./dist/streams/layout/index.js",