@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.
Files changed (83) hide show
  1. package/dist/content-player/cmp.content-player.svelte +69 -34
  2. package/dist/content-player/content-player-config.svelte.d.ts +8 -17
  3. package/dist/content-player/content-player-config.svelte.js +16 -15
  4. package/dist/content-player/content-player-settings.d.ts +14 -0
  5. package/dist/content-player/content-player-settings.js +14 -0
  6. package/dist/content-player/controls-and-attachments.svelte +9 -4
  7. package/dist/content-player/header.svelte +1 -1
  8. package/dist/content-player/index.d.ts +1 -1
  9. package/dist/core/analytics.profile-id.js +27 -1
  10. package/dist/core/utils/html-helper.d.ts +1 -0
  11. package/dist/core/utils/html-helper.js +3 -0
  12. package/dist/media-center/media-center/cmp.media-center.svelte +32 -24
  13. package/dist/media-center/media-center/discover-panel.svelte +1 -1
  14. package/dist/posts/attachments/cmp.attachments.svelte +7 -6
  15. package/dist/posts/attachments/cmp.attachments.svelte.d.ts +2 -2
  16. package/dist/posts/controls/cmp.controls.svelte +2 -2
  17. package/dist/posts/controls/cmp.controls.svelte.d.ts +2 -2
  18. package/dist/posts/index.d.ts +1 -0
  19. package/dist/posts/model/index.d.ts +3 -1
  20. package/dist/posts/model/index.js +2 -1
  21. package/dist/posts/model/post-media-model.svelte.d.ts +20 -0
  22. package/dist/posts/model/post-media-model.svelte.js +16 -0
  23. package/dist/posts/model/post-model.d.ts +25 -0
  24. package/dist/posts/model/post-model.js +28 -0
  25. package/dist/posts/model/types.d.ts +53 -9
  26. package/dist/posts/model/types.js +1 -1
  27. package/dist/posts/model/utils.d.ts +4 -0
  28. package/dist/posts/model/utils.js +7 -0
  29. package/dist/posts/post-viewer/attachments-horizontal.svelte +7 -2
  30. package/dist/posts/post-viewer/attachments-horizontal.svelte.d.ts +2 -2
  31. package/dist/posts/post-viewer/cmp.post-viewer.svelte +27 -50
  32. package/dist/posts/post-viewer/cmp.post-viewer.svelte.d.ts +2 -2
  33. package/dist/posts/post-viewer/heading.svelte +2 -1
  34. package/dist/posts/post-viewer/heading.svelte.d.ts +2 -2
  35. package/dist/posts/post-viewer/index.d.ts +1 -3
  36. package/dist/posts/post-viewer/index.js +1 -2
  37. package/dist/posts/post-viewer/mapper.d.ts +2 -2
  38. package/dist/posts/post-viewer/mapper.js +23 -27
  39. package/dist/posts/post-viewer/media/post-media.svelte +64 -0
  40. package/dist/posts/post-viewer/{post-media.svelte.d.ts → media/post-media.svelte.d.ts} +4 -6
  41. package/dist/posts/post-viewer/post-texts.svelte +101 -0
  42. package/dist/posts/post-viewer/post-texts.svelte.d.ts +11 -0
  43. package/dist/posts/post-viewer/post-viewer-localization.d.ts +1 -0
  44. package/dist/posts/post-viewer/post-viewer-localization.js +4 -1
  45. package/dist/posts/posts-player/index.d.ts +2 -3
  46. package/dist/posts/posts-player/index.js +0 -1
  47. package/dist/posts/posts-player/posts-player-view.svelte +3 -2
  48. package/dist/posts/posts-player/types.d.ts +5 -4
  49. package/dist/short-videos/short-videos-player/index.d.ts +3 -4
  50. package/dist/short-videos/short-videos-player/index.js +0 -1
  51. package/dist/short-videos/short-videos-player/mapper.js +2 -2
  52. package/dist/short-videos/short-videos-player/short-videos-player-view.svelte +3 -2
  53. package/dist/short-videos/short-videos-player/types.d.ts +5 -4
  54. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +4 -3
  55. package/dist/streams/layout/models/index.d.ts +1 -1
  56. package/dist/streams/layout/models/index.js +1 -1
  57. package/dist/streams/layout/models/mapper.d.ts +2 -2
  58. package/dist/streams/layout/models/mapper.js +10 -9
  59. package/dist/streams/stream-player/index.d.ts +3 -4
  60. package/dist/streams/stream-player/stream-player-view.svelte +4 -3
  61. package/dist/streams/stream-player/types.d.ts +3 -2
  62. package/dist/ui/line-clamp/cmp.line-clamp.svelte +1 -0
  63. package/dist/ui/player-slider/cmp.player-slider.svelte +44 -7
  64. package/dist/ui/player-slider/cmp.player-slider.svelte.d.ts +2 -2
  65. package/dist/ui/player-slider/player-buffer.svelte.d.ts +4 -3
  66. package/dist/ui/player-slider/player-buffer.svelte.js +9 -3
  67. package/dist/ui/player-slider/types.d.ts +5 -2
  68. package/dist/ui/slider/cmp.slider.svelte +398 -0
  69. package/dist/ui/slider/cmp.slider.svelte.d.ts +31 -0
  70. package/dist/ui/slider/index.d.ts +2 -0
  71. package/dist/ui/slider/index.js +2 -0
  72. package/dist/ui/slider/slider-localization.d.ts +5 -0
  73. package/dist/ui/slider/slider-localization.js +13 -0
  74. package/dist/ui/slider/types.d.ts +11 -0
  75. package/dist/ui/slider/types.js +8 -0
  76. package/package.json +2 -2
  77. package/dist/posts/post-viewer/media/media-slider.svelte +0 -10
  78. package/dist/posts/post-viewer/media/media-slider.svelte.d.ts +0 -27
  79. package/dist/posts/post-viewer/post-media.svelte +0 -26
  80. package/dist/posts/post-viewer/types.d.ts +0 -60
  81. package/dist/posts/post-viewer/types.js +0 -1
  82. package/dist/posts/post-viewer/utils.d.ts +0 -2
  83. package/dist/posts/post-viewer/utils.js +0 -13
@@ -1,9 +1,11 @@
1
1
  import {} from '../../core/locale';
2
2
  export class PostViewerLocalization {
3
3
  viewsCount;
4
+ readMore;
4
5
  locale;
5
6
  constructor(locale) {
6
7
  this.viewsCount = loc.viewsCount[locale];
8
+ this.readMore = loc.readMore[locale];
7
9
  this.locale = locale;
8
10
  }
9
11
  }
@@ -11,5 +13,6 @@ const loc = {
11
13
  viewsCount: {
12
14
  en: (count) => (count === 1 ? '1 view' : `${count} views`),
13
15
  no: (count) => (count === 1 ? '1 visning' : `${count} visninger`)
14
- }
16
+ },
17
+ readMore: { en: 'Read more', no: 'Les mer' }
15
18
  };
@@ -1,7 +1,6 @@
1
- import type { ContentPlayerSettings } from '../../content-player';
2
1
  import type { IPostSocialInteractionsHandler } from '../social-interactions';
3
2
  import type { IPlayerItemsProvider } from '../../ui/player-slider';
4
- import { type IPostAnalyticsHandler, type PostPlayerModel } from './types';
3
+ import type { IPostAnalyticsHandler, PostPlayerModel, PostPlayerSettings } from './types';
5
4
  export { type PostPlayerModel };
6
5
  export type { IPlayerItemsProvider, IPostAnalyticsHandler };
7
6
  /**
@@ -67,7 +66,7 @@ export declare function openPostsPlayer(init: {
67
66
  postsProvider: IPlayerItemsProvider<PostPlayerModel>;
68
67
  analyticsHandler?: IPostAnalyticsHandler;
69
68
  socialInteractionsHandler?: IPostSocialInteractionsHandler;
70
- playerSettings?: ContentPlayerSettings;
69
+ playerSettings?: PostPlayerSettings;
71
70
  on?: {
72
71
  playerClosed?: () => void;
73
72
  };
@@ -1,6 +1,5 @@
1
1
  import { ModalShadowHost } from '../../ui/shadow-dom';
2
2
  import { default as PostPlayerView } from './posts-player-view.svelte';
3
- import {} from './types';
4
3
  import { mount, unmount } from 'svelte';
5
4
  export {};
6
5
  /**
@@ -8,8 +8,9 @@
8
8
  });
9
9
  };
10
10
  import { ContentPlayer, ContentPlayerConfig } from '../../content-player';
11
+ import { ContentPlayerSettings } from '../../content-player/content-player-settings';
11
12
  import { preloadImage } from '../../core/image-preloader';
12
- import { getPostCoverImage } from '../post-viewer';
13
+ import { getPostCoverImage } from '../model';
13
14
  import { PlayerBuffer } from '../../ui/player-slider';
14
15
  import { untrack } from 'svelte';
15
16
  let { dataProvider, socialInteractionsHandler, playerSettings, analyticsHandler, on } = $props();
@@ -38,7 +39,7 @@ const contentPlayerConfig = new ContentPlayerConfig({
38
39
  postModelFromCurrentItem: (item) => item
39
40
  },
40
41
  socialInteractionsHandler,
41
- settings: playerSettings,
42
+ settings: new ContentPlayerSettings(playerSettings),
42
43
  callbacks: {
43
44
  close: on === null || on === void 0 ? void 0 : on.playerClosed
44
45
  },
@@ -1,20 +1,21 @@
1
- import type { ContentPlayerSettings } from '../../content-player';
2
- import type { PostViewerModel } from '../post-viewer';
1
+ import type { IContentPlayerSettingsInitializer } from '../../content-player/content-player-settings';
2
+ import type { IPostModel } from '..';
3
3
  import type { IPostSocialInteractionsHandler } from '../social-interactions';
4
4
  import type { IPlayerItemsProvider } from '../../ui/player-slider';
5
5
  export interface IPostAnalyticsHandler {
6
6
  setOrganizationId: (organizationId: string) => void;
7
7
  trackPostOpened: (postId: string, ownerId: string) => void;
8
8
  }
9
- export type PostPlayerModel = PostViewerModel & {
9
+ export type PostPlayerModel = IPostModel & {
10
10
  analyticsOrganizationId: string | null;
11
11
  };
12
12
  export type PostPlayerProps = {
13
13
  dataProvider: IPlayerItemsProvider<PostPlayerModel>;
14
14
  socialInteractionsHandler?: IPostSocialInteractionsHandler;
15
15
  analyticsHandler?: IPostAnalyticsHandler;
16
- playerSettings?: ContentPlayerSettings;
16
+ playerSettings?: PostPlayerSettings;
17
17
  on?: {
18
18
  playerClosed?: () => void;
19
19
  };
20
20
  };
21
+ export type PostPlayerSettings = Pick<IContentPlayerSettingsInitializer, 'disableBackground' | 'hideCloseButton' | 'locale' | 'showStreamsCloudWatermark'>;
@@ -1,10 +1,9 @@
1
- import type { ContentPlayerSettings } from '../../content-player';
2
1
  import { type IMediaCenterConfig } from '../../media-center/config/types';
3
2
  import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
4
3
  import type { IPlayerItemsProvider } from '../../ui/player-slider';
5
4
  import { default as ShortVideosPlayer } from './cmp.short-videos-player.svelte';
6
5
  import { mapToShortVideoPlayerModel } from './mapper';
7
- import { type IShortVideoAnalyticsHandler, type ShortVideoPlayerModel } from './types';
6
+ import type { IShortVideoAnalyticsHandler, ShortVideoPlayerModel, ShortVideoPlayerSettings } from './types';
8
7
  export { ShortVideosPlayer, type ShortVideoPlayerModel };
9
8
  export type { IMediaCenterConfig, IPlayerItemsProvider, IShortVideoAnalyticsHandler };
10
9
  export { mapToShortVideoPlayerModel };
@@ -111,7 +110,7 @@ export declare function openShortVideosPlayer(init: {
111
110
  mediaCenterConfig?: IMediaCenterConfig;
112
111
  analyticsHandler?: IShortVideoAnalyticsHandler;
113
112
  socialInteractionsHandler?: IPostSocialInteractionsHandler;
114
- playerSettings?: ContentPlayerSettings;
113
+ playerSettings?: ShortVideoPlayerSettings;
115
114
  on?: {
116
115
  playerClosed?: () => void;
117
116
  videoActivated?: (id: string) => void;
@@ -123,7 +122,7 @@ export declare function openShortVideosPlayer(init: {
123
122
  graphqlOrigin?: string;
124
123
  initialId?: string;
125
124
  mediaPageId?: string;
126
- playerSettings?: ContentPlayerSettings;
125
+ playerSettings?: ShortVideoPlayerSettings;
127
126
  on?: {
128
127
  playerClosed?: () => void;
129
128
  videoActivated?: (id: string) => void;
@@ -7,7 +7,6 @@ import { default as ShortVideosPlayer } from './cmp.short-videos-player.svelte';
7
7
  import { InternalShortVideoAnalyticsHandler } from './internal-short-video-analytics-handler';
8
8
  import { InternalShortVideoPlayerProvider } from './internal-short-video-player-provider';
9
9
  import { mapToShortVideoPlayerModel } from './mapper';
10
- import {} from './types';
11
10
  import { mount, unmount } from 'svelte';
12
11
  export { ShortVideosPlayer };
13
12
  export { mapToShortVideoPlayerModel };
@@ -1,7 +1,7 @@
1
1
  import { ProfileType } from '../../core/enums';
2
- import { mapToPostViewerModel } from '../../posts/post-viewer';
2
+ import { mapToPostModel } from '../../posts/post-viewer';
3
3
  export const mapToShortVideoPlayerModel = (payload) => {
4
- const viewerModel = mapToPostViewerModel(payload);
4
+ const viewerModel = mapToPostModel(payload);
5
5
  return {
6
6
  ...viewerModel,
7
7
  analyticsOrganizationId: payload.ownerProfile.type === ProfileType.Organization ? payload.ownerProfile.id : null
@@ -8,8 +8,9 @@
8
8
  });
9
9
  };
10
10
  import { ContentPlayer, ContentPlayerConfig } from '../../content-player';
11
+ import { ContentPlayerSettings } from '../../content-player/content-player-settings';
11
12
  import { preloadImage } from '../../core/image-preloader';
12
- import { getPostCoverImage } from '../../posts/post-viewer';
13
+ import { getPostCoverImage } from '../../posts/model';
13
14
  import { PlayerBuffer } from '../../ui/player-slider';
14
15
  import { InternalShortVideoPlayerProvider } from './internal-short-video-player-provider';
15
16
  import { untrack } from 'svelte';
@@ -44,7 +45,7 @@ const contentPlayerConfig = new ContentPlayerConfig({
44
45
  },
45
46
  socialInteractionsHandler,
46
47
  mediaCenterData,
47
- settings: playerSettings,
48
+ settings: new ContentPlayerSettings(playerSettings),
48
49
  callbacks: {
49
50
  close: on === null || on === void 0 ? void 0 : on.playerClosed,
50
51
  productClick: (id, videoId) => {
@@ -1,5 +1,5 @@
1
- import type { ContentPlayerSettings } from '../../content-player';
2
- import type { PostViewerModel } from '../../posts/post-viewer';
1
+ import type { IContentPlayerSettingsInitializer } from '../../content-player/content-player-settings';
2
+ import type { IPostModel } from '../../posts';
3
3
  import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
4
4
  import type { IPlayerItemsProvider } from '../../ui/player-slider';
5
5
  export interface IShortVideoAnalyticsHandler {
@@ -10,16 +10,17 @@ export interface IShortVideoAnalyticsHandler {
10
10
  trackAdClick: (adId: string) => void;
11
11
  trackAdImpression: (adId: string) => void;
12
12
  }
13
- export type ShortVideoPlayerModel = PostViewerModel & {
13
+ export type ShortVideoPlayerModel = IPostModel & {
14
14
  analyticsOrganizationId: string | null;
15
15
  };
16
16
  export type ShortVideoPlayerProps = {
17
17
  dataProvider: IPlayerItemsProvider<ShortVideoPlayerModel>;
18
18
  socialInteractionsHandler?: IPostSocialInteractionsHandler;
19
19
  analyticsHandler?: IShortVideoAnalyticsHandler;
20
- playerSettings?: ContentPlayerSettings;
20
+ playerSettings?: ShortVideoPlayerSettings;
21
21
  on?: {
22
22
  playerClosed?: () => void;
23
23
  videoActivated?: (id: string) => void;
24
24
  };
25
25
  };
26
+ export type ShortVideoPlayerSettings = Pick<IContentPlayerSettingsInitializer, 'disableBackground' | 'hideCloseButton' | 'locale' | 'showStreamsCloudWatermark'>;
@@ -1,8 +1,9 @@
1
- <script lang="ts">import { PostViewer } from '../../../posts/post-viewer';
1
+ <script lang="ts">import { PostModel } from '../../../posts/model';
2
+ import { PostViewer } from '../../../posts/post-viewer';
2
3
  import { ShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
3
- import { mapToPostViewerModel } from '../models';
4
+ import { mapToPostModel } from '../models';
4
5
  let { data, locale, on } = $props();
5
6
  const localization = $derived(new ShortVideoStreamElementLocalization(locale));
6
7
  </script>
7
8
 
8
- <PostViewer model={mapToPostViewerModel(data)} autoplay={false} enableControls={false} locale={localization.shortVideoViewerLocale} on={on} />
9
+ <PostViewer model={new PostModel(mapToPostModel(data))} autoplay={false} enableControls={false} locale={localization.shortVideoViewerLocale} on={on} />
@@ -1,4 +1,4 @@
1
- export { mapToPostViewerModel } from './mapper';
1
+ export { mapToPostModel } from './mapper';
2
2
  export type { StreamLayoutBlobModel } from './stream-layout-blob-model';
3
3
  export type { StreamLayoutMediaItemModel } from './stream-layout-media-item-model';
4
4
  export type { StreamLayoutPostHeaderModel } from './stream-layout-post-header-model';
@@ -1 +1 @@
1
- export { mapToPostViewerModel } from './mapper';
1
+ export { mapToPostModel } from './mapper';
@@ -1,3 +1,3 @@
1
- import type { PostViewerModel } from '../../../posts/post-viewer';
1
+ import { type IPostModel } from '../../../posts/model';
2
2
  import type { StreamLayoutShortVideoModel } from '../models/stream-layout-short-video-model';
3
- export declare const mapToPostViewerModel: (model: StreamLayoutShortVideoModel) => PostViewerModel;
3
+ export declare const mapToPostModel: (model: StreamLayoutShortVideoModel) => IPostModel;
@@ -1,15 +1,16 @@
1
1
  import { MediaType } from '../../../core/enums';
2
- export const mapToPostViewerModel = (model) => {
2
+ import {} from '../../../posts/model';
3
+ export const mapToPostModel = (model) => {
3
4
  return {
4
5
  id: model.id,
5
- media: model.media.type === MediaType.Image
6
- ? { type: 'image', url: model.media.url, isMutable: false }
7
- : {
8
- type: 'video',
9
- url: model.media.url,
10
- thumbnailUrl: model.media.thumbnailUrl,
11
- isMutable: true
12
- },
6
+ media: [
7
+ model.media.type === MediaType.Image
8
+ ? { isImage: true, url: model.media.url }
9
+ : { isImage: false, url: model.media.url, thumbnailUrl: model.media.thumbnailUrl }
10
+ ],
11
+ mediaFit: 'cover',
12
+ kicker: null,
13
+ title: null,
13
14
  text: model.text,
14
15
  heading: model.header && {
15
16
  image: model.header.sourceImage,
@@ -1,9 +1,8 @@
1
- import type { ContentPlayerSettings } from '../../content-player';
2
1
  import { type IMediaCenterConfig } from '../../media-center/config/types';
3
2
  import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
4
3
  import type { StreamPageViewerModel } from '../stream-page-viewer/types';
5
4
  import { mapToStreamPlayerModel } from './mapper';
6
- import type { IStreamAnalyticsHandler, IStreamPlayerDataProvider, StreamAmplificationParameters, StreamPlayerModel } from './types';
5
+ import type { IStreamAnalyticsHandler, IStreamPlayerDataProvider, StreamAmplificationParameters, StreamPlayerModel, StreamPlayerSettings } from './types';
7
6
  export { type StreamPlayerModel, type StreamPageViewerModel, mapToStreamPlayerModel };
8
7
  export type { IStreamPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterConfig };
9
8
  /**
@@ -117,7 +116,7 @@ export declare function openStreamPlayer(init: {
117
116
  postSocialInteractionsHandler?: IPostSocialInteractionsHandler;
118
117
  analyticsHandler?: IStreamAnalyticsHandler;
119
118
  amplificationParameters?: StreamAmplificationParameters;
120
- playerSettings?: ContentPlayerSettings;
119
+ playerSettings?: StreamPlayerSettings;
121
120
  on?: {
122
121
  streamActivated?: (data: {
123
122
  title: string;
@@ -132,7 +131,7 @@ export declare function openStreamPlayer(init: {
132
131
  graphqlOrigin?: string;
133
132
  mediaPageId?: string;
134
133
  amplificationParameters?: StreamAmplificationParameters;
135
- playerSettings?: ContentPlayerSettings;
134
+ playerSettings?: StreamPlayerSettings;
136
135
  on?: {
137
136
  streamActivated?: (data: {
138
137
  title: string;
@@ -9,9 +9,10 @@
9
9
  };
10
10
  var _a;
11
11
  import { ContentPlayer, ContentPlayerConfig } from '../../content-player';
12
+ import { ContentPlayerSettings } from '../../content-player/content-player-settings';
12
13
  import { preloadImage } from '../../core/image-preloader';
13
14
  import { toastrWarning } from '../../core/toastr';
14
- import { mapToPostViewerModel } from '../layout/models';
15
+ import { mapToPostModel } from '../layout/models';
15
16
  import { StreamPageViewer } from '../stream-page-viewer';
16
17
  import { default as Overview } from './stream-overview.svelte';
17
18
  import { StreamPlayerBuffer } from './stream-player-buffer.svelte';
@@ -89,14 +90,14 @@ const contentPlayerConfig = new ContentPlayerConfig({
89
90
  mappers: {
90
91
  postModelFromCurrentItem: (item) => {
91
92
  if (item.type === 'short-video' && item.shortVideo) {
92
- return mapToPostViewerModel(item.shortVideo);
93
+ return mapToPostModel(item.shortVideo);
93
94
  }
94
95
  return null;
95
96
  }
96
97
  },
97
98
  socialInteractionsHandler: postSocialInteractionsHandler,
98
99
  mediaCenterData,
99
- settings: playerSettings,
100
+ settings: new ContentPlayerSettings(playerSettings),
100
101
  callbacks: {
101
102
  close: on === null || on === void 0 ? void 0 : on.playerClosed,
102
103
  videoProgress: (pageId, videoId, progress) => {
@@ -1,4 +1,4 @@
1
- import type { ContentPlayerSettings } from '../../content-player';
1
+ import type { IContentPlayerSettingsInitializer } from '../../content-player/content-player-settings';
2
2
  import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
3
3
  import type { StreamPageViewerModel } from '../stream-page-viewer';
4
4
  export type StreamPlayerModel = {
@@ -21,7 +21,7 @@ export type StreamPlayerProps = {
21
21
  postSocialInteractionsHandler?: IPostSocialInteractionsHandler;
22
22
  analyticsHandler?: IStreamAnalyticsHandler;
23
23
  amplificationParameters?: StreamAmplificationParameters;
24
- playerSettings?: ContentPlayerSettings;
24
+ playerSettings?: StreamPlayerSettings;
25
25
  on?: {
26
26
  streamActivated?: (data: {
27
27
  title: string;
@@ -30,6 +30,7 @@ export type StreamPlayerProps = {
30
30
  playerClosed?: () => void;
31
31
  };
32
32
  };
33
+ export type StreamPlayerSettings = Pick<IContentPlayerSettingsInitializer, 'disableBackground' | 'hideCloseButton' | 'locale' | 'showStreamsCloudWatermark'>;
33
34
  export type StreamAmplificationParameters = {
34
35
  campaignId: string;
35
36
  campaignName: string;
@@ -93,6 +93,7 @@ const toggleShowMore = () => {
93
93
  .line-clamp__show-more-button {
94
94
  font-size: 0.9em;
95
95
  font-style: italic;
96
+ pointer-events: auto;
96
97
  }
97
98
  .line-clamp__show-more-button--inline {
98
99
  position: absolute;
@@ -52,26 +52,63 @@ const notifyOnItemChanged = () => {
52
52
  }
53
53
  };
54
54
  onMount(() => {
55
+ let touchStartX = 0;
55
56
  let touchStartY = 0;
56
57
  let touchMoveY = 0;
57
58
  let touchStartTime = 0;
59
+ let isVerticalSwipe = false;
58
60
  window.addEventListener(`keydown`, onKeyPress);
59
61
  slidesRef.addEventListener('touchstart', (e) => {
60
62
  // The movement gets all janky if there's a transition on the elements.
61
63
  slidesRef.classList.toggle('animate', false);
64
+ touchStartX = e.changedTouches[0].screenX;
62
65
  touchStartY = e.changedTouches[0].screenY;
63
66
  touchStartTime = Date.now();
67
+ isVerticalSwipe = false;
64
68
  });
65
69
  slidesRef.addEventListener('touchmove', (e) => {
66
- e.preventDefault();
67
- const newPosition = e.changedTouches[0].screenY;
68
- const diff = newPosition - touchStartY;
69
- if ((diff > 0 && buffer.canLoadPrevious) || (diff < 0 && buffer.canLoadNext)) {
70
- touchMoveY = diff;
71
- swipeTransition = diff + actualTransition;
70
+ if (isVerticalSwipe) {
71
+ // Already determined this is a vertical swipe
72
+ e.preventDefault();
73
+ e.stopPropagation();
74
+ }
75
+ const touchCurrentX = e.changedTouches[0].screenX;
76
+ const touchCurrentY = e.changedTouches[0].screenY;
77
+ const diffX = Math.abs(touchCurrentX - touchStartX);
78
+ const diffY = Math.abs(touchCurrentY - touchStartY);
79
+ // Determine direction on first significant movement
80
+ if (diffX > 10 || diffY > 10) {
81
+ if (diffY > diffX) {
82
+ // Vertical swipe - handle it
83
+ isVerticalSwipe = true;
84
+ e.preventDefault();
85
+ e.stopPropagation();
86
+ const newPosition = touchCurrentY;
87
+ const diff = newPosition - touchStartY;
88
+ if ((diff > 0 && buffer.canLoadPrevious) || (diff < 0 && buffer.canLoadNext)) {
89
+ touchMoveY = diff;
90
+ swipeTransition = diff + actualTransition;
91
+ }
92
+ }
93
+ else {
94
+ // Horizontal swipe - allow child to handle
95
+ isVerticalSwipe = false;
96
+ return;
97
+ }
72
98
  }
73
99
  });
74
- slidesRef.addEventListener('touchend', () => {
100
+ slidesRef.addEventListener('touchend', (e) => {
101
+ const touchEndX = e.changedTouches[0].screenX;
102
+ const touchEndY = e.changedTouches[0].screenY;
103
+ const diffX = Math.abs(touchEndX - touchStartX);
104
+ const diffY = Math.abs(touchEndY - touchStartY);
105
+ // Check if this is a vertical swipe
106
+ if (diffX > diffY) {
107
+ // Horizontal swipe - don't handle and don't block
108
+ return;
109
+ }
110
+ // This is a vertical swipe - block propagation
111
+ e.stopPropagation();
75
112
  slidesRef.classList.toggle('animate', true);
76
113
  const reset = () => {
77
114
  swipeTransition = 0;
@@ -1,4 +1,4 @@
1
- import type { IPlayerBuffer, PlayerSliderCallbacks } from './types';
1
+ import type { IPlayerBuffer, PlayerSliderCallbacks, TExtended } from './types';
2
2
  import { type Snippet } from 'svelte';
3
3
  declare class __sveltets_Render<T extends {
4
4
  id: string;
@@ -7,7 +7,7 @@ declare class __sveltets_Render<T extends {
7
7
  buffer: IPlayerBuffer<T>;
8
8
  on?: PlayerSliderCallbacks<T> | undefined;
9
9
  children: Snippet<[{
10
- item: T;
10
+ item: TExtended<T>;
11
11
  active?: boolean;
12
12
  }]>;
13
13
  };
@@ -1,10 +1,10 @@
1
- import type { IPlayerBuffer } from './types';
1
+ import type { IPlayerBuffer, TExtended } from './types';
2
2
  export declare class PlayerBuffer<T extends {
3
3
  id: string;
4
4
  }> implements IPlayerBuffer<T> {
5
- readonly loaded: T[];
5
+ readonly loaded: TExtended<T>[];
6
6
  readonly currentIndex: number;
7
- readonly current: T | null;
7
+ readonly current: TExtended<T> | null;
8
8
  readonly canLoadNext: boolean;
9
9
  readonly canLoadPrevious: boolean;
10
10
  readonly navigationDisabled: boolean;
@@ -25,6 +25,7 @@ export interface IPlayerItemsProvider<T> {
25
25
  initialData: {
26
26
  prefetchedItems: T[];
27
27
  startIndex: number;
28
+ startMediaIndex?: number;
28
29
  };
29
30
  loadMore(): Promise<T[]>;
30
31
  }
@@ -13,10 +13,16 @@ export class PlayerBuffer {
13
13
  isLoading = false;
14
14
  constructor(provider, on) {
15
15
  this.loadMoreFn = provider.loadMore;
16
- this._loaded = provider.initialData.prefetchedItems;
17
- this._currentIndex = this._loaded.length
16
+ this._loaded =
17
+ provider.initialData.startIndex >= 0 && provider.initialData.startMediaIndex && provider.initialData.startMediaIndex > 0
18
+ ? provider.initialData.prefetchedItems.map((i, index) => ({
19
+ ...i,
20
+ mediaIndex: index === provider.initialData.startIndex ? provider.initialData.startMediaIndex : 0
21
+ }))
22
+ : provider.initialData.prefetchedItems;
23
+ this._currentIndex = provider.initialData.prefetchedItems.length
18
24
  ? provider.initialData.startIndex >= this._loaded.length
19
- ? this._loaded.length - 1
25
+ ? provider.initialData.prefetchedItems.length - 1
20
26
  : provider.initialData.startIndex
21
27
  : -1;
22
28
  this.warmUpBuffer(on?.preloaded);
@@ -1,9 +1,9 @@
1
1
  export interface IPlayerBuffer<T extends {
2
2
  id: string;
3
3
  }> {
4
- readonly current: T | null;
4
+ readonly current: TExtended<T> | null;
5
5
  readonly currentIndex: number;
6
- readonly loaded: T[];
6
+ readonly loaded: TExtended<T>[];
7
7
  readonly canLoadNext: boolean;
8
8
  readonly canLoadPrevious: boolean;
9
9
  readonly navigationDisabled: boolean;
@@ -12,6 +12,9 @@ export interface IPlayerBuffer<T extends {
12
12
  loadPrevious: () => void;
13
13
  reset: () => void;
14
14
  }
15
+ export type TExtended<T> = T & {
16
+ mediaIndex?: number;
17
+ };
15
18
  export type PlayerSliderCallbacks<T> = {
16
19
  itemPreActivated?: (e: T) => void;
17
20
  itemPreDeactivated?: (e: {