@streamscloud/embeddable 3.2.4 → 3.2.6

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 (179) hide show
  1. package/dist/core/analytics.profile-id.d.ts +5 -0
  2. package/dist/core/analytics.profile-id.js +17 -0
  3. package/dist/core/document.event-handlers.d.ts +1 -0
  4. package/dist/core/document.event-handlers.js +5 -0
  5. package/dist/core/enums.d.ts +0 -2
  6. package/dist/core/enums.js +0 -2
  7. package/dist/core/graphql.d.ts +3 -1
  8. package/dist/core/graphql.js +12 -3
  9. package/dist/core/locale.d.ts +6 -0
  10. package/dist/core/locale.js +24 -0
  11. package/dist/core/utils/html-helper.d.ts +1 -0
  12. package/dist/core/utils/html-helper.js +4 -0
  13. package/dist/products/price-helper.js +1 -1
  14. package/dist/short-videos/short-video-viewer/cmp.ad.svelte +103 -37
  15. package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +2 -2
  16. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
  17. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +3 -2
  18. package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
  19. package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +3 -2
  20. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
  21. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +3 -2
  22. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +6 -2
  23. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
  24. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
  25. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
  26. package/dist/short-videos/short-video-viewer/description.svelte +5 -0
  27. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
  28. package/dist/short-videos/short-video-viewer/index.d.ts +4 -2
  29. package/dist/short-videos/short-video-viewer/index.js +1 -0
  30. package/dist/short-videos/short-video-viewer/mapper.js +5 -4
  31. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +10 -3
  32. package/dist/short-videos/short-video-viewer/operations.generated.js +17 -3
  33. package/dist/short-videos/short-video-viewer/operations.graphql +10 -3
  34. package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.svelte.d.ts → short-video-attachments-localization.d.ts} +5 -4
  35. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +21 -0
  36. package/dist/short-videos/short-video-viewer/{short-video-details-localization.svelte.d.ts → short-video-details-localization.d.ts} +7 -6
  37. package/dist/short-videos/short-video-viewer/short-video-details-localization.js +17 -0
  38. package/dist/short-videos/short-video-viewer/{short-video-product-localization.svelte.d.ts → short-video-product-localization.d.ts} +2 -1
  39. package/dist/short-videos/short-video-viewer/short-video-product-localization.js +13 -0
  40. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +14 -0
  41. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +17 -0
  42. package/dist/short-videos/short-video-viewer/types.d.ts +10 -3
  43. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +88 -11
  44. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -5
  45. package/dist/short-videos/short-videos-player/controls.svelte +2 -2
  46. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
  47. package/dist/short-videos/short-videos-player/index.d.ts +51 -14
  48. package/dist/short-videos/short-videos-player/index.js +83 -12
  49. package/dist/short-videos/short-videos-player/operations.generated.d.ts +71 -0
  50. package/dist/short-videos/short-videos-player/operations.generated.js +207 -0
  51. package/dist/short-videos/short-videos-player/operations.graphql +8 -0
  52. package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +16 -0
  53. package/dist/short-videos/short-videos-player/short-videos-player-localization.js +13 -0
  54. package/dist/short-videos/short-videos-player/types.d.ts +36 -0
  55. package/dist/short-videos/short-videos-player/types.js +6 -0
  56. package/dist/streams/layout/cmp.layout.svelte.d.ts +4 -2
  57. package/dist/streams/layout/cmp.slot-content.svelte +4 -4
  58. package/dist/streams/layout/cmp.slot-content.svelte.d.ts +2 -1
  59. package/dist/streams/layout/cmp.slot.svelte.d.ts +7 -2
  60. package/dist/streams/layout/component.d.ts +2 -0
  61. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte +16 -0
  62. package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte.d.ts +7 -0
  63. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
  64. package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +4 -3
  65. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +15 -2
  66. package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +7 -3
  67. package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +2 -2
  68. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +15 -89
  69. package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +5 -4
  70. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +4 -2
  71. package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +3 -0
  72. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +74 -0
  73. package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +11 -0
  74. package/dist/streams/layout/element-views/cmp.stream-element.svelte +24 -17
  75. package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +4 -3
  76. package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +2 -2
  77. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +6 -2
  78. package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +2 -0
  79. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte +37 -0
  80. package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte.d.ts +7 -0
  81. package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -3
  82. package/dist/streams/layout/element-views/index.d.ts +16 -11
  83. package/dist/streams/layout/element-views/index.js +12 -9
  84. package/dist/streams/layout/element-views/price-element-view.svelte +168 -0
  85. package/dist/streams/layout/element-views/price-element-view.svelte.d.ts +15 -0
  86. package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +13 -0
  87. package/dist/streams/layout/element-views/price-stream-element-localization.js +21 -0
  88. package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +9 -0
  89. package/dist/streams/layout/element-views/short-video-stream-element-localization.js +7 -0
  90. package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +8 -0
  91. package/dist/streams/layout/element-views/stock-stream-element-localization.js +26 -0
  92. package/dist/streams/layout/element-views/stream-element-localization.d.ts +15 -0
  93. package/dist/streams/layout/element-views/stream-element-localization.js +11 -0
  94. package/dist/streams/layout/elements.d.ts +47 -12
  95. package/dist/streams/layout/elements.js +1 -1
  96. package/dist/streams/layout/enums.d.ts +34 -3
  97. package/dist/streams/layout/enums.js +46 -7
  98. package/dist/streams/layout/index.d.ts +3 -10
  99. package/dist/streams/layout/index.js +3 -2
  100. package/dist/streams/layout/layout.d.ts +2 -1
  101. package/dist/streams/layout/models/index.d.ts +1 -1
  102. package/dist/streams/layout/models/mapper.js +5 -4
  103. package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +1 -1
  104. package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -1
  105. package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +1 -1
  106. package/dist/streams/layout/models/stream-layout-product-model.d.ts +1 -2
  107. package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +13 -3
  108. package/dist/streams/layout/serializer.svelte.d.ts +29 -0
  109. package/dist/streams/layout/serializer.svelte.js +93 -0
  110. package/dist/streams/layout/slot-data-ref.d.ts +13 -0
  111. package/dist/streams/layout/slot-data-ref.js +1 -0
  112. package/dist/streams/layout/slot.d.ts +2 -0
  113. package/dist/streams/layout/styles-transformer.d.ts +3 -2
  114. package/dist/streams/layout/styles-transformer.js +54 -30
  115. package/dist/streams/layout/styles.d.ts +24 -14
  116. package/dist/streams/layout/svg-attributes.d.ts +7 -0
  117. package/dist/streams/layout/svg-attributes.js +8 -0
  118. package/dist/streams/layout/type-guards.d.ts +31 -0
  119. package/dist/streams/layout/type-guards.js +13 -1
  120. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +4 -2
  121. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +3 -0
  122. package/dist/streams/stream-page-viewer/index.d.ts +1 -0
  123. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +9 -0
  124. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +7 -0
  125. package/dist/streams/stream-player/cmp.stream-player.svelte +47 -7
  126. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +6 -4
  127. package/dist/streams/stream-player/controls.svelte +46 -3
  128. package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
  129. package/dist/streams/stream-player/index.d.ts +6 -4
  130. package/dist/streams/stream-player/index.js +15 -28
  131. package/dist/streams/stream-player/operations.generated.d.ts +1 -1
  132. package/dist/streams/stream-player/operations.generated.js +5 -3
  133. package/dist/streams/stream-player/operations.graphql +3 -3
  134. package/dist/streams/stream-player/stream-overview.svelte +2 -2
  135. package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
  136. package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
  137. package/dist/streams/stream-player/stream-player-localization.d.ts +26 -0
  138. package/dist/streams/stream-player/stream-player-localization.js +31 -0
  139. package/dist/ui/icon/cmp.icon.svelte +13 -26
  140. package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
  141. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +3 -2
  142. package/dist/ui/line-clamp/index.d.ts +1 -1
  143. package/dist/ui/line-clamp/index.js +1 -1
  144. package/dist/ui/line-clamp/{line-clamp-localization.svelte.d.ts → line-clamp-localization.d.ts} +2 -1
  145. package/dist/ui/line-clamp/line-clamp-localization.js +19 -0
  146. package/dist/ui/shadow-dom/shadow-host.d.ts +1 -5
  147. package/dist/ui/shadow-dom/shadow-host.js +1 -14
  148. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +125 -0
  149. package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +9 -0
  150. package/dist/ui/swipe-indicator/index.d.ts +2 -0
  151. package/dist/ui/swipe-indicator/index.js +1 -0
  152. package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +8 -0
  153. package/dist/ui/swipe-indicator/swipe-indicator-localization.js +13 -0
  154. package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
  155. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +3 -2
  156. package/dist/ui/time-ago/index.d.ts +1 -1
  157. package/dist/ui/time-ago/{time-ago-localization.svelte.d.ts → time-ago-localization.d.ts} +2 -1
  158. package/dist/ui/time-ago/time-ago-localization.js +55 -0
  159. package/dist/ui/video/cmp.video.svelte +42 -18
  160. package/package.json +1 -1
  161. package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +0 -10
  162. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +0 -10
  163. package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +0 -11
  164. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +0 -13
  165. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +0 -10
  166. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +0 -8
  167. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +0 -6
  168. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +0 -9
  169. package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +0 -8
  170. package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +0 -8
  171. package/dist/streams/layout/element-views/stream-element-localization.svelte.js +0 -6
  172. package/dist/streams/layout/serializer.d.ts +0 -3
  173. package/dist/streams/layout/serializer.js +0 -6
  174. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +0 -13
  175. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +0 -10
  176. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +0 -12
  177. package/dist/streams/stream-player/stream-player-localization.svelte.js +0 -10
  178. package/dist/ui/line-clamp/line-clamp-localization.svelte.js +0 -15
  179. package/dist/ui/time-ago/time-ago-localization.svelte.js +0 -39
@@ -1,25 +1,8 @@
1
- import { createLocalGQLClient } from '../../core/graphql';
1
+ import { getLocale } from '../../core/locale';
2
2
  import { ShadowHost } from '../../ui/shadow-dom';
3
3
  import { default as StreamPlayer } from './cmp.stream-player.svelte';
4
4
  import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
5
- import { mount } from 'svelte';
6
- /**
7
- * Key used for storing the profile ID in local storage
8
- */
9
- const PROFILE_ID_STORAGE_KEY = 'streamscloud_profile_id';
10
- /**
11
- * Retrieves the profile ID from localStorage or generates a new one if it doesn't exist
12
- * @returns The profile ID to use for analytics tracking
13
- */
14
- function getOrCreateProfileId() {
15
- const storedProfileId = localStorage.getItem(PROFILE_ID_STORAGE_KEY);
16
- if (!storedProfileId) {
17
- const newProfileId = crypto.randomUUID();
18
- localStorage.setItem(PROFILE_ID_STORAGE_KEY, newProfileId);
19
- return newProfileId;
20
- }
21
- return storedProfileId;
22
- }
5
+ import { mount, unmount } from 'svelte';
23
6
  /**
24
7
  * Opens the stream player modal with the specified stream details.
25
8
  *
@@ -35,7 +18,7 @@ function getOrCreateProfileId() {
35
18
  *
36
19
  * openStreamPlayer({
37
20
  * streamId: '...',
38
- * graphqlUrl: 'https://api.example.com/graphql',
21
+ * graphqlOrigin: 'https://api.example.com',
39
22
  * localization: {
40
23
  * play: 'Play',
41
24
  * pause: 'Pause'
@@ -44,16 +27,16 @@ function getOrCreateProfileId() {
44
27
  * ```
45
28
  */
46
29
  export const openStreamPlayer = (init) => {
47
- const { streamId, graphqlUrl, localization } = init;
48
- const shadowHost = new ShadowHost({ onClosed: () => init.on?.playerClosed?.() });
49
- AppEventsTracker.setEndpoint(graphqlUrl);
50
- AppEventsTracker.setProfileId(getOrCreateProfileId());
51
- mount(StreamPlayer, {
30
+ const { streamId, graphqlOrigin, localization, showStreamsCloudWatermark, initiator } = init;
31
+ const shadowHost = new ShadowHost();
32
+ const mounted = mount(StreamPlayer, {
52
33
  target: shadowHost.shadowRoot,
53
34
  props: {
54
35
  streamId,
55
- graphql: createLocalGQLClient(graphqlUrl),
56
- localization,
36
+ graphqlOrigin,
37
+ localization: getLocale(localization),
38
+ showStreamsCloudWatermark,
39
+ initiator,
57
40
  on: {
58
41
  streamActivated: (data) => {
59
42
  AppEventsTracker.setOrganizationId(data.ownerId);
@@ -61,7 +44,11 @@ export const openStreamPlayer = (init) => {
61
44
  init.on.streamActivated({ title: data.title, image: data.image });
62
45
  }
63
46
  },
64
- closePlayer: () => {
47
+ closePlayer: async () => {
48
+ if (init.on?.playerClosed) {
49
+ init.on.playerClosed();
50
+ }
51
+ await unmount(mounted);
65
52
  shadowHost.remove();
66
53
  }
67
54
  }
@@ -27,7 +27,7 @@ export type GetStreamQuery = {
27
27
  } | null;
28
28
  };
29
29
  export type GetStreamPagesQueryVariables = SchemaTypes.Exact<{
30
- input: SchemaTypes.StreamPagesInput;
30
+ input: SchemaTypes.EmbedStreamPagesInput;
31
31
  image_scale: SchemaTypes.ImageScale;
32
32
  }>;
33
33
  export type GetStreamPagesQuery = {
@@ -67,7 +67,8 @@ export const GetStreamDocument = {
67
67
  selections: [
68
68
  {
69
69
  kind: 'Field',
70
- name: { kind: 'Name', value: 'stream' },
70
+ alias: { kind: 'Name', value: 'stream' },
71
+ name: { kind: 'Name', value: 'embedStream' },
71
72
  arguments: [
72
73
  {
73
74
  kind: 'Argument',
@@ -141,7 +142,7 @@ export const GetStreamPagesDocument = {
141
142
  {
142
143
  kind: 'VariableDefinition',
143
144
  variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
144
- type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'StreamPagesInput' } } }
145
+ type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'EmbedStreamPagesInput' } } }
145
146
  },
146
147
  {
147
148
  kind: 'VariableDefinition',
@@ -154,7 +155,8 @@ export const GetStreamPagesDocument = {
154
155
  selections: [
155
156
  {
156
157
  kind: 'Field',
157
- name: { kind: 'Name', value: 'streamPages' },
158
+ alias: { kind: 'Name', value: 'streamPages' },
159
+ name: { kind: 'Name', value: 'embedStreamPages' },
158
160
  arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'input' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } } }],
159
161
  selectionSet: {
160
162
  kind: 'SelectionSet',
@@ -1,12 +1,12 @@
1
1
  query GetStream($id: String!) {
2
- stream(input: { id: $id }) {
2
+ stream: embedStream(input: { id: $id }) {
3
3
  ...StreamPlayerPayloadFragment
4
4
  }
5
5
  }
6
6
 
7
7
  # noinspection GraphQLSchemaValidation
8
- query GetStreamPages($input: StreamPagesInput!, $image_scale: ImageScale!) {
9
- streamPages(input: $input) {
8
+ query GetStreamPages($input: EmbedStreamPagesInput!, $image_scale: ImageScale!) {
9
+ streamPages: embedStreamPages(input: $input) {
10
10
  items {
11
11
  ...StreamPageViewerPayloadFragment
12
12
  }
@@ -6,7 +6,7 @@ import { LineClamp } from '../../ui/line-clamp';
6
6
  import { ProportionalContainer } from '../../ui/proportional-container';
7
7
  import { TimeAgo } from '../../ui/time-ago';
8
8
  import { default as ActionButton } from './action-button.svelte';
9
- import { StreamPlayerLocalization } from './stream-player-localization.svelte';
9
+ import { StreamPlayerLocalization } from './stream-player-localization';
10
10
  import IconPanelLeftText from '@fluentui/svg-icons/icons/panel_left_text_20_regular.svg?raw';
11
11
  let { model, buffer, activePageId, on, uiManager, localization } = $props();
12
12
  </script>
@@ -26,7 +26,7 @@ let { model, buffer, activePageId, on, uiManager, localization } = $props();
26
26
  </div>
27
27
  <div class="stream-overview-owner__meta">
28
28
  <LineClamp maxLines={1}>
29
- <TimeAgo date={model.publishedAt || model.createdAt} />
29
+ <TimeAgo date={model.publishedAt || model.createdAt} localization={localization.timeAgoLocalization} />
30
30
  </LineClamp>
31
31
  </div>
32
32
  </div>
@@ -1,5 +1,5 @@
1
1
  import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
2
- import { StreamPlayerLocalization } from './stream-player-localization.svelte';
2
+ import { StreamPlayerLocalization } from './stream-player-localization';
3
3
  import type { StreamPlayerModel } from './types';
4
4
  import type { StreamPlayerUiManager } from './ui-manager.svelte';
5
5
  type Props = {
@@ -23,7 +23,7 @@ export class StreamPlayerBuffer {
23
23
  const payload = await graphql
24
24
  .query(GetStreamPagesDocument, {
25
25
  input: {
26
- limit: 10,
26
+ limit: 2,
27
27
  continuationToken,
28
28
  filter: {
29
29
  streamId
@@ -70,7 +70,7 @@ export class StreamPlayerBuffer {
70
70
  this._pagesLoader.reset();
71
71
  };
72
72
  warmUpBuffer = async () => {
73
- const bufferSize = 5;
73
+ const bufferSize = 2;
74
74
  if (this.loaded.length >= this.currentIndex + bufferSize) {
75
75
  return;
76
76
  }
@@ -0,0 +1,26 @@
1
+ import { type Locale } from '../../core/locale';
2
+ import type { IShortVideoAttachmentsLocalization, IShortVideoDetailsLocalization, IShortVideoViewerLocalization } from '../../short-videos/short-video-viewer';
3
+ import type { IStreamPageViewerLocalization } from '../stream-page-viewer';
4
+ import type { ISwipeIndicatorLocalization } from '../../ui/swipe-indicator';
5
+ import type { ITimeAgoLocalization } from '../../ui/time-ago';
6
+ export interface IStreamPlayerLocalization {
7
+ streamNotFound?: string;
8
+ pagesCount?: (count: number) => string;
9
+ timeAgoLocalization?: ITimeAgoLocalization | Locale;
10
+ streamPageViewerLocalization?: IStreamPageViewerLocalization | Locale;
11
+ shortVideoAttachmentsLocalization?: IShortVideoAttachmentsLocalization | Locale;
12
+ shortVideoDetailsLocalization?: IShortVideoDetailsLocalization | Locale;
13
+ shortVideoViewerLocalization?: IShortVideoViewerLocalization | Locale;
14
+ swipeIndicatorLocalization?: ISwipeIndicatorLocalization | Locale;
15
+ }
16
+ export declare class StreamPlayerLocalization {
17
+ streamNotFound: string;
18
+ pagesCount: (count: number) => string;
19
+ timeAgoLocalization: ITimeAgoLocalization | Locale;
20
+ streamPageViewerLocalization: IStreamPageViewerLocalization | Locale;
21
+ shortVideoAttachmentsLocalization: IShortVideoAttachmentsLocalization | Locale;
22
+ shortVideoDetailsLocalization: IShortVideoDetailsLocalization | Locale;
23
+ shortVideoViewerLocalization: IShortVideoViewerLocalization | Locale;
24
+ swipeIndicatorLocalization: ISwipeIndicatorLocalization | Locale;
25
+ constructor(init: IStreamPlayerLocalization | Locale);
26
+ }
@@ -0,0 +1,31 @@
1
+ import { isLocale } from '../../core/locale';
2
+ export class StreamPlayerLocalization {
3
+ streamNotFound;
4
+ pagesCount;
5
+ timeAgoLocalization;
6
+ streamPageViewerLocalization;
7
+ shortVideoAttachmentsLocalization;
8
+ shortVideoDetailsLocalization;
9
+ shortVideoViewerLocalization;
10
+ swipeIndicatorLocalization;
11
+ constructor(init) {
12
+ this.streamNotFound = isLocale(init) ? loc.streamNotFound[init] : init?.streamNotFound || loc.streamNotFound.en;
13
+ this.pagesCount = isLocale(init) ? loc.pagesCount[init] : init?.pagesCount || loc.pagesCount.en;
14
+ this.timeAgoLocalization = isLocale(init) ? init : init.timeAgoLocalization || 'en';
15
+ this.streamPageViewerLocalization = isLocale(init) ? init : init.streamPageViewerLocalization || 'en';
16
+ this.shortVideoAttachmentsLocalization = isLocale(init) ? init : init.shortVideoAttachmentsLocalization || 'en';
17
+ this.shortVideoDetailsLocalization = isLocale(init) ? init : init.shortVideoDetailsLocalization || 'en';
18
+ this.shortVideoViewerLocalization = isLocale(init) ? init : init.shortVideoViewerLocalization || 'en';
19
+ this.swipeIndicatorLocalization = isLocale(init) ? init : init.swipeIndicatorLocalization || 'en';
20
+ }
21
+ }
22
+ const loc = {
23
+ streamNotFound: {
24
+ en: 'Stream not found',
25
+ no: 'Stream ikke funnet'
26
+ },
27
+ pagesCount: {
28
+ en: (count) => (count === 1 ? '1 page' : `${count} pages`),
29
+ no: (count) => (count === 1 ? '1 side' : `${count} sider`)
30
+ }
31
+ };
@@ -1,34 +1,20 @@
1
1
  <script lang="ts">import { IconColor } from './types';
2
- import { inlineSvg } from '@svelte-put/inline-svg';
3
2
  let { src, color = null } = $props();
4
- let svgRef;
5
- $effect(() => {
6
- if (svgRef && src) {
7
- inlineSvg(svgRef, src);
8
- }
9
- });
10
- const fillSvg = (node) => {
11
- svgRef = node;
12
- return inlineSvg(node, src);
13
- };
14
3
  </script>
15
4
 
16
- <div
17
- class="icon"
18
- style="display: contents"
19
- class:icon--white={color === IconColor.White}
20
- class:icon--text={color === IconColor.Text}
21
- class:icon--gray={color === IconColor.Gray}
22
- class:icon--green={color === IconColor.Green}
23
- class:icon--red={color === IconColor.Red}
24
- class:icon--orange={color === IconColor.Orange}
25
- class:icon--blue={color === IconColor.Blue}>
26
- {#if src.startsWith('<svg')}
5
+ {#if src?.startsWith('<svg')}
6
+ <div
7
+ class="icon"
8
+ class:icon--white={color === IconColor.White}
9
+ class:icon--text={color === IconColor.Text}
10
+ class:icon--gray={color === IconColor.Gray}
11
+ class:icon--green={color === IconColor.Green}
12
+ class:icon--red={color === IconColor.Red}
13
+ class:icon--orange={color === IconColor.Orange}
14
+ class:icon--blue={color === IconColor.Blue}>
27
15
  {@html src}
28
- {:else}
29
- <svg use:fillSvg></svg>
30
- {/if}
31
- </div>
16
+ </div>
17
+ {/if}
32
18
 
33
19
  <style>@keyframes fadeIn {
34
20
  0% {
@@ -45,6 +31,7 @@ const fillSvg = (node) => {
45
31
  --_icon--color: var(--icon--color);
46
32
  --_icon--size: var(--icon--size, 1.25em);
47
33
  --_icon--stroke-width: var(--icon--stroke-width, 0);
34
+ display: contents;
48
35
  }
49
36
  .icon--white {
50
37
  --_icon--color: #ffffff;
@@ -1,8 +1,8 @@
1
- <script lang="ts">import { LineClampLocalization } from './line-clamp-localization.svelte';
1
+ <script lang="ts">import { LineClampLocalization } from './line-clamp-localization';
2
2
  import { LineClampUtils } from './line-clamp-utils';
3
3
  import { onDestroy, onMount } from 'svelte';
4
4
  let { value = undefined, maxLines = 3, localization: localizationInit, enableShowMore = false, children } = $props();
5
- const localization = $derived(new LineClampLocalization(localizationInit));
5
+ const localization = $derived(new LineClampLocalization(localizationInit !== null && localizationInit !== void 0 ? localizationInit : 'en'));
6
6
  let parent;
7
7
  let element;
8
8
  let clampWrapperRef;
@@ -1,10 +1,11 @@
1
- import { type ILineClampLocalization } from './line-clamp-localization.svelte';
1
+ import type { Locale } from '../../core/locale';
2
+ import { type ILineClampLocalization } from './line-clamp-localization';
2
3
  import { type Snippet } from 'svelte';
3
4
  type Props = {
4
5
  value?: string | null;
5
6
  maxLines?: number | 'auto';
6
7
  enableShowMore?: boolean;
7
- localization?: ILineClampLocalization;
8
+ localization?: ILineClampLocalization | Locale;
8
9
  children?: Snippet;
9
10
  };
10
11
  declare const Cmp: import("svelte").Component<Props, {}, "">;
@@ -1,2 +1,2 @@
1
1
  export { default as LineClamp } from './cmp.line-clamp.svelte';
2
- export { type ILineClampLocalization } from './line-clamp-localization.svelte';
2
+ export { type ILineClampLocalization } from './line-clamp-localization';
@@ -1,2 +1,2 @@
1
1
  export { default as LineClamp } from './cmp.line-clamp.svelte';
2
- export {} from './line-clamp-localization.svelte';
2
+ export {} from './line-clamp-localization';
@@ -1,3 +1,4 @@
1
+ import { type Locale } from '../../core/locale';
1
2
  export interface ILineClampLocalization {
2
3
  showLess?: string;
3
4
  showMore?: string;
@@ -5,5 +6,5 @@ export interface ILineClampLocalization {
5
6
  export declare class LineClampLocalization {
6
7
  showLess: string;
7
8
  showMore: string;
8
- constructor(init?: ILineClampLocalization);
9
+ constructor(init: ILineClampLocalization | Locale);
9
10
  }
@@ -0,0 +1,19 @@
1
+ import { isLocale } from '../../core/locale';
2
+ export class LineClampLocalization {
3
+ showLess;
4
+ showMore;
5
+ constructor(init) {
6
+ this.showLess = isLocale(init) ? loc.showLess[init] : init.showLess || loc.showLess.en;
7
+ this.showMore = isLocale(init) ? loc.showMore[init] : init.showMore || loc.showMore.en;
8
+ }
9
+ }
10
+ const loc = {
11
+ showLess: {
12
+ en: 'Show less',
13
+ no: 'Vis mindre'
14
+ },
15
+ showMore: {
16
+ en: 'Show more',
17
+ no: 'Vis mer'
18
+ }
19
+ };
@@ -1,11 +1,7 @@
1
1
  export declare class ShadowHost {
2
2
  shadowRoot: ShadowRoot;
3
3
  private host;
4
- private callbacks;
5
- constructor(init: {
6
- onClosed: () => void;
7
- });
4
+ constructor();
8
5
  attachToBody(): void;
9
6
  remove(): void;
10
- private handleEsc;
11
7
  }
@@ -3,11 +3,7 @@ import reset from './_reset.scss?raw';
3
3
  export class ShadowHost {
4
4
  shadowRoot;
5
5
  host;
6
- callbacks;
7
- constructor(init) {
8
- this.callbacks = {
9
- onClosed: init.onClosed
10
- };
6
+ constructor() {
11
7
  const host = document.createElement('div');
12
8
  host.style.all = 'unset';
13
9
  host.style.position = 'fixed';
@@ -19,7 +15,6 @@ export class ShadowHost {
19
15
  host.style.margin = '0';
20
16
  host.style.boxSizing = 'border-box';
21
17
  host.style.textAlign = 'initial';
22
- document.addEventListener('keydown', this.handleEsc);
23
18
  this.host = host;
24
19
  this.shadowRoot = host.attachShadow({ mode: 'open' });
25
20
  const styleElement = document.createElement('style');
@@ -33,13 +28,5 @@ export class ShadowHost {
33
28
  remove() {
34
29
  this.host.remove();
35
30
  document.getElementsByTagName('html')[0].style.overflow = '';
36
- document.removeEventListener('keydown', this.handleEsc);
37
- this.callbacks.onClosed();
38
31
  }
39
- handleEsc = (event) => {
40
- if (event.key === 'Escape' || event.key === 'Esc') {
41
- // Remove the modal from the DOM, for example:
42
- this.remove();
43
- }
44
- };
45
32
  }
@@ -0,0 +1,125 @@
1
+ <script lang="ts">import { Icon } from '../icon';
2
+ import { SwipeIndicatorLocalization } from './swipe-indicator-localization';
3
+ import IconArrowUp from '@fluentui/svg-icons/icons/arrow_up_20_regular.svg?raw';
4
+ let { fadeTimeout = 2000, localization: localizationInit } = $props();
5
+ const localization = $derived(new SwipeIndicatorLocalization(localizationInit));
6
+ let isFaded = $state(false);
7
+ const indicatorMounted = (_) => {
8
+ if (fadeTimeout) {
9
+ const timeout = setTimeout(() => {
10
+ isFaded = true;
11
+ }, 3000);
12
+ return {
13
+ destroy() {
14
+ clearTimeout(timeout);
15
+ }
16
+ };
17
+ }
18
+ };
19
+ </script>
20
+
21
+ <div class="swipe-indicator" class:swipe-indicator--faded={isFaded} use:indicatorMounted>
22
+ <div class="swipe-indicator__icon">
23
+ <Icon src={IconArrowUp} />
24
+ </div>
25
+ <div class="swipe-indicator__text">
26
+ {localization.swipe}
27
+ </div>
28
+ </div>
29
+
30
+ <style>@charset "UTF-8";
31
+ @keyframes fadeIn {
32
+ 0% {
33
+ opacity: 1;
34
+ }
35
+ 50% {
36
+ opacity: 0.4;
37
+ }
38
+ 100% {
39
+ opacity: 1;
40
+ }
41
+ }
42
+ .swipe-indicator {
43
+ --_swipe-indicator--color: var(--swipe-indicator--color, #ffffff);
44
+ --_swipe-indicator--font-size: var(--swipe-indicator--font-size, 1rem);
45
+ --_swipe-indicator--icon-size: var(--swipe-indicator--icon-size, var(--_swipe-indicator--font-size));
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ justify-content: center;
50
+ position: absolute;
51
+ bottom: 1.25rem;
52
+ left: 50%;
53
+ transform: translateX(-50%);
54
+ z-index: 10;
55
+ color: var(--_swipe-indicator--color);
56
+ opacity: 1;
57
+ transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
58
+ }
59
+ .swipe-indicator--faded {
60
+ opacity: 0;
61
+ pointer-events: none;
62
+ }
63
+ .swipe-indicator:before {
64
+ content: "";
65
+ position: absolute;
66
+ inset: 0;
67
+ z-index: 0;
68
+ pointer-events: none;
69
+ border-radius: 50%;
70
+ background: #000;
71
+ filter: blur(12px);
72
+ transform: scale(3);
73
+ }
74
+ .swipe-indicator__icon {
75
+ font-size: var(--_swipe-indicator--icon-size);
76
+ animation: bounce 2.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
77
+ will-change: transform;
78
+ z-index: 1;
79
+ }
80
+ .swipe-indicator__text {
81
+ font-size: var(--_swipe-indicator--font-size);
82
+ z-index: 1;
83
+ }
84
+
85
+ @keyframes bounce {
86
+ 0%, 100% {
87
+ transform: translateY(0);
88
+ }
89
+ 10% {
90
+ transform: translateY(-24px); /* основной прыжок */
91
+ }
92
+ 18% {
93
+ transform: translateY(0);
94
+ }
95
+ 26% {
96
+ transform: translateY(-12px); /* первый малый отскок */
97
+ }
98
+ 34% {
99
+ transform: translateY(0);
100
+ }
101
+ 41% {
102
+ transform: translateY(-8px); /* второй малый отскок */
103
+ }
104
+ 48% {
105
+ transform: translateY(0);
106
+ }
107
+ 54% {
108
+ transform: translateY(-4px); /* третий малый отскок */
109
+ }
110
+ 60% {
111
+ transform: translateY(0);
112
+ }
113
+ 65% {
114
+ transform: translateY(-2px); /* почти затух */
115
+ }
116
+ 70% {
117
+ transform: translateY(0);
118
+ }
119
+ 75% {
120
+ transform: translateY(-1px); /* совсем маленький */
121
+ }
122
+ 80% {
123
+ transform: translateY(0);
124
+ }
125
+ }</style>
@@ -0,0 +1,9 @@
1
+ import type { Locale } from '../../core/locale';
2
+ import { type ISwipeIndicatorLocalization } from './swipe-indicator-localization';
3
+ type Props = {
4
+ fadeTimeout?: number;
5
+ localization: ISwipeIndicatorLocalization | Locale;
6
+ };
7
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
8
+ type Cmp = ReturnType<typeof Cmp>;
9
+ export default Cmp;
@@ -0,0 +1,2 @@
1
+ export { default as SwipeIndicator } from './cmp.swipe-indicator.svelte';
2
+ export type { ISwipeIndicatorLocalization } from './swipe-indicator-localization';
@@ -0,0 +1 @@
1
+ export { default as SwipeIndicator } from './cmp.swipe-indicator.svelte';
@@ -0,0 +1,8 @@
1
+ import { type Locale } from '../../core/locale';
2
+ export interface ISwipeIndicatorLocalization {
3
+ swipe?: string;
4
+ }
5
+ export declare class SwipeIndicatorLocalization {
6
+ swipe: string;
7
+ constructor(init: ISwipeIndicatorLocalization | Locale);
8
+ }
@@ -0,0 +1,13 @@
1
+ import { isLocale } from '../../core/locale';
2
+ export class SwipeIndicatorLocalization {
3
+ swipe;
4
+ constructor(init) {
5
+ this.swipe = isLocale(init) ? loc.swipe[init] : init.swipe || loc.swipe.en;
6
+ }
7
+ }
8
+ const loc = {
9
+ swipe: {
10
+ en: 'Swipe',
11
+ no: 'Sveip'
12
+ }
13
+ };
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">import { DateFormatOptions, DateHelper } from '../../core/utils/date-helper';
2
- import { TimeAgoLocalization } from './time-ago-localization.svelte';
2
+ import { TimeAgoLocalization } from './time-ago-localization';
3
3
  import { onDestroy } from 'svelte';
4
4
  let { date = null, thresholdMinutes = 60 * 24 * 2 /* 2 days */, localization: localizationInit } = $props();
5
5
  const localization = $derived(new TimeAgoLocalization(localizationInit));
@@ -1,8 +1,9 @@
1
- import { type ITimeAgoLocalization } from './time-ago-localization.svelte';
1
+ import type { Locale } from '../../core/locale';
2
+ import { type ITimeAgoLocalization } from './time-ago-localization';
2
3
  type Props = {
3
4
  date: Date | string | null;
4
5
  thresholdMinutes?: number;
5
- localization?: ITimeAgoLocalization;
6
+ localization: ITimeAgoLocalization | Locale;
6
7
  };
7
8
  declare const Cmp: import("svelte").Component<Props, {}, "">;
8
9
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,2 +1,2 @@
1
1
  export { default as TimeAgo } from './cmp.time-ago.svelte';
2
- export type { ITimeAgoLocalization } from './time-ago-localization.svelte';
2
+ export type { ITimeAgoLocalization } from './time-ago-localization';
@@ -1,3 +1,4 @@
1
+ import { type Locale } from '../../core/locale';
1
2
  export interface ITimeAgoLocalization {
2
3
  locale?: string;
3
4
  aMinuteAgo?: string;
@@ -17,5 +18,5 @@ export declare class TimeAgoLocalization {
17
18
  hoursAgo: (hours: number) => string;
18
19
  minutesAgo: (minutes: number) => string;
19
20
  yesterday: (time: string) => string;
20
- constructor(init?: ITimeAgoLocalization);
21
+ constructor(init: ITimeAgoLocalization | Locale);
21
22
  }