@streamscloud/embeddable 7.5.2 → 8.0.1
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.
- package/dist/content-player/cmp.content-player.svelte +69 -34
- package/dist/content-player/content-player-config.svelte.d.ts +8 -17
- package/dist/content-player/content-player-config.svelte.js +16 -15
- package/dist/content-player/content-player-settings.d.ts +14 -0
- package/dist/content-player/content-player-settings.js +14 -0
- package/dist/content-player/controls-and-attachments.svelte +9 -4
- package/dist/content-player/header.svelte +1 -1
- package/dist/content-player/index.d.ts +1 -1
- package/dist/core/analytics.profile-id.js +27 -1
- package/dist/core/utils/html-helper.d.ts +1 -0
- package/dist/core/utils/html-helper.js +3 -0
- package/dist/media-center/media-center/cmp.media-center.svelte +32 -24
- package/dist/media-center/media-center/discover-panel.svelte +1 -1
- package/dist/posts/attachments/cmp.attachments.svelte +7 -6
- package/dist/posts/attachments/cmp.attachments.svelte.d.ts +2 -2
- package/dist/posts/controls/cmp.controls.svelte +2 -2
- package/dist/posts/controls/cmp.controls.svelte.d.ts +2 -2
- package/dist/posts/index.d.ts +1 -0
- package/dist/posts/model/index.d.ts +3 -1
- package/dist/posts/model/index.js +2 -1
- package/dist/posts/model/post-media-model.svelte.d.ts +20 -0
- package/dist/posts/model/post-media-model.svelte.js +16 -0
- package/dist/posts/model/post-model.d.ts +25 -0
- package/dist/posts/model/post-model.js +28 -0
- package/dist/posts/model/types.d.ts +53 -9
- package/dist/posts/model/types.js +1 -1
- package/dist/posts/model/utils.d.ts +4 -0
- package/dist/posts/model/utils.js +7 -0
- package/dist/posts/post-viewer/attachments-horizontal.svelte +7 -2
- package/dist/posts/post-viewer/attachments-horizontal.svelte.d.ts +2 -2
- package/dist/posts/post-viewer/cmp.post-viewer.svelte +27 -50
- package/dist/posts/post-viewer/cmp.post-viewer.svelte.d.ts +2 -2
- package/dist/posts/post-viewer/heading.svelte +2 -1
- package/dist/posts/post-viewer/heading.svelte.d.ts +2 -2
- package/dist/posts/post-viewer/index.d.ts +1 -3
- package/dist/posts/post-viewer/index.js +1 -2
- package/dist/posts/post-viewer/mapper.d.ts +2 -2
- package/dist/posts/post-viewer/mapper.js +23 -27
- package/dist/posts/post-viewer/media/post-media.svelte +64 -0
- package/dist/posts/post-viewer/{post-media.svelte.d.ts → media/post-media.svelte.d.ts} +4 -6
- package/dist/posts/post-viewer/post-texts.svelte +101 -0
- package/dist/posts/post-viewer/post-texts.svelte.d.ts +11 -0
- package/dist/posts/post-viewer/post-viewer-localization.d.ts +1 -0
- package/dist/posts/post-viewer/post-viewer-localization.js +4 -1
- package/dist/posts/posts-player/index.d.ts +2 -3
- package/dist/posts/posts-player/index.js +0 -1
- package/dist/posts/posts-player/posts-player-view.svelte +3 -2
- package/dist/posts/posts-player/types.d.ts +5 -4
- package/dist/short-videos/short-videos-player/index.d.ts +3 -4
- package/dist/short-videos/short-videos-player/index.js +0 -1
- package/dist/short-videos/short-videos-player/mapper.js +2 -2
- package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +3 -2
- package/dist/short-videos/short-videos-player/types.d.ts +5 -4
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +4 -3
- package/dist/streams/layout/models/index.d.ts +1 -1
- package/dist/streams/layout/models/index.js +1 -1
- package/dist/streams/layout/models/mapper.d.ts +2 -2
- package/dist/streams/layout/models/mapper.js +10 -9
- package/dist/streams/stream-player/index.d.ts +3 -4
- package/dist/streams/stream-player/stream-player-view.svelte +4 -3
- package/dist/streams/stream-player/types.d.ts +3 -2
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +1 -0
- package/dist/ui/player-slider/cmp.player-slider.svelte +44 -7
- package/dist/ui/player-slider/cmp.player-slider.svelte.d.ts +2 -2
- package/dist/ui/player-slider/player-buffer.svelte.d.ts +4 -3
- package/dist/ui/player-slider/player-buffer.svelte.js +9 -3
- package/dist/ui/player-slider/types.d.ts +5 -2
- package/dist/ui/slider/cmp.slider.svelte +398 -0
- package/dist/ui/slider/cmp.slider.svelte.d.ts +31 -0
- package/dist/ui/slider/index.d.ts +2 -0
- package/dist/ui/slider/index.js +2 -0
- package/dist/ui/slider/slider-localization.d.ts +5 -0
- package/dist/ui/slider/slider-localization.js +13 -0
- package/dist/ui/slider/types.d.ts +11 -0
- package/dist/ui/slider/types.js +8 -0
- package/package.json +2 -2
- package/dist/posts/post-viewer/media/media-slider.svelte +0 -10
- package/dist/posts/post-viewer/media/media-slider.svelte.d.ts +0 -27
- package/dist/posts/post-viewer/post-media.svelte +0 -26
- package/dist/posts/post-viewer/types.d.ts +0 -60
- package/dist/posts/post-viewer/types.js +0 -1
- package/dist/posts/post-viewer/utils.d.ts +0 -2
- package/dist/posts/post-viewer/utils.js +0 -13
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
<script lang="ts">import { runningInBrowser } from '../../core/browser';
|
|
2
|
+
import { Utils } from '../../core/utils';
|
|
3
|
+
import { HtmlHelper } from '../../core/utils/html-helper';
|
|
4
|
+
import { Icon } from '../icon';
|
|
5
|
+
import { SliderLocalization } from './slider-localization';
|
|
6
|
+
import { SliderMode } from './types';
|
|
7
|
+
import IconChevronLeft from '@fluentui/svg-icons/icons/chevron_left_20_regular.svg?raw';
|
|
8
|
+
import IconChevronRight from '@fluentui/svg-icons/icons/chevron_right_20_regular.svg?raw';
|
|
9
|
+
import { onDestroy, onMount } from 'svelte';
|
|
10
|
+
let { items, sliderMode = SliderMode.ArrowsWithCounts, dotsConfig = {
|
|
11
|
+
activeHtml: '<i class="fa-solid fa-circle" tabindex="0"></i>',
|
|
12
|
+
inactiveHtml: '<i class="fa-regular fa-circle" tabindex="0"></i>'
|
|
13
|
+
}, locale, initialIndex, autoSlideMs = 0, on, children } = $props();
|
|
14
|
+
const localization = $derived.by(() => new SliderLocalization(locale));
|
|
15
|
+
const itemIndices = $derived(items.map((_, index) => index));
|
|
16
|
+
const animationDuration = 850;
|
|
17
|
+
let previousItems = $state.raw(undefined);
|
|
18
|
+
let selectedIndex = $state(initialIndex);
|
|
19
|
+
let animationIndex = $state(null);
|
|
20
|
+
let interval;
|
|
21
|
+
let slidesRef;
|
|
22
|
+
let sliderWidth = $state(0);
|
|
23
|
+
let resizeObserver;
|
|
24
|
+
onMount(() => {
|
|
25
|
+
notifyIndexChanged();
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
slidesRef === null || slidesRef === void 0 ? void 0 : slidesRef.classList.toggle('animate', false);
|
|
28
|
+
});
|
|
29
|
+
let touchStartX = 0;
|
|
30
|
+
let touchStartY = 0;
|
|
31
|
+
let touchStartTime = 0;
|
|
32
|
+
let isHorizontalSwipe = false;
|
|
33
|
+
slidesRef.addEventListener('touchstart', (e) => {
|
|
34
|
+
touchStartX = e.changedTouches[0].screenX;
|
|
35
|
+
touchStartY = e.changedTouches[0].screenY;
|
|
36
|
+
touchStartTime = Date.now();
|
|
37
|
+
isHorizontalSwipe = false;
|
|
38
|
+
});
|
|
39
|
+
slidesRef.addEventListener('touchmove', (e) => {
|
|
40
|
+
if (isHorizontalSwipe) {
|
|
41
|
+
// Already determined this is a horizontal swipe
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const touchCurrentX = e.changedTouches[0].screenX;
|
|
47
|
+
const touchCurrentY = e.changedTouches[0].screenY;
|
|
48
|
+
const diffX = Math.abs(touchCurrentX - touchStartX);
|
|
49
|
+
const diffY = Math.abs(touchCurrentY - touchStartY);
|
|
50
|
+
// Determine direction on first significant movement
|
|
51
|
+
if (diffX > 10 || diffY > 10) {
|
|
52
|
+
if (diffX > diffY) {
|
|
53
|
+
// Horizontal swipe - block vertical scroll
|
|
54
|
+
isHorizontalSwipe = true;
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Vertical swipe - allow parent to handle
|
|
60
|
+
isHorizontalSwipe = false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
slidesRef.addEventListener('touchend', (e) => {
|
|
65
|
+
const touchEndX = e.changedTouches[0].screenX;
|
|
66
|
+
const touchEndY = e.changedTouches[0].screenY;
|
|
67
|
+
const diffX = Math.abs(touchEndX - touchStartX);
|
|
68
|
+
const diffY = Math.abs(touchEndY - touchStartY);
|
|
69
|
+
// Check if this is a horizontal swipe
|
|
70
|
+
if (diffY > diffX) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// This is a horizontal swipe - block propagation
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
const isFastSwipe = Date.now() - touchStartTime < 300;
|
|
77
|
+
if (!isFastSwipe && diffX < sliderWidth / 6) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (touchEndX < touchStartX) {
|
|
81
|
+
loadNext();
|
|
82
|
+
}
|
|
83
|
+
if (touchEndX > touchStartX) {
|
|
84
|
+
loadPrevious();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
slidesRef.addEventListener('transitionend', (e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
if (animationIndex !== null && animationIndex > items.length - 1) {
|
|
90
|
+
slidesRef.classList.toggle('animate', false);
|
|
91
|
+
animationIndex = null;
|
|
92
|
+
}
|
|
93
|
+
if (animationIndex !== null && animationIndex === 0) {
|
|
94
|
+
slidesRef.classList.toggle('animate', false);
|
|
95
|
+
animationIndex = null;
|
|
96
|
+
}
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
slidesRef === null || slidesRef === void 0 ? void 0 : slidesRef.classList.toggle('animate', true);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
if (autoSlideMs) {
|
|
102
|
+
interval = window.setInterval(() => {
|
|
103
|
+
if ((items === null || items === void 0 ? void 0 : items.length) <= 1) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
loadNext();
|
|
107
|
+
}, autoSlideMs);
|
|
108
|
+
}
|
|
109
|
+
sliderWidth = slidesRef.getBoundingClientRect().width;
|
|
110
|
+
let resizeTimeout = 0;
|
|
111
|
+
resizeObserver = new ResizeObserver(() => {
|
|
112
|
+
if (runningInBrowser() && resizeTimeout) {
|
|
113
|
+
window.clearTimeout(resizeTimeout);
|
|
114
|
+
}
|
|
115
|
+
slidesRef.classList.toggle('animate', false);
|
|
116
|
+
sliderWidth = slidesRef.getBoundingClientRect().width;
|
|
117
|
+
resizeTimeout = window.setTimeout(() => {
|
|
118
|
+
slidesRef === null || slidesRef === void 0 ? void 0 : slidesRef.classList.toggle('animate', true);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
resizeObserver.observe(slidesRef);
|
|
122
|
+
if (runningInBrowser()) {
|
|
123
|
+
window.addEventListener(`keydown`, onKeyPress);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
onDestroy(() => {
|
|
127
|
+
if (resizeObserver) {
|
|
128
|
+
resizeObserver.disconnect();
|
|
129
|
+
}
|
|
130
|
+
if (runningInBrowser()) {
|
|
131
|
+
window.removeEventListener('keydown', onKeyPress);
|
|
132
|
+
if (interval) {
|
|
133
|
+
window.clearInterval(interval);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const onKeyPress = Utils.throttle((e) => {
|
|
138
|
+
if (e.key === 'ArrowLeft') {
|
|
139
|
+
loadPrevious();
|
|
140
|
+
}
|
|
141
|
+
if (e.key === 'ArrowRight') {
|
|
142
|
+
loadNext();
|
|
143
|
+
}
|
|
144
|
+
}, animationDuration);
|
|
145
|
+
const notifyIndexChanged = () => {
|
|
146
|
+
var _a;
|
|
147
|
+
(_a = on === null || on === void 0 ? void 0 : on.indexChanged) === null || _a === void 0 ? void 0 : _a.call(on, selectedIndex);
|
|
148
|
+
};
|
|
149
|
+
notifyIndexChanged();
|
|
150
|
+
const setIndex = (index) => {
|
|
151
|
+
if (index < 0) {
|
|
152
|
+
animationIndex = 0;
|
|
153
|
+
selectedIndex = items.length - 1;
|
|
154
|
+
}
|
|
155
|
+
else if (index > items.length - 1) {
|
|
156
|
+
animationIndex = index + 1;
|
|
157
|
+
selectedIndex = 0;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
animationIndex = null;
|
|
161
|
+
selectedIndex = index;
|
|
162
|
+
}
|
|
163
|
+
setTimeout(() => {
|
|
164
|
+
notifyIndexChanged();
|
|
165
|
+
}, 600);
|
|
166
|
+
};
|
|
167
|
+
const loadPrevious = Utils.throttle(() => {
|
|
168
|
+
setIndex(--selectedIndex);
|
|
169
|
+
}, 800);
|
|
170
|
+
const loadNext = Utils.throttle(() => {
|
|
171
|
+
setIndex(++selectedIndex);
|
|
172
|
+
}, 800);
|
|
173
|
+
$effect(() => {
|
|
174
|
+
if (previousItems && items !== previousItems) {
|
|
175
|
+
setIndex(0);
|
|
176
|
+
}
|
|
177
|
+
previousItems = items;
|
|
178
|
+
});
|
|
179
|
+
const showClassicArrowsAndDots = $derived([SliderMode.ArrowsAndDots, SliderMode.ArrowsOnly, SliderMode.DotsOnly, SliderMode.DotsOnlyBelow].includes(sliderMode));
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<div
|
|
183
|
+
class="slider"
|
|
184
|
+
class:slider--arrows-and-dots={sliderMode === SliderMode.ArrowsAndDots}
|
|
185
|
+
class:slider--arrows-only={sliderMode === SliderMode.ArrowsOnly}
|
|
186
|
+
class:slider--dots-only={sliderMode === SliderMode.DotsOnly}
|
|
187
|
+
class:slider--dots-only-below={sliderMode === SliderMode.DotsOnlyBelow}
|
|
188
|
+
class:slider--arrows-with-counts={sliderMode === SliderMode.ArrowsWithCounts}>
|
|
189
|
+
<div
|
|
190
|
+
class="slider__slides"
|
|
191
|
+
bind:this={slidesRef}
|
|
192
|
+
style={`transform: translateX(${items.length > 1 ? -sliderWidth * (animationIndex === null ? selectedIndex + 1 : animationIndex) : 0}px)`}>
|
|
193
|
+
{#if items.length > 1}
|
|
194
|
+
<div class="slider__slide" data-before>
|
|
195
|
+
{#if children}
|
|
196
|
+
{@render children(items[items.length - 1])}
|
|
197
|
+
{/if}
|
|
198
|
+
</div>
|
|
199
|
+
{/if}
|
|
200
|
+
{#each items as item (item)}
|
|
201
|
+
<div class="slider__slide">
|
|
202
|
+
{#if children}
|
|
203
|
+
{@render children(item)}
|
|
204
|
+
{/if}
|
|
205
|
+
</div>
|
|
206
|
+
{/each}
|
|
207
|
+
{#if items.length > 1}
|
|
208
|
+
<div class="slider__slide" data-after>
|
|
209
|
+
{#if children}
|
|
210
|
+
{@render children(items[0])}
|
|
211
|
+
{/if}
|
|
212
|
+
</div>
|
|
213
|
+
{/if}
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
{#if items.length > 1}
|
|
217
|
+
{#if showClassicArrowsAndDots}
|
|
218
|
+
<button type="button" class="slider__navigation-button slider__navigation-button--prev" onclick={loadPrevious} aria-label="none">
|
|
219
|
+
<Icon src={IconChevronLeft} />
|
|
220
|
+
</button>
|
|
221
|
+
<button type="button" class="slider__navigation-button slider__navigation-button--next" onclick={loadNext} aria-label="none">
|
|
222
|
+
<Icon src={IconChevronRight} />
|
|
223
|
+
</button>
|
|
224
|
+
<div class="slider__dots">
|
|
225
|
+
{#each itemIndices as index (index)}
|
|
226
|
+
<div class="slider__dot" onclick={() => setIndex(index)} onkeydown={() => ({})} role="none">
|
|
227
|
+
{@html HtmlHelper.sanitizeHtml(index === selectedIndex ? dotsConfig.activeHtml : dotsConfig.inactiveHtml)}
|
|
228
|
+
</div>
|
|
229
|
+
{/each}
|
|
230
|
+
</div>
|
|
231
|
+
{:else if sliderMode === SliderMode.ArrowsWithCounts}
|
|
232
|
+
<div class="slider__arrows-with-counts">
|
|
233
|
+
<button type="button" class="slider__counts-navigation-button" onclick={loadPrevious} aria-label="none">
|
|
234
|
+
<Icon src={IconChevronLeft} />
|
|
235
|
+
</button>
|
|
236
|
+
<div class="slider__counts">{localization.nOfM(selectedIndex + 1, items.length)}</div>
|
|
237
|
+
<button type="button" class="slider__counts-navigation-button" onclick={loadNext} aria-label="none">
|
|
238
|
+
<Icon src={IconChevronRight} />
|
|
239
|
+
</button>
|
|
240
|
+
</div>
|
|
241
|
+
{/if}
|
|
242
|
+
{/if}
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<style>@keyframes fadeIn {
|
|
246
|
+
0% {
|
|
247
|
+
opacity: 1;
|
|
248
|
+
}
|
|
249
|
+
50% {
|
|
250
|
+
opacity: 0.4;
|
|
251
|
+
}
|
|
252
|
+
100% {
|
|
253
|
+
opacity: 1;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
.slider {
|
|
257
|
+
display: flex;
|
|
258
|
+
flex-direction: column;
|
|
259
|
+
flex: 1;
|
|
260
|
+
position: relative;
|
|
261
|
+
width: 100%;
|
|
262
|
+
height: 100%;
|
|
263
|
+
overflow: hidden;
|
|
264
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
265
|
+
}
|
|
266
|
+
.slider__slides {
|
|
267
|
+
display: flex;
|
|
268
|
+
height: 100%;
|
|
269
|
+
}
|
|
270
|
+
.slider__slides:global(.animate) {
|
|
271
|
+
transition: 800ms ease-out transform;
|
|
272
|
+
}
|
|
273
|
+
.slider__slide {
|
|
274
|
+
display: flex;
|
|
275
|
+
justify-content: center;
|
|
276
|
+
align-items: center;
|
|
277
|
+
position: relative;
|
|
278
|
+
height: 100%;
|
|
279
|
+
width: 100%;
|
|
280
|
+
min-width: 100%;
|
|
281
|
+
max-width: 100%;
|
|
282
|
+
}
|
|
283
|
+
.slider__dots {
|
|
284
|
+
margin: 0;
|
|
285
|
+
display: flex;
|
|
286
|
+
justify-content: center;
|
|
287
|
+
z-index: 1;
|
|
288
|
+
gap: 1em;
|
|
289
|
+
flex-wrap: wrap;
|
|
290
|
+
position: absolute;
|
|
291
|
+
left: 0;
|
|
292
|
+
right: 0;
|
|
293
|
+
bottom: 0.625rem;
|
|
294
|
+
font-size: var(--slider-dots-size-internal, var(--slider-dots-size, 0.75rem));
|
|
295
|
+
}
|
|
296
|
+
.slider__dot {
|
|
297
|
+
cursor: pointer;
|
|
298
|
+
color: var(--slider-dots-color, white);
|
|
299
|
+
}
|
|
300
|
+
.slider__navigation-button {
|
|
301
|
+
font-size: 0.75rem;
|
|
302
|
+
width: 1.875rem;
|
|
303
|
+
height: 1.875rem;
|
|
304
|
+
background-color: #9ca3af;
|
|
305
|
+
border-radius: 50%;
|
|
306
|
+
text-align: center;
|
|
307
|
+
color: #ffffff;
|
|
308
|
+
position: absolute;
|
|
309
|
+
top: 50%;
|
|
310
|
+
transform: translateY(-50%);
|
|
311
|
+
visibility: hidden;
|
|
312
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
313
|
+
}
|
|
314
|
+
@container (width < 576px) {
|
|
315
|
+
.slider__navigation-button {
|
|
316
|
+
visibility: visible;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
.slider__navigation-button:disabled {
|
|
320
|
+
opacity: 0.5;
|
|
321
|
+
cursor: default;
|
|
322
|
+
}
|
|
323
|
+
.slider__navigation-button--prev {
|
|
324
|
+
left: 0.9375rem;
|
|
325
|
+
}
|
|
326
|
+
.slider__navigation-button--next {
|
|
327
|
+
right: 0.9375rem;
|
|
328
|
+
}
|
|
329
|
+
.slider__arrows-with-counts {
|
|
330
|
+
position: absolute;
|
|
331
|
+
bottom: 0.75rem;
|
|
332
|
+
left: 50%;
|
|
333
|
+
transform: translateX(-50%);
|
|
334
|
+
display: flex;
|
|
335
|
+
justify-content: center;
|
|
336
|
+
align-items: center;
|
|
337
|
+
height: 1.625rem;
|
|
338
|
+
z-index: 1;
|
|
339
|
+
}
|
|
340
|
+
.slider__counts {
|
|
341
|
+
font-size: 0.9375rem;
|
|
342
|
+
font-weight: 300;
|
|
343
|
+
width: 5.625rem;
|
|
344
|
+
text-align: center;
|
|
345
|
+
color: #ffffff;
|
|
346
|
+
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 6px rgba(0, 0, 0, 0.05);
|
|
347
|
+
}
|
|
348
|
+
.slider__counts-navigation-button {
|
|
349
|
+
font-size: 0.75rem;
|
|
350
|
+
width: 1.625rem;
|
|
351
|
+
height: 1.625rem;
|
|
352
|
+
background-color: #9ca3af;
|
|
353
|
+
border-radius: 50%;
|
|
354
|
+
text-align: center;
|
|
355
|
+
color: #ffffff;
|
|
356
|
+
visibility: hidden;
|
|
357
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
358
|
+
}
|
|
359
|
+
.slider__counts-navigation-button:disabled {
|
|
360
|
+
opacity: 0.5;
|
|
361
|
+
cursor: default;
|
|
362
|
+
}
|
|
363
|
+
@container (width < 576px) {
|
|
364
|
+
.slider__counts-navigation-button {
|
|
365
|
+
visibility: visible;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
.slider:hover .slider__navigation-button {
|
|
369
|
+
visibility: visible;
|
|
370
|
+
}
|
|
371
|
+
.slider:hover .slider__counts-navigation-button {
|
|
372
|
+
visibility: visible;
|
|
373
|
+
}
|
|
374
|
+
.slider--arrows-only .slider__dots {
|
|
375
|
+
display: none;
|
|
376
|
+
}
|
|
377
|
+
.slider--dots-only .slider__navigation-button {
|
|
378
|
+
display: none;
|
|
379
|
+
}
|
|
380
|
+
.slider--dots-only .slider__dots {
|
|
381
|
+
--slider-dots-size-internal: var(--slider-dots-size, 1rem);
|
|
382
|
+
}
|
|
383
|
+
.slider--dots-only-below .slider__navigation-button {
|
|
384
|
+
display: none;
|
|
385
|
+
}
|
|
386
|
+
.slider--dots-only-below .slider__dots {
|
|
387
|
+
--slider-dots-size-internal: var(--slider-dots-size, 1rem);
|
|
388
|
+
position: static;
|
|
389
|
+
margin-top: 1rem;
|
|
390
|
+
}
|
|
391
|
+
@container (width < 576px) {
|
|
392
|
+
.slider__navigation-button {
|
|
393
|
+
visibility: visible;
|
|
394
|
+
}
|
|
395
|
+
.slider__counts-navigation-button {
|
|
396
|
+
visibility: visible;
|
|
397
|
+
}
|
|
398
|
+
}</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Locale } from '../../core/locale';
|
|
2
|
+
import { type SliderDotsConfig, SliderMode } from './types';
|
|
3
|
+
import { type Snippet } from 'svelte';
|
|
4
|
+
declare class __sveltets_Render<T> {
|
|
5
|
+
props(): {
|
|
6
|
+
items: T[];
|
|
7
|
+
initialIndex: number;
|
|
8
|
+
sliderMode?: SliderMode;
|
|
9
|
+
dotsConfig?: SliderDotsConfig;
|
|
10
|
+
autoSlideMs?: number;
|
|
11
|
+
locale: Locale;
|
|
12
|
+
on?: {
|
|
13
|
+
indexChanged: (index: number) => void;
|
|
14
|
+
} | undefined;
|
|
15
|
+
children: Snippet<[T]>;
|
|
16
|
+
};
|
|
17
|
+
events(): {};
|
|
18
|
+
slots(): {};
|
|
19
|
+
bindings(): "";
|
|
20
|
+
exports(): {};
|
|
21
|
+
}
|
|
22
|
+
interface $$IsomorphicComponent {
|
|
23
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
24
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
25
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
26
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
27
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
28
|
+
}
|
|
29
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
30
|
+
type Cmp<T> = InstanceType<typeof Cmp<T>>;
|
|
31
|
+
export default Cmp;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var SliderMode;
|
|
2
|
+
(function (SliderMode) {
|
|
3
|
+
SliderMode[SliderMode["ArrowsAndDots"] = 0] = "ArrowsAndDots";
|
|
4
|
+
SliderMode[SliderMode["ArrowsOnly"] = 1] = "ArrowsOnly";
|
|
5
|
+
SliderMode[SliderMode["DotsOnly"] = 2] = "DotsOnly";
|
|
6
|
+
SliderMode[SliderMode["DotsOnlyBelow"] = 3] = "DotsOnlyBelow";
|
|
7
|
+
SliderMode[SliderMode["ArrowsWithCounts"] = 4] = "ArrowsWithCounts";
|
|
8
|
+
})(SliderMode || (SliderMode = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/embeddable",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"dev": "vite dev --port 3010",
|
|
11
|
+
"dev": "vite dev --port 3010 --host",
|
|
12
12
|
"build": "svelte-package --tsconfig ./tsconfig.app.json && prettier --write --plugin prettier-plugin-svelte . && eslint --fix .",
|
|
13
13
|
"publish:prod": "npm run build && npm publish --access public --tag latest",
|
|
14
14
|
"version:dev": "node -e \"const fs=require('fs');const pkg=require('./package.json');const base=(pkg.version.includes('-')?pkg.version.split('-')[0]:pkg.version);pkg.version=base+'-'+Date.now();fs.writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\\n');\"",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { Slider, SliderMode } from '../../../ui/slider';
|
|
2
|
-
import MediaViewer from './typed-media-viewer.svelte';
|
|
3
|
-
let { post, buffer, isActive, initialMediaIndex, on } = $props();
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<Slider items={post.media} sliderMode={SliderMode.ArrowsWithCounts} initialIndex={isActive ? initialMediaIndex : 0}>
|
|
7
|
-
{#snippet children(item)}
|
|
8
|
-
<MediaViewer postId={post.id} buffer={buffer} item={item} on={{ playerReachedEnd: on.playerReachedEnd }} />
|
|
9
|
-
{/snippet}
|
|
10
|
-
</Slider>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { IPlayerBuffer } from '../../../ui/player';
|
|
2
|
-
import type { PostViewerModel } from '../types.svelte';
|
|
3
|
-
declare class __sveltets_Render<T extends PostViewerModel> {
|
|
4
|
-
props(): {
|
|
5
|
-
post: PostViewerModel;
|
|
6
|
-
buffer: IPlayerBuffer<T_1>;
|
|
7
|
-
isActive: boolean;
|
|
8
|
-
initialMediaIndex: number;
|
|
9
|
-
on: {
|
|
10
|
-
playerReachedEnd: () => void;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
events(): {};
|
|
14
|
-
slots(): {};
|
|
15
|
-
bindings(): "";
|
|
16
|
-
exports(): {};
|
|
17
|
-
}
|
|
18
|
-
interface $$IsomorphicComponent {
|
|
19
|
-
new <T extends PostViewerModel>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
20
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
21
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
22
|
-
<T extends PostViewerModel>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
23
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
24
|
-
}
|
|
25
|
-
declare const MediaSlider: $$IsomorphicComponent;
|
|
26
|
-
type MediaSlider<T extends PostViewerModel> = InstanceType<typeof MediaSlider<T>>;
|
|
27
|
-
export default MediaSlider;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { Image } from '../../ui/image';
|
|
2
|
-
import { Video } from '../../ui/video';
|
|
3
|
-
let { id, media, autoplay = 'on-appearance', on } = $props();
|
|
4
|
-
$effect(() => {
|
|
5
|
-
on.mediaChanged({
|
|
6
|
-
videoSeekBar: media.type === 'video',
|
|
7
|
-
galleryMode: false
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
{#if media.type === 'video'}
|
|
13
|
-
<Video
|
|
14
|
-
src={media.url}
|
|
15
|
-
poster={media.thumbnailUrl}
|
|
16
|
-
controls={false}
|
|
17
|
-
autoplay={autoplay}
|
|
18
|
-
loop={true}
|
|
19
|
-
id={id}
|
|
20
|
-
hideSpeaker={true}
|
|
21
|
-
on={{
|
|
22
|
-
progress: on?.progress
|
|
23
|
-
}} />
|
|
24
|
-
{:else if media.type === 'image'}
|
|
25
|
-
<Image src={media.url} />
|
|
26
|
-
{/if}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { AdType, type Currency } from '../../core/enums';
|
|
2
|
-
export type PostViewerModel = {
|
|
3
|
-
id: string;
|
|
4
|
-
media: PostViewerMediaModel;
|
|
5
|
-
text: string | null;
|
|
6
|
-
heading: PostViewerHeadingModel | null;
|
|
7
|
-
enableSocialInteractions: boolean;
|
|
8
|
-
products: PostViewerProductCardModel[];
|
|
9
|
-
ads: PostViewerAdCardModel[];
|
|
10
|
-
};
|
|
11
|
-
export type PostViewerMediaModel = PostViewerImageMediaModel | PostViewerVideoMediaModel | {
|
|
12
|
-
type: 'gallery';
|
|
13
|
-
items: Array<PostViewerImageMediaModel | PostViewerVideoMediaModel>;
|
|
14
|
-
isMutable: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type PostViewerImageMediaModel = {
|
|
17
|
-
type: 'image';
|
|
18
|
-
url: string;
|
|
19
|
-
isMutable: false;
|
|
20
|
-
};
|
|
21
|
-
export type PostViewerVideoMediaModel = {
|
|
22
|
-
type: 'video';
|
|
23
|
-
url: string;
|
|
24
|
-
thumbnailUrl: string;
|
|
25
|
-
isMutable: true;
|
|
26
|
-
};
|
|
27
|
-
export type PostViewerHeadingModel = {
|
|
28
|
-
image: string | null;
|
|
29
|
-
name: string;
|
|
30
|
-
displayDate: string;
|
|
31
|
-
viewsCount: number;
|
|
32
|
-
};
|
|
33
|
-
export type PostViewerProductCardModel = {
|
|
34
|
-
id: string;
|
|
35
|
-
title: string;
|
|
36
|
-
shortDescription: string | null;
|
|
37
|
-
link: string | null;
|
|
38
|
-
image: string | null;
|
|
39
|
-
brandName: string | null;
|
|
40
|
-
price: number;
|
|
41
|
-
currency: Currency;
|
|
42
|
-
salePrice: number | null;
|
|
43
|
-
};
|
|
44
|
-
export type PostViewerAdCardModel = {
|
|
45
|
-
id: string;
|
|
46
|
-
type: AdType;
|
|
47
|
-
image: string | null;
|
|
48
|
-
title: string;
|
|
49
|
-
description: string | null;
|
|
50
|
-
price: number | null;
|
|
51
|
-
priceInfoLabel: string | null;
|
|
52
|
-
currency: Currency | null;
|
|
53
|
-
ctaButton: {
|
|
54
|
-
background: string;
|
|
55
|
-
textColor: string;
|
|
56
|
-
text: string;
|
|
57
|
-
url: string;
|
|
58
|
-
border: string;
|
|
59
|
-
} | null;
|
|
60
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { AdType } from '../../core/enums';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Utils } from '../../core/utils';
|
|
2
|
-
export const getPostCoverImage = (post) => {
|
|
3
|
-
switch (post.media.type) {
|
|
4
|
-
case 'image':
|
|
5
|
-
return post.media.url;
|
|
6
|
-
case 'video':
|
|
7
|
-
return post.media.thumbnailUrl;
|
|
8
|
-
case 'gallery':
|
|
9
|
-
return post.media.items[0].type === 'image' ? post.media.items[0].url : post.media.items[0].thumbnailUrl;
|
|
10
|
-
default:
|
|
11
|
-
Utils.assertUnreachable(post.media);
|
|
12
|
-
}
|
|
13
|
-
};
|