@streamscloud/embeddable 3.2.2 → 3.2.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.
Files changed (178) hide show
  1. package/dist/core/enums.d.ts +2 -0
  2. package/dist/core/enums.js +2 -0
  3. package/dist/core/graphql.d.ts +1 -3
  4. package/dist/core/graphql.js +3 -12
  5. package/dist/core/utils/html-helper.d.ts +0 -1
  6. package/dist/core/utils/html-helper.js +0 -4
  7. package/dist/products/price-helper.js +1 -1
  8. package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +1 -1
  9. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
  10. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +2 -3
  11. package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
  12. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +2 -3
  13. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
  14. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +2 -3
  15. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +2 -6
  16. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
  17. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
  18. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +2 -3
  19. package/dist/short-videos/short-video-viewer/description.svelte +0 -5
  20. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
  21. package/dist/short-videos/short-video-viewer/index.d.ts +2 -4
  22. package/dist/short-videos/short-video-viewer/index.js +0 -1
  23. package/dist/short-videos/short-video-viewer/mapper.js +1 -2
  24. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +0 -1
  25. package/dist/short-videos/short-video-viewer/operations.generated.js +0 -1
  26. package/dist/short-videos/short-video-viewer/operations.graphql +0 -1
  27. package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.d.ts → short-video-attachments-localization.svelte.d.ts} +4 -5
  28. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +10 -0
  29. package/dist/short-videos/short-video-viewer/{short-video-details-localization.d.ts → short-video-details-localization.svelte.d.ts} +6 -7
  30. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +10 -0
  31. package/dist/short-videos/short-video-viewer/{short-video-product-localization.d.ts → short-video-product-localization.svelte.d.ts} +1 -2
  32. package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +11 -0
  33. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +13 -0
  34. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +10 -0
  35. package/dist/short-videos/short-video-viewer/types.d.ts +0 -1
  36. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +11 -88
  37. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -5
  38. package/dist/short-videos/short-videos-player/controls.svelte +2 -2
  39. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
  40. package/dist/short-videos/short-videos-player/index.d.ts +14 -51
  41. package/dist/short-videos/short-videos-player/index.js +12 -83
  42. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +8 -0
  43. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +6 -0
  44. package/dist/streams/layout/cmp.layout.svelte.d.ts +2 -4
  45. package/dist/streams/layout/cmp.slot-content.svelte +4 -4
  46. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +1 -2
  47. package/dist/streams/layout/cmp.slot.svelte.d.ts +2 -7
  48. package/dist/streams/layout/component.d.ts +0 -2
  49. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
  50. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +3 -4
  51. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +2 -15
  52. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +3 -7
  53. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +2 -2
  54. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +89 -15
  55. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +4 -5
  56. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +2 -4
  57. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +0 -3
  58. package/dist/streams/layout/element-views/cmp.stream-element.svelte +17 -24
  59. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +3 -4
  60. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +2 -2
  61. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +2 -6
  62. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +0 -2
  63. package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -3
  64. package/dist/streams/layout/element-views/index.d.ts +11 -16
  65. package/dist/streams/layout/element-views/index.js +9 -12
  66. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +9 -0
  67. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +8 -0
  68. package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +8 -0
  69. package/dist/streams/layout/element-views/stream-element-localization.svelte.js +6 -0
  70. package/dist/streams/layout/elements.d.ts +12 -47
  71. package/dist/streams/layout/elements.js +1 -1
  72. package/dist/streams/layout/enums.d.ts +3 -34
  73. package/dist/streams/layout/enums.js +7 -46
  74. package/dist/streams/layout/index.d.ts +10 -3
  75. package/dist/streams/layout/index.js +2 -3
  76. package/dist/streams/layout/layout.d.ts +1 -2
  77. package/dist/streams/layout/models/index.d.ts +1 -1
  78. package/dist/streams/layout/models/mapper.js +1 -2
  79. package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +1 -1
  80. package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -1
  81. package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +1 -1
  82. package/dist/streams/layout/models/stream-layout-product-model.d.ts +2 -1
  83. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +0 -4
  84. package/dist/streams/layout/serializer.d.ts +3 -0
  85. package/dist/streams/layout/serializer.js +6 -0
  86. package/dist/streams/layout/slot.d.ts +0 -2
  87. package/dist/streams/layout/styles-transformer.d.ts +2 -3
  88. package/dist/streams/layout/styles-transformer.js +30 -54
  89. package/dist/streams/layout/styles.d.ts +14 -24
  90. package/dist/streams/layout/type-guards.d.ts +0 -31
  91. package/dist/streams/layout/type-guards.js +1 -13
  92. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +2 -4
  93. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +0 -3
  94. package/dist/streams/stream-page-viewer/index.d.ts +0 -1
  95. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +13 -0
  96. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +10 -0
  97. package/dist/streams/stream-player/cmp.stream-player.svelte +7 -47
  98. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +4 -6
  99. package/dist/streams/stream-player/controls.svelte +3 -46
  100. package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
  101. package/dist/streams/stream-player/index.d.ts +4 -6
  102. package/dist/streams/stream-player/index.js +28 -15
  103. package/dist/streams/stream-player/operations.generated.d.ts +1 -1
  104. package/dist/streams/stream-player/operations.generated.js +3 -5
  105. package/dist/streams/stream-player/operations.graphql +3 -3
  106. package/dist/streams/stream-player/stream-overview.svelte +2 -2
  107. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
  108. package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
  109. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +12 -0
  110. package/dist/streams/stream-player/stream-player-localization.svelte.js +10 -0
  111. package/dist/ui/icon/cmp.icon.svelte +26 -13
  112. package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
  113. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +2 -3
  114. package/dist/ui/line-clamp/index.d.ts +1 -1
  115. package/dist/ui/line-clamp/index.js +1 -1
  116. package/dist/ui/line-clamp/{line-clamp-localization.d.ts → line-clamp-localization.svelte.d.ts} +1 -2
  117. package/dist/ui/line-clamp/line-clamp-localization.svelte.js +15 -0
  118. package/dist/ui/shadow-dom/shadow-host.d.ts +5 -1
  119. package/dist/ui/shadow-dom/shadow-host.js +14 -1
  120. package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
  121. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +2 -3
  122. package/dist/ui/time-ago/index.d.ts +1 -1
  123. package/dist/ui/time-ago/{time-ago-localization.d.ts → time-ago-localization.svelte.d.ts} +1 -2
  124. package/dist/ui/time-ago/time-ago-localization.svelte.js +39 -0
  125. package/dist/ui/video/cmp.video.svelte +18 -42
  126. package/package.json +1 -1
  127. package/dist/core/analytics.profile-id.d.ts +0 -5
  128. package/dist/core/analytics.profile-id.js +0 -17
  129. package/dist/core/document.event-handlers.d.ts +0 -1
  130. package/dist/core/document.event-handlers.js +0 -5
  131. package/dist/core/locale.d.ts +0 -6
  132. package/dist/core/locale.js +0 -24
  133. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +0 -21
  134. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +0 -17
  135. package/dist/short-videos/short-video-viewer/short-video-product-localization.js +0 -13
  136. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +0 -14
  137. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +0 -17
  138. package/dist/short-videos/short-videos-player/operations.generated.d.ts +0 -65
  139. package/dist/short-videos/short-videos-player/operations.generated.js +0 -194
  140. package/dist/short-videos/short-videos-player/operations.graphql +0 -8
  141. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +0 -16
  142. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +0 -13
  143. package/dist/short-videos/short-videos-player/types.d.ts +0 -36
  144. package/dist/short-videos/short-videos-player/types.js +0 -6
  145. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte +0 -16
  146. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte.d.ts +0 -7
  147. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +0 -74
  148. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +0 -11
  149. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte +0 -37
  150. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte.d.ts +0 -7
  151. package/dist/streams/layout/element-views/price-element-view.svelte +0 -168
  152. package/dist/streams/layout/element-views/price-element-view.svelte.d.ts +0 -15
  153. package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +0 -13
  154. package/dist/streams/layout/element-views/price-stream-element-localization.js +0 -21
  155. package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +0 -9
  156. package/dist/streams/layout/element-views/short-video-stream-element-localization.js +0 -7
  157. package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +0 -8
  158. package/dist/streams/layout/element-views/stock-stream-element-localization.js +0 -26
  159. package/dist/streams/layout/element-views/stream-element-localization.d.ts +0 -15
  160. package/dist/streams/layout/element-views/stream-element-localization.js +0 -11
  161. package/dist/streams/layout/serializer.svelte.d.ts +0 -29
  162. package/dist/streams/layout/serializer.svelte.js +0 -93
  163. package/dist/streams/layout/slot-data-ref.d.ts +0 -13
  164. package/dist/streams/layout/slot-data-ref.js +0 -1
  165. package/dist/streams/layout/svg-attributes.d.ts +0 -7
  166. package/dist/streams/layout/svg-attributes.js +0 -8
  167. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +0 -9
  168. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +0 -7
  169. package/dist/streams/stream-player/stream-player-localization.d.ts +0 -26
  170. package/dist/streams/stream-player/stream-player-localization.js +0 -31
  171. package/dist/ui/line-clamp/line-clamp-localization.js +0 -19
  172. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +0 -125
  173. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +0 -9
  174. package/dist/ui/swipe-indicator/index.d.ts +0 -2
  175. package/dist/ui/swipe-indicator/index.js +0 -1
  176. package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +0 -8
  177. package/dist/ui/swipe-indicator/swipe-indicator-localization.js +0 -13
  178. package/dist/ui/time-ago/time-ago-localization.js +0 -55
@@ -1,6 +1,6 @@
1
1
  import { type ShortVideoViewerModel } from '../short-video-viewer';
2
2
  import type { IPlayerBuffer } from '../../ui/player';
3
- import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
3
+ import { ShortVideosPlayerLocalization } from './short-videos-player-localization.svelte.js';
4
4
  import type { ShortVideosPlayerUiManager } from './ui-manager.svelte';
5
5
  type Props = {
6
6
  buffer: IPlayerBuffer<ShortVideoViewerModel>;
@@ -1,38 +1,15 @@
1
- import type { IShortVideosPlayerLocalization } from './short-videos-player-localization';
2
- import { type OpenShortVideosPlayerInit } from './types';
1
+ import type { ShortVideoViewerModel } from '../short-video-viewer';
2
+ import type { PlayerItemsProvider } from '../../ui/player';
3
+ import type { IShortVideosPlayerLocalization } from './short-videos-player-localization.svelte';
3
4
  export type { IShortVideosPlayerLocalization };
4
5
  /**
5
- * Opens the short videos player modal with the specified provider or by fetching videos by IDs.
6
- *
7
- * You can use either a ready-made provider, or simply pass a list of video IDs and a GraphQL endpoint to fetch them.
6
+ * Opens the short videos player modal with the specified provider and optional localization.
8
7
  *
9
8
  * @param init - Configuration options.
9
+ * @param {PlayerItemsProvider<ShortVideoViewerModel>} init.shortVideosProvider - The provider instance supplying short video items to the player.
10
+ * @param {IShortVideosPlayerLocalization} [init.localization] - Optional localization settings for the player UI.
10
11
  *
11
- * @param {PlayerItemsProvider<ShortVideoViewerModel>} [init.shortVideosProvider]
12
- * The provider instance supplying short video items to the player.
13
- * **Use this if you already have your own provider implementation.**
14
- *
15
- * @param {string[]} [init.ids]
16
- * List of short video IDs to display in the player.
17
- * **Use this if you want the player to fetch and show specific videos.**
18
- *
19
- * @param {string} [init.graphqlUrl]
20
- * The GraphQL endpoint to use when fetching videos by IDs.
21
- * **Required if you use `ids`.**
22
- *
23
- * @param {string} [init.initialId]
24
- * The ID of the video that should be shown first.
25
- * **Optional. Only used when using `ids`.**
26
- *
27
- * @param {IShortVideosPlayerLocalization} [init.localization]
28
- * Optional localization settings for the player UI.
29
- *
30
- * @param {object} [init.on]
31
- * Optional event handlers.
32
- * @param {() => void} [init.on.playerClosed]
33
- * Called when the player is closed.
34
- *
35
- * @example <caption>Using a custom provider</caption>
12
+ * @example
36
13
  * ```ts
37
14
  * import { openShortVideosPlayer } from '@streamscloud/embeddable/short-videos-player';
38
15
  *
@@ -44,25 +21,11 @@ export type { IShortVideosPlayerLocalization };
44
21
  * }
45
22
  * });
46
23
  * ```
47
- *
48
- * @example <caption>Using a list of IDs</caption>
49
- * ```ts
50
- * import { openShortVideosPlayer } from '@streamscloud/embeddable/short-videos-player';
51
- *
52
- * openShortVideosPlayer({
53
- * ids: ['id1', 'id2', 'id3'],
54
- * graphqlOrigin: 'https://api.example.com',
55
- * initialId: 'id2',
56
- * localization: {
57
- * next: 'Next',
58
- * previous: 'Previous'
59
- * },
60
- * on: {
61
- * playerClosed: () => {
62
- * console.log('Player was closed');
63
- * }
64
- * }
65
- * });
66
- * ```
67
24
  */
68
- export declare const openShortVideosPlayer: (init: OpenShortVideosPlayerInit) => Promise<void>;
25
+ export declare const openShortVideosPlayer: (init: {
26
+ shortVideosProvider: PlayerItemsProvider<ShortVideoViewerModel>;
27
+ localization?: IShortVideosPlayerLocalization;
28
+ on?: {
29
+ playerClosed?: () => void;
30
+ };
31
+ }) => void;
@@ -1,40 +1,14 @@
1
- import { getLocale } from '../../core/locale';
2
1
  import { ShadowHost } from '../../ui/shadow-dom';
3
2
  import { default as ShortVideosPlayer } from './cmp.short-videos-player.svelte';
4
- import { isIdsInit, isShortVideosProviderInit } from './types';
5
- import { mount, unmount } from 'svelte';
3
+ import { mount } from 'svelte';
6
4
  /**
7
- * Opens the short videos player modal with the specified provider or by fetching videos by IDs.
8
- *
9
- * You can use either a ready-made provider, or simply pass a list of video IDs and a GraphQL endpoint to fetch them.
5
+ * Opens the short videos player modal with the specified provider and optional localization.
10
6
  *
11
7
  * @param init - Configuration options.
8
+ * @param {PlayerItemsProvider<ShortVideoViewerModel>} init.shortVideosProvider - The provider instance supplying short video items to the player.
9
+ * @param {IShortVideosPlayerLocalization} [init.localization] - Optional localization settings for the player UI.
12
10
  *
13
- * @param {PlayerItemsProvider<ShortVideoViewerModel>} [init.shortVideosProvider]
14
- * The provider instance supplying short video items to the player.
15
- * **Use this if you already have your own provider implementation.**
16
- *
17
- * @param {string[]} [init.ids]
18
- * List of short video IDs to display in the player.
19
- * **Use this if you want the player to fetch and show specific videos.**
20
- *
21
- * @param {string} [init.graphqlUrl]
22
- * The GraphQL endpoint to use when fetching videos by IDs.
23
- * **Required if you use `ids`.**
24
- *
25
- * @param {string} [init.initialId]
26
- * The ID of the video that should be shown first.
27
- * **Optional. Only used when using `ids`.**
28
- *
29
- * @param {IShortVideosPlayerLocalization} [init.localization]
30
- * Optional localization settings for the player UI.
31
- *
32
- * @param {object} [init.on]
33
- * Optional event handlers.
34
- * @param {() => void} [init.on.playerClosed]
35
- * Called when the player is closed.
36
- *
37
- * @example <caption>Using a custom provider</caption>
11
+ * @example
38
12
  * ```ts
39
13
  * import { openShortVideosPlayer } from '@streamscloud/embeddable/short-videos-player';
40
14
  *
@@ -46,62 +20,17 @@ import { mount, unmount } from 'svelte';
46
20
  * }
47
21
  * });
48
22
  * ```
49
- *
50
- * @example <caption>Using a list of IDs</caption>
51
- * ```ts
52
- * import { openShortVideosPlayer } from '@streamscloud/embeddable/short-videos-player';
53
- *
54
- * openShortVideosPlayer({
55
- * ids: ['id1', 'id2', 'id3'],
56
- * graphqlOrigin: 'https://api.example.com',
57
- * initialId: 'id2',
58
- * localization: {
59
- * next: 'Next',
60
- * previous: 'Previous'
61
- * },
62
- * on: {
63
- * playerClosed: () => {
64
- * console.log('Player was closed');
65
- * }
66
- * }
67
- * });
68
- * ```
69
23
  */
70
- export const openShortVideosPlayer = async (init) => {
71
- let input = null;
72
- if (isShortVideosProviderInit(init)) {
73
- input = {
74
- type: 'provider',
75
- provider: init.shortVideosProvider
76
- };
77
- }
78
- else if (isIdsInit(init)) {
79
- input = {
80
- type: 'ids',
81
- ids: init.ids,
82
- initialId: init.initialId,
83
- graphqlOrigin: init.graphqlOrigin,
84
- initiator: init.initiator
85
- };
86
- }
87
- else {
88
- input = null;
89
- }
90
- if (!input) {
91
- return;
92
- }
93
- const shadowHost = new ShadowHost();
94
- const mounted = mount(ShortVideosPlayer, {
24
+ export const openShortVideosPlayer = (init) => {
25
+ const { shortVideosProvider, localization } = init;
26
+ const shadowHost = new ShadowHost({ onClosed: () => init.on?.playerClosed?.() });
27
+ mount(ShortVideosPlayer, {
95
28
  target: shadowHost.shadowRoot,
96
29
  props: {
97
- input,
98
- localization: getLocale(init.localization),
30
+ shortVideosProvider,
31
+ localization,
99
32
  on: {
100
- closePlayer: async () => {
101
- if (init.on?.playerClosed) {
102
- init.on.playerClosed();
103
- }
104
- await unmount(mounted);
33
+ closePlayer: () => {
105
34
  shadowHost.remove();
106
35
  }
107
36
  }
@@ -0,0 +1,8 @@
1
+ import type { IShortVideoDetailsLocalization } from '../short-video-viewer';
2
+ export interface IShortVideosPlayerLocalization {
3
+ shortVideoDetailsLocalization?: IShortVideoDetailsLocalization;
4
+ }
5
+ export declare class ShortVideosPlayerLocalization {
6
+ shortVideoDetailsLocalization: IShortVideoDetailsLocalization | undefined;
7
+ constructor(init?: IShortVideosPlayerLocalization);
8
+ }
@@ -0,0 +1,6 @@
1
+ export class ShortVideosPlayerLocalization {
2
+ shortVideoDetailsLocalization = $state(undefined);
3
+ constructor(init) {
4
+ this.shortVideoDetailsLocalization = init?.shortVideoDetailsLocalization || this.shortVideoDetailsLocalization;
5
+ }
6
+ }
@@ -1,9 +1,7 @@
1
- import type { StreamLayoutStyles } from './styles';
1
+ import type { StreamLayout } from './layout';
2
2
  import type { Snippet } from 'svelte';
3
3
  type Props = {
4
- model: {
5
- styles: StreamLayoutStyles | null;
6
- };
4
+ model: StreamLayout;
7
5
  children: Snippet;
8
6
  };
9
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -1,9 +1,9 @@
1
1
  <script lang="ts">import { Utils } from '../../core/utils';
2
- import { StreamElementView } from './element-views';
2
+ import { StreamElement } from './element-views';
3
3
  import { StreamComponentDataType } from './enums';
4
4
  let { model, localization, on } = $props();
5
5
  const component = $derived.by(() => {
6
- return model.components.find((c) => (model.data ? c.dataType === model.data.type : c.dataType === StreamComponentDataType.NoData));
6
+ return model.components.find((c) => { var _a; return c.dataType === ((_a = model.data) === null || _a === void 0 ? void 0 : _a.type); });
7
7
  });
8
8
  const dataIsFilled = $derived.by(() => {
9
9
  if (!model.data) {
@@ -42,9 +42,9 @@ const handleProductClick = (e) => {
42
42
  </script>
43
43
 
44
44
  {#snippet slotContent()}
45
- {#if component && (!model.data || dataIsFilled)}
45
+ {#if component && model.data && dataIsFilled}
46
46
  {#each component.elements as element (element)}
47
- <StreamElementView model={element} data={model.data} localization={localization} on={on} />
47
+ <StreamElement model={element} data={model.data} localization={localization} on={on} />
48
48
  {/each}
49
49
  {/if}
50
50
  {/snippet}
@@ -1,9 +1,8 @@
1
- import type { Locale } from '../../core/locale';
2
1
  import { type IStreamElementLocalization } from './element-views';
3
2
  import type { StreamSlot } from './slot';
4
3
  type Props = {
5
4
  model: StreamSlot;
6
- localization: IStreamElementLocalization | Locale;
5
+ localization?: IStreamElementLocalization;
7
6
  on?: {
8
7
  productClick: (productId: string) => void;
9
8
  progress?: (videoId: string, progress: number) => void;
@@ -1,12 +1,7 @@
1
+ import type { StreamSlot } from './slot';
1
2
  import type { Snippet } from 'svelte';
2
- type LayoutStyles = {
3
- width: number;
4
- height: number;
5
- top: number;
6
- left: number;
7
- };
8
3
  type Props = {
9
- model: LayoutStyles;
4
+ model: StreamSlot;
10
5
  children: Snippet;
11
6
  };
12
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -1,8 +1,6 @@
1
1
  import type { StreamElementModel } from './elements';
2
2
  import { StreamComponentDataType } from './enums';
3
3
  export type StreamComponent = {
4
- $id: string;
5
- name?: string | null;
6
4
  dataType: StreamComponentDataType;
7
5
  elements: StreamElementModel[];
8
6
  };
@@ -1,4 +1,4 @@
1
- <script lang="ts">import {} from './stream-element-localization';
1
+ <script lang="ts">import {} from './stream-element-localization.svelte';
2
2
  import { StreamElementStyleDirection } from '../enums';
3
3
  import { generateContainerStyles } from '../styles-transformer';
4
4
  import { default as StreamElement } from './cmp.stream-element.svelte';
@@ -1,11 +1,10 @@
1
- import type { Locale } from '../../../core/locale';
2
- import { type IStreamElementLocalization } from './stream-element-localization';
1
+ import { type IStreamElementLocalization } from './stream-element-localization.svelte';
3
2
  import type { ContainerStreamElementModel } from '../elements';
4
3
  import type { StreamSlotData } from '../slot-data';
5
4
  type Props = {
6
5
  model: ContainerStreamElementModel;
7
- data: StreamSlotData | null;
8
- localization: IStreamElementLocalization | Locale;
6
+ data: StreamSlotData;
7
+ localization?: IStreamElementLocalization;
9
8
  };
10
9
  declare const Cmp: import("svelte").Component<Props, {}, "">;
11
10
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,21 +1,11 @@
1
1
  <script lang="ts">import { getStringValueByKey } from './data-by-key-accessor';
2
2
  import { generateImageStyles } from '../styles-transformer';
3
- import { default as AnnotationStreamElement } from './cmp.annotation-stream-element.svelte';
4
- let { model, data, annotationView } = $props();
3
+ let { model, data } = $props();
5
4
  const value = $derived(getStringValueByKey(data, model.key));
6
5
  </script>
7
6
 
8
7
  <div class="image-ref-stream-element">
9
8
  <img class="image-ref-stream-element-image" src={value} alt={model.key} style={generateImageStyles(model.styles)} />
10
- {#if model.annotations}
11
- {#each model.annotations as annotationModel (annotationModel)}
12
- {#if annotationView}
13
- {@render annotationView({ model: annotationModel })}
14
- {:else}
15
- <AnnotationStreamElement model={annotationModel} />
16
- {/if}
17
- {/each}
18
- {/if}
19
9
  </div>
20
10
 
21
11
  <style>@keyframes fadeIn {
@@ -36,10 +26,7 @@ const value = $derived(getStringValueByKey(data, model.key));
36
26
  height: 100%;
37
27
  min-height: 100%;
38
28
  max-height: 100%;
39
- position: relative;
40
- }
41
- .image-ref-stream-element :global(svg) {
42
- overflow: visible;
29
+ overflow: hidden;
43
30
  }
44
31
 
45
32
  .image-ref-stream-element-image {
@@ -1,12 +1,8 @@
1
- import type { AnnotationStreamElementModel, ImageRefStreamElementModel } from '../elements';
2
- import type { StreamSlotDataRef } from '../slot-data-ref';
3
- import type { Snippet } from 'svelte';
1
+ import type { ImageRefStreamElementModel } from '../elements';
2
+ import type { StreamSlotData } from '../slot-data';
4
3
  type Props = {
5
4
  model: ImageRefStreamElementModel;
6
- data: StreamSlotDataRef;
7
- annotationView?: Snippet<[{
8
- model: AnnotationStreamElementModel;
9
- }]>;
5
+ data: StreamSlotData;
10
6
  };
11
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
12
8
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,11 +1,11 @@
1
1
  <script lang="ts">import { Image } from '../../../ui/image';
2
- import { ImagesStreamElementMode } from '../enums';
2
+ import { ImagesImagesElementMode } from '../enums';
3
3
  let { model, data } = $props();
4
4
  </script>
5
5
 
6
6
  <div class="images-stream-element">
7
7
  {#if data.length > 0}
8
- {#if model.mode === ImagesStreamElementMode.Single || data.length === 1}
8
+ {#if model.mode === ImagesImagesElementMode.Single || data.length === 1}
9
9
  <Image src={data[0].url} />
10
10
  {:else}
11
11
  need implement multiple images
@@ -1,23 +1,97 @@
1
1
  <script lang="ts">var _a;
2
- import { PriceStreamElementLocalization } from './price-stream-element-localization';
3
- import { default as PriceElementView } from './price-element-view.svelte';
2
+ import { toPriceRepresentation } from '../../../products/price-helper';
3
+ import { PriceStreamElementLocalization } from './price-stream-element-localization.svelte.js';
4
+ import { mapFlexJustifyContent, mapFontFamily, mapFontWeight, transformColorValue, transformFontSizeValue, transformNumericValue } from '../styles-transformer';
4
5
  let { model, data, localization: localizationInit } = $props();
5
6
  const localization = $derived(new PriceStreamElementLocalization(localizationInit));
6
- let baseMaxHeight = $derived(((_a = model.styles) === null || _a === void 0 ? void 0 : _a.height) || 32);
7
- let adjustedHeight = $derived(baseMaxHeight);
7
+ const lineHeight = 1.2;
8
+ const height = $derived(((_a = model.styles) === null || _a === void 0 ? void 0 : _a.height) || 16);
9
+ const currentPrice = $derived.by(() => {
10
+ if (data.price.salePrice) {
11
+ return toPriceRepresentation(data.price.salePrice, data.price.currency, model.includeCurrency || false);
12
+ }
13
+ return toPriceRepresentation(data.price.price, data.price.currency, model.includeCurrency || false);
14
+ });
15
+ const saveValue = $derived.by(() => {
16
+ if (data.price.salePrice) {
17
+ return toPriceRepresentation(data.price.price - data.price.salePrice, data.price.currency, model.includeCurrency || false);
18
+ }
19
+ return 0;
20
+ });
21
+ const containerStyles = $derived.by(() => {
22
+ var _a, _b;
23
+ const values = [
24
+ `font-family: ${mapFontFamily((_a = model.styles) === null || _a === void 0 ? void 0 : _a.fontFamily)};`,
25
+ `justify-content: ${mapFlexJustifyContent((_b = model.styles) === null || _b === void 0 ? void 0 : _b.horizontalAlign)};`,
26
+ `align-items: center;`,
27
+ `height: ${transformNumericValue(height)};`
28
+ ];
29
+ return values.join('');
30
+ });
31
+ const priceCustomStyles = $derived.by(() => {
32
+ var _a, _b, _c;
33
+ const values = [
34
+ `font-size: ${transformFontSizeValue(height / lineHeight)};`,
35
+ `line-height: ${lineHeight};`,
36
+ `font-weight: ${mapFontWeight((_a = model.styles) === null || _a === void 0 ? void 0 : _a.fontWeight)};`,
37
+ `color: ${transformColorValue(data.price.salePrice ? (_b = model.styles) === null || _b === void 0 ? void 0 : _b.salePriceColor : (_c = model.styles) === null || _c === void 0 ? void 0 : _c.regularPriceColor)};`
38
+ ];
39
+ return values.join('');
40
+ });
41
+ const saveValueCustomStyles = $derived.by(() => {
42
+ var _a, _b;
43
+ const values = [
44
+ `margin-top: ${transformNumericValue((height - height / lineHeight) / 2)};`,
45
+ `font-size: ${transformFontSizeValue(height / 4)};`,
46
+ `font-weight: 500;`,
47
+ `padding: ${transformNumericValue(height / 8)} ${transformNumericValue(height / 4)};`,
48
+ `border-radius: ${transformNumericValue(height / 8)};`,
49
+ `background-color: ${transformColorValue((_a = model.styles) === null || _a === void 0 ? void 0 : _a.saveValueBackgroundColor)};`,
50
+ `color: ${transformColorValue((_b = model.styles) === null || _b === void 0 ? void 0 : _b.saveValueColor)};`
51
+ ];
52
+ return values.join('');
53
+ });
54
+ const beforeValueCustomStyles = $derived.by(() => {
55
+ var _a;
56
+ const values = [`font-size: ${transformFontSizeValue(height / 5)};`, `font-weight: 500;`, `color: ${transformColorValue((_a = model.styles) === null || _a === void 0 ? void 0 : _a.beforeValueColor)};`];
57
+ return values.join('');
58
+ });
8
59
  </script>
9
60
 
10
- <div class="price-stream-element">
11
- <PriceElementView maxElementHeight={adjustedHeight} model={model} data={data} localization={localization} />
12
- <PriceElementView
13
- maxElementHeight={baseMaxHeight}
14
- model={model}
15
- data={data}
16
- localization={localization}
17
- on={{ heightAdjusted: (e) => (adjustedHeight = e) }} />
61
+ <div class="price-stream-element" style={containerStyles}>
62
+ <div class="price-stream-element__price" style={priceCustomStyles}>
63
+ {currentPrice}
64
+ </div>
65
+ {#if data.price.salePrice && !model.excludeBeforePrice}
66
+ <div class="price-stream-element__sale-price">
67
+ <div class="price-stream-element__save" style={saveValueCustomStyles}>
68
+ {localization.saveValue(saveValue)}
69
+ </div>
70
+ <div class="price-stream-element__before-price" style={beforeValueCustomStyles}>
71
+ {localization.beforeValue(toPriceRepresentation(data.price.price, data.price.currency, model.includeCurrency || false))}
72
+ </div>
73
+ </div>
74
+ {/if}
18
75
  </div>
19
76
 
20
- <style>.price-stream-element {
21
- position: relative;
22
- width: 100%;
77
+ <style>@keyframes fadeIn {
78
+ 0% {
79
+ opacity: 1;
80
+ }
81
+ 50% {
82
+ opacity: 0.4;
83
+ }
84
+ 100% {
85
+ opacity: 1;
86
+ }
87
+ }
88
+ .price-stream-element {
89
+ display: flex;
90
+ gap: 4cqi;
91
+ }
92
+ .price-stream-element__sale-price {
93
+ display: flex;
94
+ height: 100%;
95
+ flex-direction: column;
96
+ justify-content: space-between;
23
97
  }</style>
@@ -1,11 +1,10 @@
1
- import type { Locale } from '../../../core/locale';
2
- import { type IPriceStreamElementLocalization } from './price-stream-element-localization';
1
+ import { type IPriceStreamElementLocalization } from './price-stream-element-localization.svelte.js';
3
2
  import type { PriceStreamElementModel } from '../elements';
4
- import type { StreamLayoutProductPriceModel } from '../models';
3
+ import type { StreamLayoutProductModel } from '../models';
5
4
  type Props = {
6
5
  model: PriceStreamElementModel;
7
- data: StreamLayoutProductPriceModel;
8
- localization: IPriceStreamElementLocalization | Locale;
6
+ data: StreamLayoutProductModel;
7
+ localization?: IPriceStreamElementLocalization;
9
8
  };
10
9
  declare const Cmp: import("svelte").Component<Props, {}, "">;
11
10
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,8 +1,6 @@
1
1
  <script lang="ts">import { ShortVideoViewer } from '../../../short-videos/short-video-viewer';
2
- import { ShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
3
2
  import { mapToShortVideoViewerModel } from '../models';
4
- let { data, localization: localizationInit, on } = $props();
5
- const localization = $derived(new ShortVideoStreamElementLocalization(localizationInit));
3
+ let { data, on } = $props();
6
4
  </script>
7
5
 
8
- <ShortVideoViewer model={mapToShortVideoViewerModel(data)} autoplay={false} localization={localization.shortVideoViewerLocalization} on={on} />
6
+ <ShortVideoViewer model={mapToShortVideoViewerModel(data)} autoplay={false} on={on} />
@@ -1,9 +1,6 @@
1
- import type { Locale } from '../../../core/locale';
2
- import { type IShortVideoStreamElementLocalization } from './short-video-stream-element-localization';
3
1
  import { type StreamLayoutShortVideoModel } from '../models';
4
2
  type Props = {
5
3
  data: StreamLayoutShortVideoModel;
6
- localization: IShortVideoStreamElementLocalization | Locale;
7
4
  on?: {
8
5
  progress?: (progress: number) => void;
9
6
  };
@@ -1,8 +1,8 @@
1
- <script lang="ts">import { AnnotationStreamElementView, ContainerStreamElementView, ImageRefStreamElementView, ImagesStreamElementView, PriceStreamElementView, ShortVideoStreamElementView, SpacerStreamElementView, StockStreamElementView, TextRefStreamElementView, TextStreamElementView, WebViewStreamElementView } from '.';
2
- import { StreamElementLocalization } from './stream-element-localization';
1
+ <script lang="ts">import { ContainerStreamElement, ImageRefStreamElement, ImagesStreamElement, PriceStreamElement, ShortVideoStreamElement, SpacerStreamElement, TextRefStreamElement, TextStreamElement } from '.';
2
+ import { StreamElementLocalization } from './stream-element-localization.svelte';
3
3
  import { StreamComponentDataType, StreamElementStyleDirection, StreamElementType } from '../enums';
4
- let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizationInit, on } = $props();
5
- const localization = $derived(new StreamElementLocalization(localizationInit));
4
+ let { model, data, constainerDirection = StreamElementStyleDirection.Vertical, localization: localizatoinInit, on } = $props();
5
+ const localization = $derived(new StreamElementLocalization(localizatoinInit));
6
6
  const shortVideoModel = $derived.by(() => {
7
7
  if (!data) {
8
8
  return null;
@@ -41,35 +41,28 @@ const productModel = $derived.by(() => {
41
41
  });
42
42
  </script>
43
43
 
44
- {#if model.type === StreamElementType.Annotation}
45
- <AnnotationStreamElementView model={model} />
46
- {:else if model.type === StreamElementType.Container}
47
- <ContainerStreamElementView model={model} data={data} localization={localizationInit} />
48
- {:else if model.type === StreamElementType.ImageRef && data}
49
- <ImageRefStreamElementView model={model} data={data} />
44
+ {#if model.type === StreamElementType.Container}
45
+ <ContainerStreamElement model={model} data={data} localization={localizatoinInit} />
46
+ {:else if model.type === StreamElementType.Spacer}
47
+ <SpacerStreamElement model={model} parentContainerDirection={constainerDirection} />
48
+ {:else if model.type === StreamElementType.ImageRef}
49
+ <ImageRefStreamElement model={model} data={data} />
50
50
  {:else if model.type === StreamElementType.Images && imagesModel?.length}
51
- <ImagesStreamElementView model={model} data={imagesModel} />
51
+ <ImagesStreamElement model={model} data={imagesModel} />
52
52
  {:else if model.type === StreamElementType.Price && productModel}
53
- <PriceStreamElementView model={model} data={productModel.price} localization={localization.priceElementLocalization} />
53
+ <PriceStreamElement model={model} data={productModel} localization={localization.priceElementLocalization} />
54
54
  {:else if model.type === StreamElementType.ShortVideo && shortVideoModel}
55
- <ShortVideoStreamElementView
55
+ <ShortVideoStreamElement
56
56
  data={shortVideoModel}
57
- localization={localization.shortVideoElementLocalization}
58
57
  on={on
59
58
  ? {
60
- progress: (progress: Number) => {
59
+ progress: (progress: number) => {
61
60
  on.progress?.(shortVideoModel.id, progress);
62
61
  }
63
62
  }
64
63
  : undefined} />
65
- {:else if model.type === StreamElementType.Spacer}
66
- <SpacerStreamElementView model={model} parentContainerDirection={constainerDirection} />
67
- {:else if model.type === StreamElementType.Stock}
68
- <StockStreamElementView model={model} localization={localization.stockElementLocalization} />
69
64
  {:else if model.type === StreamElementType.Text}
70
- <TextStreamElementView model={model} />
71
- {:else if model.type === StreamElementType.TextRef && data}
72
- <TextRefStreamElementView model={model} data={data} />
73
- {:else if model.type === StreamElementType.WebView}
74
- <WebViewStreamElementView model={model} />
65
+ <TextStreamElement model={model} />
66
+ {:else if model.type === StreamElementType.TextRef}
67
+ <TextRefStreamElement model={model} data={data} />
75
68
  {/if}
@@ -1,13 +1,12 @@
1
- import type { Locale } from '../../../core/locale';
2
- import { type IStreamElementLocalization } from './stream-element-localization';
1
+ import { type IStreamElementLocalization } from './stream-element-localization.svelte';
3
2
  import type { StreamElementModel } from '../elements';
4
3
  import { StreamElementStyleDirection } from '../enums';
5
4
  import type { StreamSlotData } from '../slot-data';
6
5
  type Props = {
7
6
  model: StreamElementModel;
8
- data: StreamSlotData | null;
7
+ data: StreamSlotData;
9
8
  constainerDirection?: StreamElementStyleDirection;
10
- localization: IStreamElementLocalization | Locale;
9
+ localization?: IStreamElementLocalization;
11
10
  on?: {
12
11
  progress?: (videoId: string, progress: number) => void;
13
12
  };
@@ -1,8 +1,8 @@
1
1
  import type { TextRefStreamElementModel } from '../elements';
2
- import type { StreamSlotDataRef } from '../slot-data-ref';
2
+ import type { StreamSlotData } from '../slot-data';
3
3
  type Props = {
4
4
  model: TextRefStreamElementModel;
5
- data: StreamSlotDataRef;
5
+ data: StreamSlotData;
6
6
  };
7
7
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
8
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,12 +1,8 @@
1
1
  <script lang="ts">import { LineClamp } from '../../../ui/line-clamp';
2
2
  import { generateTextStyles } from '../styles-transformer';
3
- let { model, placeholder } = $props();
3
+ let { model } = $props();
4
4
  </script>
5
5
 
6
6
  <div class="text-stream-element" style={generateTextStyles(model.styles)}>
7
- {#if model.value}
8
- <LineClamp value={model.value} maxLines={model.styles?.maxLines || 'auto'} />
9
- {:else if placeholder}
10
- {@render placeholder()}
11
- {/if}
7
+ <LineClamp value={model.value} maxLines={model.styles?.maxLines || 'auto'} />
12
8
  </div>