@streamscloud/embeddable 2.1.2 → 2.1.3

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.
@@ -18,19 +18,19 @@ export {};
18
18
  }
19
19
  }
20
20
  .action-button {
21
- --_short-video-player--action-button--size: var(--short-video-player--action-button--size);
22
- --_action-button--background: var(--action-button-background, #1c1c1c);
23
- width: var(--_short-video-player--action-button--size);
24
- min-width: var(--_short-video-player--action-button--size);
25
- max-width: var(--_short-video-player--action-button--size);
26
- height: var(--_short-video-player--action-button--size);
27
- min-height: var(--_short-video-player--action-button--size);
28
- max-height: var(--_short-video-player--action-button--size);
21
+ --_short-videos-player--action-button--size: var(--short-videos-player--action-button--size);
22
+ --_short-videos-player--action-button--background: var(--action-button-background, #1c1c1c);
23
+ width: var(--_short-videos-player--action-button--size);
24
+ min-width: var(--_short-videos-player--action-button--size);
25
+ max-width: var(--_short-videos-player--action-button--size);
26
+ height: var(--_short-videos-player--action-button--size);
27
+ min-height: var(--_short-videos-player--action-button--size);
28
+ max-height: var(--_short-videos-player--action-button--size);
29
29
  display: flex;
30
30
  justify-content: center;
31
31
  align-items: center;
32
32
  line-height: 0;
33
- background: var(--_action-button--background);
33
+ background: var(--_short-videos-player--action-button--background);
34
34
  border-radius: 50%;
35
35
  --icon--size: 1.25rem;
36
36
  z-index: 1;
@@ -12,12 +12,12 @@ import { PlayerBuffer, PlayerSlider } from '../../ui/player';
12
12
  import { SpotlightLayout } from '../../ui/spotlight-layout';
13
13
  import { default as Controls } from './controls.svelte';
14
14
  import { ShortVideosPlayerLocalization } from './short-videos-player-localization.svelte';
15
- import { ShortVideoPlayerUiManager } from './ui-manager.svelte';
15
+ import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
16
16
  import { onDestroy, onMount } from 'svelte';
17
17
  let { shortVideosProvider, localization: localizationInit, on } = $props();
18
18
  const localization = $derived(new ShortVideosPlayerLocalization(localizationInit));
19
19
  const buffer = $derived(new PlayerBuffer(shortVideosProvider));
20
- const uiManager = new ShortVideoPlayerUiManager();
20
+ const uiManager = new ShortVideosPlayerUiManager();
21
21
  onMount(() => __awaiter(void 0, void 0, void 0, function* () {
22
22
  uiManager.detailsCollapsed = window && window.innerWidth < window.innerHeight;
23
23
  }));
@@ -16,16 +16,16 @@ const toggleMuted = () => {
16
16
  const shortVideo = $derived(buffer.current);
17
17
  </script>
18
18
 
19
- <div class="short-video-player-controls">
20
- <div class="short-video-player-controls__left">
19
+ <div class="short-videos-player-controls">
20
+ <div class="short-videos-player-controls__left">
21
21
  {#if shortVideo && uiManager.detailsCollapsed && !uiManager.showShortVideoOverlay}
22
- <div class="short-video-player-controls__short-video-overlay">
23
- <div class="short-video-player-controls__short-video-attachments-inline">
22
+ <div class="short-videos-player-controls__short-video-overlay">
23
+ <div class="short-videos-player-controls__short-video-attachments-inline">
24
24
  <ShortVideoViewerAttachmentsInline model={shortVideo} />
25
25
  </div>
26
26
  </div>
27
27
  {/if}
28
- <div class="short-video-player-controls__navigation-buttons">
28
+ <div class="short-videos-player-controls__navigation-buttons">
29
29
  <button type="button" class="navigation-button" disabled={!buffer.canLoadPrevious} onclick={buffer.loadPrevious}>
30
30
  <Icon src={IconChevronUp} />
31
31
  </button>
@@ -34,13 +34,13 @@ const shortVideo = $derived(buffer.current);
34
34
  </button>
35
35
  </div>
36
36
  </div>
37
- <div class="short-video-player-controls__right">
37
+ <div class="short-videos-player-controls__right">
38
38
  {#if shortVideo}
39
- <div class="short-video-player-controls__short-video-attachments">
39
+ <div class="short-videos-player-controls__short-video-attachments">
40
40
  <ShortVideoViewerAttachments shortVideo={shortVideo} localization={localization.shortVideoDetailsLocalization?.attachmentsLocalization} />
41
41
  </div>
42
42
  {/if}
43
- <div class="short-video-player-controls__controls">
43
+ <div class="short-videos-player-controls__controls">
44
44
  {#if shortVideo}
45
45
  <ActionButton on={{ click: toggleMuted }}>
46
46
  {#if MediaVolumeManager.isMuted}
@@ -79,37 +79,37 @@ const shortVideo = $derived(buffer.current);
79
79
  }
80
80
  .close-button {
81
81
  position: absolute;
82
- top: var(--short-video-player--controls--offset-vertical);
83
- right: var(--short-video-player--controls--offset-horizontal);
82
+ top: var(--short-videos-player--controls--offset-vertical);
83
+ right: var(--short-videos-player--controls--offset-horizontal);
84
84
  z-index: 1;
85
85
  }
86
86
 
87
87
  .toggle-collapsed-button {
88
88
  position: absolute;
89
- bottom: var(--short-video-player--controls--offset-vertical);
90
- right: var(--short-video-player--controls--offset-horizontal);
89
+ bottom: var(--short-videos-player--controls--offset-vertical);
90
+ right: var(--short-videos-player--controls--offset-horizontal);
91
91
  z-index: 1;
92
92
  }
93
93
 
94
- .short-video-player-controls {
94
+ .short-videos-player-controls {
95
95
  position: absolute;
96
96
  top: 0;
97
97
  right: 0;
98
98
  height: 100%;
99
- width: var(--short-video-player--sidebar--available-space);
99
+ width: var(--short-videos-player--sidebar--available-space);
100
100
  display: flex;
101
101
  justify-content: space-between;
102
102
  gap: 2.5rem;
103
- padding: var(--short-video-player--controls--offset-vertical) var(--short-video-player--controls--offset-horizontal);
103
+ padding: var(--short-videos-player--controls--offset-vertical) var(--short-videos-player--controls--offset-horizontal);
104
104
  container-type: inline-size;
105
105
  }
106
- .short-video-player-controls__left {
106
+ .short-videos-player-controls__left {
107
107
  display: flex;
108
108
  flex-direction: column;
109
109
  gap: 2.5rem;
110
110
  justify-content: flex-end;
111
111
  }
112
- .short-video-player-controls__right {
112
+ .short-videos-player-controls__right {
113
113
  flex: 1;
114
114
  display: flex;
115
115
  justify-content: space-between;
@@ -119,11 +119,11 @@ const shortVideo = $derived(buffer.current);
119
119
  /* Set 'container-type: inline-size;' to reference container*/
120
120
  }
121
121
  @container (width < 9.375rem) {
122
- .short-video-player-controls__right {
122
+ .short-videos-player-controls__right {
123
123
  display: none;
124
124
  }
125
125
  }
126
- .short-video-player-controls__short-video-overlay {
126
+ .short-videos-player-controls__short-video-overlay {
127
127
  gap: 2.5rem;
128
128
  display: flex;
129
129
  flex: 1;
@@ -131,21 +131,21 @@ const shortVideo = $derived(buffer.current);
131
131
  flex-direction: column;
132
132
  align-items: flex-start;
133
133
  justify-content: flex-end;
134
- --short-video-viewer--interactions--icon--size: var(--short-video-player--navigation-button--size);
134
+ --short-video-viewer--interactions--icon--size: var(--short-videos-player--navigation-button--size);
135
135
  --short-video-viewer--interactions--background--color: #1c1c1c;
136
136
  --short-video-viewer--interactions--counter--color: #f3f4f6;
137
137
  --short-video-viewer--interactions--icon--font-color: #f3f4f6;
138
138
  }
139
- .short-video-player-controls__short-video-attachments-inline {
139
+ .short-videos-player-controls__short-video-attachments-inline {
140
140
  display: none;
141
141
  /* Set 'container-type: inline-size;' to reference container*/
142
142
  }
143
143
  @container (width < calc(21.875rem + 3.75rem)) {
144
- .short-video-player-controls__short-video-attachments-inline {
144
+ .short-videos-player-controls__short-video-attachments-inline {
145
145
  display: contents;
146
146
  }
147
147
  }
148
- .short-video-player-controls__short-video-attachments {
148
+ .short-videos-player-controls__short-video-attachments {
149
149
  flex: 1;
150
150
  overflow-x: hidden;
151
151
  overflow-y: auto;
@@ -155,34 +155,34 @@ const shortVideo = $derived(buffer.current);
155
155
  max-width: 21.875rem;
156
156
  /* Set 'container-type: inline-size;' to reference container*/
157
157
  }
158
- .short-video-player-controls__short-video-attachments::-webkit-scrollbar {
158
+ .short-videos-player-controls__short-video-attachments::-webkit-scrollbar {
159
159
  width: 3px;
160
160
  height: 3px;
161
161
  background: var(--custom-scrollbar-background, transparent);
162
162
  visibility: hidden;
163
163
  }
164
- .short-video-player-controls__short-video-attachments::-webkit-scrollbar-thumb {
164
+ .short-videos-player-controls__short-video-attachments::-webkit-scrollbar-thumb {
165
165
  background: transparent;
166
166
  }
167
- .short-video-player-controls__short-video-attachments:hover {
167
+ .short-videos-player-controls__short-video-attachments:hover {
168
168
  scrollbar-color: var(--custom-scrollbar-color, #7d7d7d) var(--custom-scrollbar-background, transparent);
169
169
  scrollbar-width: thin;
170
170
  }
171
- .short-video-player-controls__short-video-attachments:hover::-webkit-scrollbar {
171
+ .short-videos-player-controls__short-video-attachments:hover::-webkit-scrollbar {
172
172
  width: 3px;
173
173
  height: 3px;
174
174
  background: var(--custom-scrollbar-background, transparent);
175
175
  visibility: hidden;
176
176
  }
177
- .short-video-player-controls__short-video-attachments:hover::-webkit-scrollbar-thumb {
177
+ .short-videos-player-controls__short-video-attachments:hover::-webkit-scrollbar-thumb {
178
178
  background: var(--custom-scrollbar-color, #7d7d7d);
179
179
  }
180
180
  @container (width < calc(21.875rem + 3.75rem)) {
181
- .short-video-player-controls__short-video-attachments {
181
+ .short-videos-player-controls__short-video-attachments {
182
182
  display: none;
183
183
  }
184
184
  }
185
- .short-video-player-controls__navigation-buttons {
185
+ .short-videos-player-controls__navigation-buttons {
186
186
  display: flex;
187
187
  flex-direction: column;
188
188
  gap: 1rem;
@@ -191,11 +191,11 @@ const shortVideo = $derived(buffer.current);
191
191
  /* Set 'container-type: inline-size;' to reference container*/
192
192
  }
193
193
  @container (width < 6.25rem) {
194
- .short-video-player-controls__navigation-buttons {
194
+ .short-videos-player-controls__navigation-buttons {
195
195
  visibility: hidden;
196
196
  }
197
197
  }
198
- .short-video-player-controls__controls {
198
+ .short-videos-player-controls__controls {
199
199
  display: flex;
200
200
  margin-top: auto;
201
201
  gap: 1rem;
@@ -203,12 +203,12 @@ const shortVideo = $derived(buffer.current);
203
203
  }
204
204
 
205
205
  .navigation-button {
206
- width: var(--short-video-player--navigation-button--size);
207
- min-width: var(--short-video-player--navigation-button--size);
208
- max-width: var(--short-video-player--navigation-button--size);
209
- height: var(--short-video-player--navigation-button--size);
210
- min-height: var(--short-video-player--navigation-button--size);
211
- max-height: var(--short-video-player--navigation-button--size);
206
+ width: var(--short-videos-player--navigation-button--size);
207
+ min-width: var(--short-videos-player--navigation-button--size);
208
+ max-width: var(--short-videos-player--navigation-button--size);
209
+ height: var(--short-videos-player--navigation-button--size);
210
+ min-height: var(--short-videos-player--navigation-button--size);
211
+ max-height: var(--short-videos-player--navigation-button--size);
212
212
  background-color: #000000;
213
213
  border: 1px solid #1c1c1c;
214
214
  border-radius: 50%;
@@ -1,10 +1,10 @@
1
1
  import { type ShortVideoViewerModel } from '../short-video-viewer';
2
2
  import type { IPlayerBuffer } from '../../ui/player';
3
3
  import { ShortVideosPlayerLocalization } from './short-videos-player-localization.svelte.js';
4
- import type { ShortVideoPlayerUiManager } from './ui-manager.svelte';
4
+ import type { ShortVideosPlayerUiManager } from './ui-manager.svelte';
5
5
  type Props = {
6
6
  buffer: IPlayerBuffer<ShortVideoViewerModel>;
7
- uiManager: ShortVideoPlayerUiManager;
7
+ uiManager: ShortVideosPlayerUiManager;
8
8
  localization: ShortVideosPlayerLocalization;
9
9
  on: {
10
10
  closePlayer: () => void;
@@ -1,4 +1,4 @@
1
- export declare class ShortVideoPlayerUiManager {
1
+ export declare class ShortVideosPlayerUiManager {
2
2
  detailsCollapsed: boolean;
3
3
  globalCssVariables: string;
4
4
  isMobileView: boolean;
@@ -1,12 +1,12 @@
1
- export class ShortVideoPlayerUiManager {
1
+ export class ShortVideosPlayerUiManager {
2
2
  detailsCollapsed = $state(true);
3
3
  globalCssVariables = $derived.by(() => {
4
4
  const values = [
5
- `--short-video-player--action-button--size: ${this.actionButtonSize}px`,
6
- `--short-video-player--navigation-button--size: ${this.navigationButtonSize}px`,
7
- `--short-video-player--controls--offset-horizontal: ${this.controlsOffsetHorizontal}px`,
8
- `--short-video-player--controls--offset-vertical: ${this.controlsOffsetVertical}px`,
9
- `--short-video-player--sidebar--available-space: ${(this.viewTotalWidth - this.mainViewColumnWidth) / 2}px`
5
+ `--short-videos-player--action-button--size: ${this.actionButtonSize}px`,
6
+ `--short-videos-player--navigation-button--size: ${this.navigationButtonSize}px`,
7
+ `--short-videos-player--controls--offset-horizontal: ${this.controlsOffsetHorizontal}px`,
8
+ `--short-videos-player--controls--offset-vertical: ${this.controlsOffsetVertical}px`,
9
+ `--short-videos-player--sidebar--available-space: ${(this.viewTotalWidth - this.mainViewColumnWidth) / 2}px`
10
10
  ];
11
11
  return values.join(';');
12
12
  });
@@ -23,10 +23,55 @@ const dataIsFilled = $derived.by(() => {
23
23
  Utils.assertUnreachable(model.data);
24
24
  }
25
25
  });
26
+ const productModel = $derived.by(() => {
27
+ var _a;
28
+ return ((_a = model.data) === null || _a === void 0 ? void 0 : _a.type) === StreamComponentDataType.Product ? model.data.product : undefined;
29
+ });
30
+ const handleProductClick = (e) => {
31
+ e.preventDefault();
32
+ if (!productModel) {
33
+ return;
34
+ }
35
+ if (productModel.id && (on === null || on === void 0 ? void 0 : on.productClick)) {
36
+ on.productClick(productModel.id);
37
+ }
38
+ if (productModel.link) {
39
+ window.open(productModel.link, '_blank', 'noopener noreferrer');
40
+ }
41
+ };
26
42
  </script>
27
43
 
28
- {#if component && model.data && dataIsFilled}
29
- {#each component.elements as element (element)}
30
- <StreamElement model={element} data={model.data} localization={localization} on={on} />
31
- {/each}
44
+ {#snippet slotContent()}
45
+ {#if component && model.data && dataIsFilled}
46
+ {#each component.elements as element (element)}
47
+ <StreamElement model={element} data={model.data} localization={localization} on={on} />
48
+ {/each}
49
+ {/if}
50
+ {/snippet}
51
+ {#if productModel?.link}
52
+ <a class="stream-slot-content-product-link" href={productModel.link} onclick={handleProductClick} target="_blank" rel="noopener noreferrer">
53
+ {@render slotContent()}
54
+ </a>
55
+ {:else}
56
+ {@render slotContent()}
32
57
  {/if}
58
+
59
+ <style>@keyframes fadeIn {
60
+ 0% {
61
+ opacity: 1;
62
+ }
63
+ 50% {
64
+ opacity: 0.4;
65
+ }
66
+ 100% {
67
+ opacity: 1;
68
+ }
69
+ }
70
+ .stream-slot-content-product-link {
71
+ width: 100%;
72
+ min-width: 100%;
73
+ max-width: 100%;
74
+ height: 100%;
75
+ min-height: 100%;
76
+ max-height: 100%;
77
+ }</style>
@@ -8,7 +8,6 @@ type Props = {
8
8
  constainerDirection?: StreamElementStyleDirection;
9
9
  localization?: IStreamElementLocalization;
10
10
  on?: {
11
- productClick: (productId: string) => void;
12
11
  progress?: (videoId: string, progress: number) => void;
13
12
  };
14
13
  };
@@ -19,7 +19,7 @@ export {};
19
19
  }
20
20
  .action-button {
21
21
  --_stream-player--action-button--size: var(--stream-player--action-button--size);
22
- --_action-button--background: var(--action-button-background, #1c1c1c);
22
+ --_stream-player--action-button--background: var(--action-button-background, #1c1c1c);
23
23
  width: var(--_stream-player--action-button--size);
24
24
  min-width: var(--_stream-player--action-button--size);
25
25
  max-width: var(--_stream-player--action-button--size);
@@ -30,7 +30,7 @@ export {};
30
30
  justify-content: center;
31
31
  align-items: center;
32
32
  line-height: 0;
33
- background: var(--_action-button--background);
33
+ background: var(--_stream-player--action-button--background);
34
34
  border-radius: 50%;
35
35
  --icon--size: 1.25rem;
36
36
  z-index: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "author": "StreamsCloud",
5
5
  "repository": "https://github.com/StreamsCloud/streamscloud-frontend-packages.git",
6
6
  "type": "module",