@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.
- package/dist/core/analytics.profile-id.d.ts +5 -0
- package/dist/core/analytics.profile-id.js +17 -0
- package/dist/core/document.event-handlers.d.ts +1 -0
- package/dist/core/document.event-handlers.js +5 -0
- package/dist/core/enums.d.ts +0 -2
- package/dist/core/enums.js +0 -2
- package/dist/core/graphql.d.ts +3 -1
- package/dist/core/graphql.js +12 -3
- package/dist/core/locale.d.ts +6 -0
- package/dist/core/locale.js +24 -0
- package/dist/core/utils/html-helper.d.ts +1 -0
- package/dist/core/utils/html-helper.js +4 -0
- package/dist/products/price-helper.js +1 -1
- package/dist/short-videos/short-video-viewer/cmp.ad.svelte +103 -37
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +2 -2
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +2 -2
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/cmp.product.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +6 -2
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +1 -1
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +3 -2
- package/dist/short-videos/short-video-viewer/description.svelte +5 -0
- package/dist/short-videos/short-video-viewer/description.svelte.d.ts +1 -1
- package/dist/short-videos/short-video-viewer/index.d.ts +4 -2
- package/dist/short-videos/short-video-viewer/index.js +1 -0
- package/dist/short-videos/short-video-viewer/mapper.js +5 -4
- package/dist/short-videos/short-video-viewer/operations.generated.d.ts +10 -3
- package/dist/short-videos/short-video-viewer/operations.generated.js +17 -3
- package/dist/short-videos/short-video-viewer/operations.graphql +10 -3
- package/dist/short-videos/short-video-viewer/{short-video-attachments-localization.svelte.d.ts → short-video-attachments-localization.d.ts} +5 -4
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.js +21 -0
- package/dist/short-videos/short-video-viewer/{short-video-details-localization.svelte.d.ts → short-video-details-localization.d.ts} +7 -6
- package/dist/short-videos/short-video-viewer/short-video-details-localization.js +17 -0
- package/dist/short-videos/short-video-viewer/{short-video-product-localization.svelte.d.ts → short-video-product-localization.d.ts} +2 -1
- package/dist/short-videos/short-video-viewer/short-video-product-localization.js +13 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.d.ts +14 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.js +17 -0
- package/dist/short-videos/short-video-viewer/types.d.ts +10 -3
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +88 -11
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +5 -5
- package/dist/short-videos/short-videos-player/controls.svelte +2 -2
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +1 -1
- package/dist/short-videos/short-videos-player/index.d.ts +51 -14
- package/dist/short-videos/short-videos-player/index.js +83 -12
- package/dist/short-videos/short-videos-player/operations.generated.d.ts +71 -0
- package/dist/short-videos/short-videos-player/operations.generated.js +207 -0
- package/dist/short-videos/short-videos-player/operations.graphql +8 -0
- package/dist/short-videos/short-videos-player/short-videos-player-localization.d.ts +16 -0
- package/dist/short-videos/short-videos-player/short-videos-player-localization.js +13 -0
- package/dist/short-videos/short-videos-player/types.d.ts +36 -0
- package/dist/short-videos/short-videos-player/types.js +6 -0
- package/dist/streams/layout/cmp.layout.svelte.d.ts +4 -2
- package/dist/streams/layout/cmp.slot-content.svelte +4 -4
- package/dist/streams/layout/cmp.slot-content.svelte.d.ts +2 -1
- package/dist/streams/layout/cmp.slot.svelte.d.ts +7 -2
- package/dist/streams/layout/component.d.ts +2 -0
- package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte +16 -0
- package/dist/streams/layout/element-views/cmp.annotation-stream-element.svelte.d.ts +7 -0
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +1 -1
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +4 -3
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +15 -2
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +7 -3
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +2 -2
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +15 -89
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +5 -4
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +4 -2
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +3 -0
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte +74 -0
- package/dist/streams/layout/element-views/cmp.stock-stream-element.svelte.d.ts +11 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +24 -17
- package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +4 -3
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +2 -2
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +6 -2
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +2 -0
- package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte +37 -0
- package/dist/streams/layout/element-views/cmp.web-view-stream-element.svelte.d.ts +7 -0
- package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -3
- package/dist/streams/layout/element-views/index.d.ts +16 -11
- package/dist/streams/layout/element-views/index.js +12 -9
- package/dist/streams/layout/element-views/price-element-view.svelte +168 -0
- package/dist/streams/layout/element-views/price-element-view.svelte.d.ts +15 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.d.ts +13 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.js +21 -0
- package/dist/streams/layout/element-views/short-video-stream-element-localization.d.ts +9 -0
- package/dist/streams/layout/element-views/short-video-stream-element-localization.js +7 -0
- package/dist/streams/layout/element-views/stock-stream-element-localization.d.ts +8 -0
- package/dist/streams/layout/element-views/stock-stream-element-localization.js +26 -0
- package/dist/streams/layout/element-views/stream-element-localization.d.ts +15 -0
- package/dist/streams/layout/element-views/stream-element-localization.js +11 -0
- package/dist/streams/layout/elements.d.ts +47 -12
- package/dist/streams/layout/elements.js +1 -1
- package/dist/streams/layout/enums.d.ts +34 -3
- package/dist/streams/layout/enums.js +46 -7
- package/dist/streams/layout/index.d.ts +3 -10
- package/dist/streams/layout/index.js +3 -2
- package/dist/streams/layout/layout.d.ts +2 -1
- package/dist/streams/layout/models/index.d.ts +1 -1
- package/dist/streams/layout/models/mapper.js +5 -4
- package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +1 -1
- package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -1
- package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +1 -1
- package/dist/streams/layout/models/stream-layout-product-model.d.ts +1 -2
- package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +13 -3
- package/dist/streams/layout/serializer.svelte.d.ts +29 -0
- package/dist/streams/layout/serializer.svelte.js +93 -0
- package/dist/streams/layout/slot-data-ref.d.ts +13 -0
- package/dist/streams/layout/slot-data-ref.js +1 -0
- package/dist/streams/layout/slot.d.ts +2 -0
- package/dist/streams/layout/styles-transformer.d.ts +3 -2
- package/dist/streams/layout/styles-transformer.js +54 -30
- package/dist/streams/layout/styles.d.ts +24 -14
- package/dist/streams/layout/svg-attributes.d.ts +7 -0
- package/dist/streams/layout/svg-attributes.js +8 -0
- package/dist/streams/layout/type-guards.d.ts +31 -0
- package/dist/streams/layout/type-guards.js +13 -1
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +4 -2
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +3 -0
- package/dist/streams/stream-page-viewer/index.d.ts +1 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.d.ts +9 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.js +7 -0
- package/dist/streams/stream-player/cmp.stream-player.svelte +47 -7
- package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +6 -4
- package/dist/streams/stream-player/controls.svelte +46 -3
- package/dist/streams/stream-player/controls.svelte.d.ts +1 -1
- package/dist/streams/stream-player/index.d.ts +6 -4
- package/dist/streams/stream-player/index.js +15 -28
- package/dist/streams/stream-player/operations.generated.d.ts +1 -1
- package/dist/streams/stream-player/operations.generated.js +5 -3
- package/dist/streams/stream-player/operations.graphql +3 -3
- package/dist/streams/stream-player/stream-overview.svelte +2 -2
- package/dist/streams/stream-player/stream-overview.svelte.d.ts +1 -1
- package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
- package/dist/streams/stream-player/stream-player-localization.d.ts +26 -0
- package/dist/streams/stream-player/stream-player-localization.js +31 -0
- package/dist/ui/icon/cmp.icon.svelte +13 -26
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +2 -2
- package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +3 -2
- package/dist/ui/line-clamp/index.d.ts +1 -1
- package/dist/ui/line-clamp/index.js +1 -1
- package/dist/ui/line-clamp/{line-clamp-localization.svelte.d.ts → line-clamp-localization.d.ts} +2 -1
- package/dist/ui/line-clamp/line-clamp-localization.js +19 -0
- package/dist/ui/shadow-dom/shadow-host.d.ts +1 -5
- package/dist/ui/shadow-dom/shadow-host.js +1 -14
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +125 -0
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +9 -0
- package/dist/ui/swipe-indicator/index.d.ts +2 -0
- package/dist/ui/swipe-indicator/index.js +1 -0
- package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +8 -0
- package/dist/ui/swipe-indicator/swipe-indicator-localization.js +13 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte +1 -1
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +3 -2
- package/dist/ui/time-ago/index.d.ts +1 -1
- package/dist/ui/time-ago/{time-ago-localization.svelte.d.ts → time-ago-localization.d.ts} +2 -1
- package/dist/ui/time-ago/time-ago-localization.js +55 -0
- package/dist/ui/video/cmp.video.svelte +42 -18
- package/package.json +1 -1
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +0 -10
- package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +0 -10
- package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +0 -11
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +0 -13
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +0 -10
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +0 -8
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +0 -6
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +0 -9
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +0 -8
- package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +0 -8
- package/dist/streams/layout/element-views/stream-element-localization.svelte.js +0 -6
- package/dist/streams/layout/serializer.d.ts +0 -3
- package/dist/streams/layout/serializer.js +0 -6
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +0 -13
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +0 -10
- package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +0 -12
- package/dist/streams/stream-player/stream-player-localization.svelte.js +0 -10
- package/dist/ui/line-clamp/line-clamp-localization.svelte.js +0 -15
- package/dist/ui/time-ago/time-ago-localization.svelte.js +0 -39
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
-
*
|
|
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,
|
|
48
|
-
const shadowHost = new ShadowHost(
|
|
49
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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: '
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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 =
|
|
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
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
2
|
+
export {} from './line-clamp-localization';
|
package/dist/ui/line-clamp/{line-clamp-localization.svelte.d.ts → line-clamp-localization.d.ts}
RENAMED
|
@@ -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
|
|
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
|
+
};
|
|
@@ -3,11 +3,7 @@ import reset from './_reset.scss?raw';
|
|
|
3
3
|
export class ShadowHost {
|
|
4
4
|
shadowRoot;
|
|
5
5
|
host;
|
|
6
|
-
|
|
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 @@
|
|
|
1
|
+
export { default as SwipeIndicator } from './cmp.swipe-indicator.svelte';
|
|
@@ -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
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
21
|
+
constructor(init: ITimeAgoLocalization | Locale);
|
|
21
22
|
}
|