@streamscloud/embeddable 2.1.1 → 2.1.2
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/continuation-token.d.ts +10 -0
- package/dist/core/continuation-token.js +32 -0
- package/dist/core/cursor-result.d.ts +9 -0
- package/dist/core/cursor-result.js +1 -0
- package/dist/core/data-loaders/cursor-data-loader.svelte.d.ts +14 -0
- package/dist/core/data-loaders/cursor-data-loader.svelte.js +35 -0
- package/dist/core/data-loaders/data-loader.d.ts +4 -0
- package/dist/core/data-loaders/data-loader.js +1 -0
- package/dist/core/data-loaders/index.d.ts +2 -0
- package/dist/core/data-loaders/index.js +1 -0
- package/dist/core/deferred.d.ts +6 -0
- package/dist/core/deferred.js +13 -0
- package/dist/core/enums.d.ts +33 -0
- package/dist/core/enums.js +39 -0
- package/dist/core/graphql.d.ts +1 -0
- package/dist/core/graphql.js +10 -0
- package/dist/core/media/image-helper.d.ts +10 -0
- package/dist/core/media/image-helper.js +30 -0
- package/dist/core/media/images-size-detector.service.d.ts +6 -0
- package/dist/core/media/images-size-detector.service.js +15 -0
- package/dist/core/media/index.d.ts +4 -0
- package/dist/core/media/index.js +4 -0
- package/dist/core/media/media-item-url.service.d.ts +2 -0
- package/dist/core/media/media-item-url.service.js +3 -0
- package/dist/core/media/types.d.ts +13 -0
- package/dist/core/media/types.js +1 -0
- package/dist/core/toastr.d.ts +1 -0
- package/dist/core/toastr.js +26 -0
- package/dist/core/transitions/index.d.ts +1 -0
- package/dist/core/transitions/index.js +1 -0
- package/dist/core/transitions/slide-horizontally.d.ts +7 -0
- package/dist/core/transitions/slide-horizontally.js +55 -0
- package/dist/core/utils/array-helper.d.ts +23 -0
- package/dist/core/utils/array-helper.js +148 -0
- package/dist/core/utils/date-helper.d.ts +29 -0
- package/dist/core/utils/date-helper.js +146 -0
- package/dist/core/utils/dom-helper.d.ts +12 -0
- package/dist/core/utils/dom-helper.js +76 -0
- package/dist/core/utils/html-helper.d.ts +40 -0
- package/dist/core/utils/html-helper.js +97 -0
- package/dist/core/utils/index.d.ts +3 -0
- package/dist/core/utils/index.js +3 -0
- package/dist/core/utils/number-helper.d.ts +6 -0
- package/dist/core/utils/number-helper.js +28 -0
- package/dist/core/utils/string-generator.d.ts +2 -0
- package/dist/core/utils/string-generator.js +15 -0
- package/dist/core/utils/string-helper.d.ts +10 -0
- package/dist/core/utils/string-helper.js +53 -0
- package/dist/core/utils/url-helper.d.ts +3 -0
- package/dist/core/utils/url-helper.js +13 -0
- package/dist/core/utils/utils.d.ts +28 -0
- package/dist/core/utils/utils.js +100 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/products/price-helper.d.ts +4 -0
- package/dist/products/price-helper.js +47 -0
- package/dist/short-videos/short-video-viewer/cmp.ad.svelte +74 -0
- package/dist/short-videos/short-video-viewer/cmp.ad.svelte.d.ts +7 -0
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +70 -0
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte.d.ts +7 -0
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +68 -0
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +12 -0
- package/dist/short-videos/short-video-viewer/cmp.product.svelte +168 -0
- package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +13 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +124 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +13 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +86 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +9 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +133 -0
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +15 -0
- package/dist/short-videos/short-video-viewer/description.svelte +46 -0
- package/dist/short-videos/short-video-viewer/description.svelte.d.ts +9 -0
- package/dist/short-videos/short-video-viewer/index.d.ts +9 -0
- package/dist/short-videos/short-video-viewer/index.js +6 -0
- package/dist/short-videos/short-video-viewer/mapper.d.ts +3 -0
- package/dist/short-videos/short-video-viewer/mapper.js +56 -0
- package/dist/short-videos/short-video-viewer/operations.generated.d.ts +56 -0
- package/dist/short-videos/short-video-viewer/operations.generated.js +151 -0
- package/dist/short-videos/short-video-viewer/operations.graphql +53 -0
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.d.ts +12 -0
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.js +10 -0
- package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.d.ts +13 -0
- package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +10 -0
- package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.d.ts +7 -0
- package/dist/short-videos/short-video-viewer/short-video-product-localization.svelte.js +11 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +13 -0
- package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +10 -0
- package/dist/short-videos/short-video-viewer/types.d.ts +40 -0
- package/dist/short-videos/short-video-viewer/types.js +1 -0
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.d.ts +12 -0
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +26 -0
- package/dist/short-videos/short-videos-player/action-button.svelte +38 -0
- package/dist/short-videos/short-videos-player/action-button.svelte.d.ts +10 -0
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +91 -0
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +13 -0
- package/dist/short-videos/short-videos-player/controls.svelte +222 -0
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +15 -0
- package/dist/short-videos/short-videos-player/index.d.ts +31 -0
- package/dist/short-videos/short-videos-player/index.js +40 -0
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +8 -0
- package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +6 -0
- package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +16 -0
- package/dist/short-videos/short-videos-player/ui-manager.svelte.js +25 -0
- package/dist/streams/layout/cmp.layout.svelte +34 -0
- package/dist/streams/layout/cmp.layout.svelte.d.ts +9 -0
- package/dist/streams/layout/cmp.slot-content.svelte +32 -0
- package/dist/streams/layout/cmp.slot-content.svelte.d.ts +13 -0
- package/dist/streams/layout/cmp.slot.svelte +26 -0
- package/dist/streams/layout/cmp.slot.svelte.d.ts +9 -0
- package/dist/streams/layout/component.d.ts +6 -0
- package/dist/streams/layout/component.js +1 -0
- package/dist/streams/layout/css-values.d.ts +10 -0
- package/dist/streams/layout/css-values.js +1 -0
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +16 -0
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +11 -0
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +38 -0
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +30 -0
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +97 -0
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +11 -0
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +6 -0
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +10 -0
- package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte +45 -0
- package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +68 -0
- package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +17 -0
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte +23 -0
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +8 -0
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +7 -0
- package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +3 -0
- package/dist/streams/layout/element-views/data-by-key-accessor.js +55 -0
- package/dist/streams/layout/element-views/index.d.ts +11 -0
- package/dist/streams/layout/element-views/index.js +9 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.d.ts +9 -0
- package/dist/streams/layout/element-views/price-stream-element-localization.svelte.js +8 -0
- package/dist/streams/layout/element-views/stream-element-localization.svelte.d.ts +8 -0
- package/dist/streams/layout/element-views/stream-element-localization.svelte.js +6 -0
- package/dist/streams/layout/elements.d.ts +51 -0
- package/dist/streams/layout/elements.js +1 -0
- package/dist/streams/layout/enums.d.ts +45 -0
- package/dist/streams/layout/enums.js +54 -0
- package/dist/streams/layout/index.d.ts +19 -0
- package/dist/streams/layout/index.js +15 -0
- package/dist/streams/layout/layout.d.ts +13 -0
- package/dist/streams/layout/layout.js +1 -0
- package/dist/streams/layout/models/index.d.ts +6 -0
- package/dist/streams/layout/models/index.js +1 -0
- package/dist/streams/layout/models/mapper.d.ts +3 -0
- package/dist/streams/layout/models/mapper.js +62 -0
- package/dist/streams/layout/models/stream-layout-blob-model.d.ts +4 -0
- package/dist/streams/layout/models/stream-layout-blob-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +6 -0
- package/dist/streams/layout/models/stream-layout-media-item-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +11 -0
- package/dist/streams/layout/models/stream-layout-post-header-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-product-model.d.ts +19 -0
- package/dist/streams/layout/models/stream-layout-product-model.js +1 -0
- package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +31 -0
- package/dist/streams/layout/models/stream-layout-short-video-model.js +1 -0
- package/dist/streams/layout/serializer.d.ts +3 -0
- package/dist/streams/layout/serializer.js +6 -0
- package/dist/streams/layout/slot-data-input.d.ts +14 -0
- package/dist/streams/layout/slot-data-input.js +1 -0
- package/dist/streams/layout/slot-data.d.ts +18 -0
- package/dist/streams/layout/slot-data.js +1 -0
- package/dist/streams/layout/slot.d.ts +16 -0
- package/dist/streams/layout/slot.js +1 -0
- package/dist/streams/layout/styles-transformer.d.ts +13 -0
- package/dist/streams/layout/styles-transformer.js +140 -0
- package/dist/streams/layout/styles.d.ts +43 -0
- package/dist/streams/layout/styles.js +1 -0
- package/dist/streams/layout/type-guards.d.ts +8 -0
- package/dist/streams/layout/type-guards.js +21 -0
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +13 -0
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +11 -0
- package/dist/streams/stream-page-viewer/index.d.ts +2 -0
- package/dist/streams/stream-page-viewer/index.js +1 -0
- package/dist/streams/stream-page-viewer/mapper.d.ts +3 -0
- package/dist/streams/stream-page-viewer/mapper.js +22 -0
- package/dist/streams/stream-page-viewer/operations.generated.d.ts +10 -0
- package/dist/streams/stream-page-viewer/operations.generated.js +27 -0
- package/dist/streams/stream-page-viewer/operations.graphql +8 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +13 -0
- package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +10 -0
- package/dist/streams/stream-page-viewer/types.d.ts +18 -0
- package/dist/streams/stream-page-viewer/types.js +1 -0
- package/dist/streams/stream-player/action-button.svelte +38 -0
- package/dist/streams/stream-player/action-button.svelte.d.ts +10 -0
- package/dist/streams/stream-player/cmp.stream-player.svelte +164 -0
- package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +19 -0
- package/dist/streams/stream-player/controls.svelte +236 -0
- package/dist/streams/stream-player/controls.svelte.d.ts +15 -0
- package/dist/streams/stream-player/index.d.ts +37 -0
- package/dist/streams/stream-player/index.js +50 -0
- package/dist/streams/stream-player/mapper.d.ts +3 -0
- package/dist/streams/stream-player/mapper.js +15 -0
- package/dist/streams/stream-player/operations.generated.d.ts +65 -0
- package/dist/streams/stream-player/operations.generated.js +196 -0
- package/dist/streams/stream-player/operations.graphql +35 -0
- package/dist/streams/stream-player/stream-overview.svelte +239 -0
- package/dist/streams/stream-player/stream-overview.svelte.d.ts +17 -0
- package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +25 -0
- package/dist/streams/stream-player/stream-player-buffer.svelte.js +84 -0
- package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +12 -0
- package/dist/streams/stream-player/stream-player-localization.svelte.js +10 -0
- package/dist/streams/stream-player/types.d.ts +12 -0
- package/dist/streams/stream-player/types.js +1 -0
- package/dist/streams/stream-player/ui-manager.svelte.d.ts +17 -0
- package/dist/streams/stream-player/ui-manager.svelte.js +26 -0
- package/dist/ui/button/cmp.button.svelte +10 -0
- package/dist/ui/button/cmp.button.svelte.d.ts +16 -0
- package/dist/ui/button/index.d.ts +2 -0
- package/dist/ui/button/index.js +2 -0
- package/dist/ui/button/resources/button-base.svelte +84 -0
- package/dist/ui/button/resources/button-base.svelte.d.ts +13 -0
- package/dist/ui/button/resources/button-theme.svelte +204 -0
- package/dist/ui/button/resources/button-theme.svelte.d.ts +10 -0
- package/dist/ui/button/resources/button-types.d.ts +21 -0
- package/dist/ui/button/resources/button-types.js +23 -0
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte +5 -0
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte.d.ts +7 -0
- package/dist/ui/dynamic-component/index.d.ts +2 -0
- package/dist/ui/dynamic-component/index.js +2 -0
- package/dist/ui/dynamic-component/types.svelte.d.ts +11 -0
- package/dist/ui/dynamic-component/types.svelte.js +13 -0
- package/dist/ui/icon/cmp.icon.svelte +113 -0
- package/dist/ui/icon/cmp.icon.svelte.d.ts +8 -0
- package/dist/ui/icon/index.d.ts +2 -0
- package/dist/ui/icon/index.js +2 -0
- package/dist/ui/icon/types.d.ts +9 -0
- package/dist/ui/icon/types.js +10 -0
- package/dist/ui/image/cmp.image-round.svelte +41 -0
- package/dist/ui/image/cmp.image-round.svelte.d.ts +11 -0
- package/dist/ui/image/cmp.image-rounded.svelte +71 -0
- package/dist/ui/image/cmp.image-rounded.svelte.d.ts +11 -0
- package/dist/ui/image/cmp.image-stub.svelte +34 -0
- package/dist/ui/image/cmp.image-stub.svelte.d.ts +18 -0
- package/dist/ui/image/cmp.image.svelte +82 -0
- package/dist/ui/image/cmp.image.svelte.d.ts +13 -0
- package/dist/ui/image/image-state.d.ts +6 -0
- package/dist/ui/image/image-state.js +17 -0
- package/dist/ui/image/index.d.ts +4 -0
- package/dist/ui/image/index.js +4 -0
- package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte +84 -0
- package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte.d.ts +11 -0
- package/dist/ui/infinite-scrolling/index.d.ts +1 -0
- package/dist/ui/infinite-scrolling/index.js +1 -0
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +89 -0
- package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +12 -0
- package/dist/ui/line-clamp/index.d.ts +2 -0
- package/dist/ui/line-clamp/index.js +2 -0
- package/dist/ui/line-clamp/line-clamp-localization.svelte.d.ts +9 -0
- package/dist/ui/line-clamp/line-clamp-localization.svelte.js +15 -0
- package/dist/ui/line-clamp/line-clamp-types.d.ts +3 -0
- package/dist/ui/line-clamp/line-clamp-types.js +1 -0
- package/dist/ui/line-clamp/line-clamp-utils.d.ts +8 -0
- package/dist/ui/line-clamp/line-clamp-utils.js +33 -0
- package/dist/ui/loading/cmp.loading.svelte +97 -0
- package/dist/ui/loading/cmp.loading.svelte.d.ts +9 -0
- package/dist/ui/loading/index.d.ts +1 -0
- package/dist/ui/loading/index.js +1 -0
- package/dist/ui/media-item-view/cmp.media-item-view.svelte +91 -0
- package/dist/ui/media-item-view/cmp.media-item-view.svelte.d.ts +13 -0
- package/dist/ui/media-item-view/index.d.ts +1 -0
- package/dist/ui/media-item-view/index.js +1 -0
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte +278 -0
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte.d.ts +13 -0
- package/dist/ui/media-items-gallery/index.d.ts +1 -0
- package/dist/ui/media-items-gallery/index.js +1 -0
- package/dist/ui/media-items-gallery/types.d.ts +12 -0
- package/dist/ui/media-items-gallery/types.js +35 -0
- package/dist/ui/media-playback/index.d.ts +2 -0
- package/dist/ui/media-playback/index.js +2 -0
- package/dist/ui/media-playback/playback-manager.svelte.d.ts +25 -0
- package/dist/ui/media-playback/playback-manager.svelte.js +62 -0
- package/dist/ui/media-playback/volume-manager.svelte.d.ts +10 -0
- package/dist/ui/media-playback/volume-manager.svelte.js +27 -0
- package/dist/ui/player/cmp.player-slider.svelte +161 -0
- package/dist/ui/player/cmp.player-slider.svelte.d.ts +33 -0
- package/dist/ui/player/index.d.ts +4 -0
- package/dist/ui/player/index.js +3 -0
- package/dist/ui/player/player-buffer.svelte.d.ts +28 -0
- package/dist/ui/player/player-buffer.svelte.js +64 -0
- package/dist/ui/player/prevent-slider-scroll.d.ts +5 -0
- package/dist/ui/player/prevent-slider-scroll.js +11 -0
- package/dist/ui/player/types.d.ts +14 -0
- package/dist/ui/player/types.js +1 -0
- package/dist/ui/progress/cmp.progress.svelte +37 -0
- package/dist/ui/progress/cmp.progress.svelte.d.ts +6 -0
- package/dist/ui/progress/index.d.ts +1 -0
- package/dist/ui/progress/index.js +1 -0
- package/dist/ui/proportional-container/cmp.proportional-container.svelte +39 -0
- package/dist/ui/proportional-container/cmp.proportional-container.svelte.d.ts +8 -0
- package/dist/ui/proportional-container/index.d.ts +1 -0
- package/dist/ui/proportional-container/index.js +1 -0
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +63 -0
- package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +12 -0
- package/dist/ui/seek-bar/index.d.ts +1 -0
- package/dist/ui/seek-bar/index.js +1 -0
- package/dist/ui/shadow-dom/_normalize.scss +350 -0
- package/dist/ui/shadow-dom/_reset.scss +189 -0
- package/dist/ui/shadow-dom/index.d.ts +1 -0
- package/dist/ui/shadow-dom/index.js +1 -0
- package/dist/ui/shadow-dom/shadow-host.d.ts +11 -0
- package/dist/ui/shadow-dom/shadow-host.js +45 -0
- package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte +120 -0
- package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte.d.ts +18 -0
- package/dist/ui/spotlight-layout/index.d.ts +1 -0
- package/dist/ui/spotlight-layout/index.js +1 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte +69 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +9 -0
- package/dist/ui/time-ago/index.d.ts +2 -0
- package/dist/ui/time-ago/index.js +1 -0
- package/dist/ui/time-ago/time-ago-localization.svelte.d.ts +21 -0
- package/dist/ui/time-ago/time-ago-localization.svelte.js +39 -0
- package/dist/ui/video/cmp.video.svelte +377 -0
- package/dist/ui/video/cmp.video.svelte.d.ts +24 -0
- package/dist/ui/video/index.d.ts +1 -0
- package/dist/ui/video/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Utils } from '../../core/utils';
|
|
2
|
+
import { StreamCssValueType, StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
|
|
3
|
+
export const generateStreamLayoutStyles = (styles) => {
|
|
4
|
+
if (!styles) {
|
|
5
|
+
return '';
|
|
6
|
+
}
|
|
7
|
+
const values = [`background-color: ${transformColorValue(styles.backgroundColor)};`, `font-family: ${mapFontFamily(styles.fontFamily)};`];
|
|
8
|
+
return values.join('');
|
|
9
|
+
};
|
|
10
|
+
export const generateContainerStyles = (styles) => {
|
|
11
|
+
styles = styles || {};
|
|
12
|
+
const values = [
|
|
13
|
+
'display: flex;',
|
|
14
|
+
'flex-direction: column;',
|
|
15
|
+
`width: ${transformCssValue(styles.width, 'auto')};`,
|
|
16
|
+
`height: ${transformCssValue(styles.height, 'fit-content')};`,
|
|
17
|
+
`aspect-ratio: ${styles.aspectRatio || 'auto'};`,
|
|
18
|
+
`gap: ${transformNumericValue(styles.gap)};`,
|
|
19
|
+
`padding-top: ${transformNumericValue(styles.paddingTop)};`,
|
|
20
|
+
`padding-right: ${transformNumericValue(styles.paddingRight)};`,
|
|
21
|
+
`padding-bottom: ${transformNumericValue(styles.paddingBottom)};`,
|
|
22
|
+
`padding-left: ${transformNumericValue(styles.paddingLeft)};`,
|
|
23
|
+
`background-color: ${transformColorValue(styles.backgroundColor)};`,
|
|
24
|
+
`border-width: ${styles.borderColor ? '1px' : '0'};`,
|
|
25
|
+
`border-radius: ${transformNumericValue(styles.borderRadius)};`,
|
|
26
|
+
`border-color: ${transformColorValue(styles.borderColor)};`,
|
|
27
|
+
`overflow: ${styles.borderRadius ? 'hidden' : 'visible'};`
|
|
28
|
+
];
|
|
29
|
+
if (styles.direction) {
|
|
30
|
+
values.push(`display: flex;`);
|
|
31
|
+
values.push(`flex-direction: ${styles.direction === StreamElementStyleDirection.Horizontal ? 'row' : 'column'};`);
|
|
32
|
+
}
|
|
33
|
+
return values.join('');
|
|
34
|
+
};
|
|
35
|
+
export const generateTextStyles = (styles) => {
|
|
36
|
+
styles = styles || {};
|
|
37
|
+
const values = [
|
|
38
|
+
`font-family: ${mapFontFamily(styles.fontFamily)};`,
|
|
39
|
+
`font-size: ${transformFontSizeValue(styles.fontSize)};`,
|
|
40
|
+
`font-weight: ${mapFontWeight(styles.fontWeight)};`,
|
|
41
|
+
`line-height: ${transformNumericValue(styles.lineHeight, '1.2')};`,
|
|
42
|
+
`text-align: ${mapTextAlign(styles.textAlign)};`,
|
|
43
|
+
`color: ${transformColorValue(styles.color)};`
|
|
44
|
+
];
|
|
45
|
+
return values.join('');
|
|
46
|
+
};
|
|
47
|
+
export const generateImageStyles = (styles) => {
|
|
48
|
+
styles = styles || {};
|
|
49
|
+
const imageStyles = [`object-fit: ${mapMediaFit(styles.mediaFit)};`];
|
|
50
|
+
return imageStyles.join('');
|
|
51
|
+
};
|
|
52
|
+
export const mapFontFamily = (value) => {
|
|
53
|
+
switch (value) {
|
|
54
|
+
case StreamElementStyleFontFamily.System:
|
|
55
|
+
return 'inherit';
|
|
56
|
+
default: {
|
|
57
|
+
return 'inherit';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export const mapFontWeight = (value) => {
|
|
62
|
+
switch (value) {
|
|
63
|
+
case StreamElementStyleFontWeight.Bold:
|
|
64
|
+
return '600';
|
|
65
|
+
case StreamElementStyleFontWeight.SemiBold:
|
|
66
|
+
return '500';
|
|
67
|
+
default: {
|
|
68
|
+
return 'normal';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export const mapTextAlign = (value) => {
|
|
73
|
+
switch (value) {
|
|
74
|
+
case StreamElementStyleHorizontalAlign.Left:
|
|
75
|
+
return 'left';
|
|
76
|
+
case StreamElementStyleHorizontalAlign.Center:
|
|
77
|
+
return 'center';
|
|
78
|
+
case StreamElementStyleHorizontalAlign.Right:
|
|
79
|
+
return 'right';
|
|
80
|
+
default: {
|
|
81
|
+
return 'left';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export const mapFlexJustifyContent = (value) => {
|
|
86
|
+
switch (value) {
|
|
87
|
+
case StreamElementStyleHorizontalAlign.Left:
|
|
88
|
+
return 'flex-start';
|
|
89
|
+
case StreamElementStyleHorizontalAlign.Center:
|
|
90
|
+
return 'center';
|
|
91
|
+
case StreamElementStyleHorizontalAlign.Right:
|
|
92
|
+
return 'flex-end';
|
|
93
|
+
default: {
|
|
94
|
+
return 'flex-start';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const mapMediaFit = (value) => {
|
|
99
|
+
switch (value) {
|
|
100
|
+
case StreamElementStyleMediaFit.Cover:
|
|
101
|
+
return 'cover';
|
|
102
|
+
case StreamElementStyleMediaFit.Contain:
|
|
103
|
+
return 'contain';
|
|
104
|
+
default: {
|
|
105
|
+
return 'cover';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const transformCssValue = (value, fallback = '0') => {
|
|
110
|
+
if (value === null || value === undefined) {
|
|
111
|
+
return fallback;
|
|
112
|
+
}
|
|
113
|
+
switch (value.type) {
|
|
114
|
+
case StreamCssValueType.DDU:
|
|
115
|
+
return transformNumericValue(value.value, fallback);
|
|
116
|
+
case StreamCssValueType.Pct:
|
|
117
|
+
return `${value.value}%`;
|
|
118
|
+
default:
|
|
119
|
+
Utils.assertUnreachable(value);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
export const transformFontSizeValue = (value) => {
|
|
123
|
+
if (value === null || value === undefined) {
|
|
124
|
+
value = 16;
|
|
125
|
+
}
|
|
126
|
+
return transformNumericValue(value);
|
|
127
|
+
};
|
|
128
|
+
const baseContainerWidth = 400;
|
|
129
|
+
export const transformNumericValue = (value, fallback = '0') => {
|
|
130
|
+
if (value === null || value === undefined) {
|
|
131
|
+
return fallback;
|
|
132
|
+
}
|
|
133
|
+
return `${(value / baseContainerWidth) * 100}cqi`;
|
|
134
|
+
};
|
|
135
|
+
export const transformColorValue = (value) => {
|
|
136
|
+
if (value === null || value === undefined) {
|
|
137
|
+
return 'transparent';
|
|
138
|
+
}
|
|
139
|
+
return value;
|
|
140
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { StreamCssValue } from './css-values';
|
|
2
|
+
import { StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
|
|
3
|
+
export type StreamLayoutStyles = {
|
|
4
|
+
backgroundColor?: string | null;
|
|
5
|
+
fontFamily?: StreamElementStyleFontFamily | null;
|
|
6
|
+
};
|
|
7
|
+
export type ImageStreamElementStyles = {
|
|
8
|
+
mediaFit?: StreamElementStyleMediaFit | null;
|
|
9
|
+
};
|
|
10
|
+
export type PriceStreamElementStyles = {
|
|
11
|
+
height?: number | null;
|
|
12
|
+
fontWeight?: StreamElementStyleFontWeight | null;
|
|
13
|
+
fontFamily?: StreamElementStyleFontFamily | null;
|
|
14
|
+
regularPriceColor?: string | null;
|
|
15
|
+
salePriceColor?: string | null;
|
|
16
|
+
saveValueColor?: string | null;
|
|
17
|
+
saveValueBackgroundColor?: string | null;
|
|
18
|
+
beforeValueColor?: string | null;
|
|
19
|
+
horizontalAlign?: StreamElementStyleHorizontalAlign | null;
|
|
20
|
+
};
|
|
21
|
+
export type TextStreamElementStyles = {
|
|
22
|
+
fontSize?: number | null;
|
|
23
|
+
fontWeight?: StreamElementStyleFontWeight | null;
|
|
24
|
+
fontFamily?: StreamElementStyleFontFamily | null;
|
|
25
|
+
lineHeight?: number | null;
|
|
26
|
+
textAlign?: StreamElementStyleHorizontalAlign | null;
|
|
27
|
+
color?: string | null;
|
|
28
|
+
maxLines?: number | null;
|
|
29
|
+
};
|
|
30
|
+
export type ContainerStreamElementStyles = {
|
|
31
|
+
width?: StreamCssValue | null;
|
|
32
|
+
height?: StreamCssValue | null;
|
|
33
|
+
aspectRatio?: number | null;
|
|
34
|
+
direction?: StreamElementStyleDirection | null;
|
|
35
|
+
gap?: number | null;
|
|
36
|
+
paddingTop?: number | null;
|
|
37
|
+
paddingRight?: number | null;
|
|
38
|
+
paddingBottom?: number | null;
|
|
39
|
+
paddingLeft?: number | null;
|
|
40
|
+
backgroundColor?: string | null;
|
|
41
|
+
borderRadius?: number | null;
|
|
42
|
+
borderColor?: string | null;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { StreamElementStyleDirection, StreamElementStyleFontFamily, StreamElementStyleFontWeight, StreamElementStyleMediaFit, StreamElementStyleHorizontalAlign } from './enums';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ImagesStreamSlotData, ProductStreamSlotData, ShortVideoStreamSlotData, StreamSlotData } from './slot-data';
|
|
2
|
+
import type { ImagesStreamSlotDataInput, ProductStreamSlotDataInput, ShortVideoStreamSlotDataInput, StreamSlotDataInput } from './slot-data-input';
|
|
3
|
+
export declare function isImagesSlotDataInput(data: StreamSlotDataInput | null): data is ImagesStreamSlotDataInput;
|
|
4
|
+
export declare function isProductSlotDataInput(data: StreamSlotDataInput | null): data is ProductStreamSlotDataInput;
|
|
5
|
+
export declare function isShortVideoSlotDataInput(data: StreamSlotDataInput | null): data is ShortVideoStreamSlotDataInput;
|
|
6
|
+
export declare function isImagesSlotData(data: StreamSlotData | null): data is ImagesStreamSlotData;
|
|
7
|
+
export declare function isProductSlotData(data: StreamSlotData | null): data is ProductStreamSlotData;
|
|
8
|
+
export declare function isShortVideoSlotData(data: StreamSlotData | null): data is ShortVideoStreamSlotData;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StreamComponentDataType } from './enums';
|
|
2
|
+
// SlotDataInput guards
|
|
3
|
+
export function isImagesSlotDataInput(data) {
|
|
4
|
+
return data?.type === StreamComponentDataType.Images;
|
|
5
|
+
}
|
|
6
|
+
export function isProductSlotDataInput(data) {
|
|
7
|
+
return data?.type === StreamComponentDataType.Product;
|
|
8
|
+
}
|
|
9
|
+
export function isShortVideoSlotDataInput(data) {
|
|
10
|
+
return data?.type === StreamComponentDataType.ShortVideo;
|
|
11
|
+
}
|
|
12
|
+
// SlotData guards
|
|
13
|
+
export function isImagesSlotData(data) {
|
|
14
|
+
return data?.type === StreamComponentDataType.Images;
|
|
15
|
+
}
|
|
16
|
+
export function isProductSlotData(data) {
|
|
17
|
+
return data?.type === StreamComponentDataType.Product;
|
|
18
|
+
}
|
|
19
|
+
export function isShortVideoSlotData(data) {
|
|
20
|
+
return data?.type === StreamComponentDataType.ShortVideo;
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">import { StreamLayoutSlot, StreamPageLayout, StreamLayoutSlotContent } from '../layout';
|
|
2
|
+
let { page, on } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
{#if page.type === 'general'}
|
|
6
|
+
<StreamPageLayout model={page.layout}>
|
|
7
|
+
{#each page.layout.slots as slot (slot)}
|
|
8
|
+
<StreamLayoutSlot model={slot}>
|
|
9
|
+
<StreamLayoutSlotContent model={slot} on={on} />
|
|
10
|
+
</StreamLayoutSlot>
|
|
11
|
+
{/each}
|
|
12
|
+
</StreamPageLayout>
|
|
13
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StreamPageViewerModel } from './types';
|
|
2
|
+
type Props = {
|
|
3
|
+
page: StreamPageViewerModel;
|
|
4
|
+
on?: {
|
|
5
|
+
productClick: (productId: string) => void;
|
|
6
|
+
progress?: (videoId: string, progress: number) => void;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
11
|
+
export default Cmp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StreamPageViewer } from './cmp.stream-page-viewer.svelte';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getSingleShortVideoFromLayout, parseToStreamLayout } from '../layout';
|
|
2
|
+
export const mapToStreamPageViewerModel = (payload) => {
|
|
3
|
+
const layout = parseToStreamLayout(payload.layout);
|
|
4
|
+
const singleShortVideo = getSingleShortVideoFromLayout(layout);
|
|
5
|
+
if (singleShortVideo) {
|
|
6
|
+
return {
|
|
7
|
+
type: 'short-video',
|
|
8
|
+
id: payload.id,
|
|
9
|
+
cover: payload.cover?.url || null,
|
|
10
|
+
name: payload.name,
|
|
11
|
+
shortVideo: singleShortVideo,
|
|
12
|
+
layout
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
type: 'general',
|
|
17
|
+
id: payload.id,
|
|
18
|
+
cover: payload.cover?.url || null,
|
|
19
|
+
name: payload.name,
|
|
20
|
+
layout
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
export type StreamPageViewerPayloadFragment = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string | null;
|
|
5
|
+
layout: string;
|
|
6
|
+
cover: {
|
|
7
|
+
url: string;
|
|
8
|
+
} | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const StreamPageViewerPayloadFragmentDoc: DocumentNode<StreamPageViewerPayloadFragment, unknown>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const StreamPageViewerPayloadFragmentDoc = {
|
|
2
|
+
kind: 'Document',
|
|
3
|
+
definitions: [
|
|
4
|
+
{
|
|
5
|
+
kind: 'FragmentDefinition',
|
|
6
|
+
name: { kind: 'Name', value: 'StreamPageViewerPayloadFragment' },
|
|
7
|
+
typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'StreamPage' } },
|
|
8
|
+
selectionSet: {
|
|
9
|
+
kind: 'SelectionSet',
|
|
10
|
+
selections: [
|
|
11
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'id' } },
|
|
12
|
+
{
|
|
13
|
+
kind: 'Field',
|
|
14
|
+
name: { kind: 'Name', value: 'cover' },
|
|
15
|
+
selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'url' } }] }
|
|
16
|
+
},
|
|
17
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
|
|
18
|
+
{
|
|
19
|
+
kind: 'Field',
|
|
20
|
+
name: { kind: 'Name', value: 'layout' },
|
|
21
|
+
arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'scale' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'image_scale' } } }]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IStreamElementLocalization } from '../layout/element-views';
|
|
2
|
+
import type { ITimeAgoLocalization } from '../../ui/time-ago';
|
|
3
|
+
export interface IStreamPageViewerLocalization {
|
|
4
|
+
viewsCount?: (count: number) => string;
|
|
5
|
+
timeAgoLocalization?: ITimeAgoLocalization;
|
|
6
|
+
elementsLocalization?: IStreamElementLocalization;
|
|
7
|
+
}
|
|
8
|
+
export declare class StreamPageViewerLocalization {
|
|
9
|
+
viewsCount: (count: number) => string;
|
|
10
|
+
timeAgoLocalization: ITimeAgoLocalization | undefined;
|
|
11
|
+
elementsLocalization: IStreamElementLocalization | undefined;
|
|
12
|
+
constructor(init?: IStreamPageViewerLocalization);
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class StreamPageViewerLocalization {
|
|
2
|
+
viewsCount = $state((count) => (count === 1 ? '1 view' : `${count} views`));
|
|
3
|
+
timeAgoLocalization = $state(undefined);
|
|
4
|
+
elementsLocalization = $state(undefined);
|
|
5
|
+
constructor(init) {
|
|
6
|
+
this.viewsCount = init?.viewsCount ?? this.viewsCount;
|
|
7
|
+
this.timeAgoLocalization = init?.timeAgoLocalization ?? this.timeAgoLocalization;
|
|
8
|
+
this.elementsLocalization = init?.elementsLocalization ?? this.elementsLocalization;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StreamLayout } from '../layout';
|
|
2
|
+
import type { StreamLayoutShortVideoModel } from '../layout/models';
|
|
3
|
+
export type StreamPageViewerModel = GeneralStreamPageViewerModel | ShortVideoStreamPageViewerModel;
|
|
4
|
+
export type ShortVideoStreamPageViewerModel = {
|
|
5
|
+
type: 'short-video';
|
|
6
|
+
id: string;
|
|
7
|
+
cover: string | null;
|
|
8
|
+
name: string | null;
|
|
9
|
+
shortVideo: StreamLayoutShortVideoModel;
|
|
10
|
+
layout: StreamLayout;
|
|
11
|
+
};
|
|
12
|
+
export type GeneralStreamPageViewerModel = {
|
|
13
|
+
type: 'general';
|
|
14
|
+
id: string;
|
|
15
|
+
cover: string | null;
|
|
16
|
+
name: string | null;
|
|
17
|
+
layout: StreamLayout;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">let { children, on } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<button type="button" class="action-button" onclick={() => on.click()}>
|
|
6
|
+
{@render children()}
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<style>@keyframes fadeIn {
|
|
10
|
+
0% {
|
|
11
|
+
opacity: 1;
|
|
12
|
+
}
|
|
13
|
+
50% {
|
|
14
|
+
opacity: 0.4;
|
|
15
|
+
}
|
|
16
|
+
100% {
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
.action-button {
|
|
21
|
+
--_stream-player--action-button--size: var(--stream-player--action-button--size);
|
|
22
|
+
--_action-button--background: var(--action-button-background, #1c1c1c);
|
|
23
|
+
width: var(--_stream-player--action-button--size);
|
|
24
|
+
min-width: var(--_stream-player--action-button--size);
|
|
25
|
+
max-width: var(--_stream-player--action-button--size);
|
|
26
|
+
height: var(--_stream-player--action-button--size);
|
|
27
|
+
min-height: var(--_stream-player--action-button--size);
|
|
28
|
+
max-height: var(--_stream-player--action-button--size);
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
align-items: center;
|
|
32
|
+
line-height: 0;
|
|
33
|
+
background: var(--_action-button--background);
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
--icon--size: 1.25rem;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
color: #ffffff;
|
|
38
|
+
}</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
on: {
|
|
4
|
+
click: () => void;
|
|
5
|
+
};
|
|
6
|
+
children: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const ActionButton: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ActionButton = ReturnType<typeof ActionButton>;
|
|
10
|
+
export default ActionButton;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script lang="ts">var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { toastrWarning } from '../../core/toastr';
|
|
11
|
+
import { ShortVideoViewer } from '../../short-videos/short-video-viewer';
|
|
12
|
+
import { mapToShortVideoViewerModel } from '../layout/models';
|
|
13
|
+
import { StreamPageViewer } from '../stream-page-viewer';
|
|
14
|
+
import { Loading } from '../../ui/loading';
|
|
15
|
+
import { PlayerSlider } from '../../ui/player';
|
|
16
|
+
import { SpotlightLayout } from '../../ui/spotlight-layout';
|
|
17
|
+
import { default as Controls } from './controls.svelte';
|
|
18
|
+
import { mapStreamPlayerModel } from './mapper';
|
|
19
|
+
import { GetStreamDocument } from './operations.generated';
|
|
20
|
+
import { default as Overview } from './stream-overview.svelte';
|
|
21
|
+
import { StreamPlayerBuffer } from './stream-player-buffer.svelte';
|
|
22
|
+
import { StreamPlayerLocalization } from './stream-player-localization.svelte';
|
|
23
|
+
import { StreamPlayerUiManager } from './ui-manager.svelte';
|
|
24
|
+
import { onDestroy, onMount } from 'svelte';
|
|
25
|
+
let { streamId, graphql, localization: localizationInit, on } = $props();
|
|
26
|
+
const localization = $derived(new StreamPlayerLocalization(localizationInit));
|
|
27
|
+
let model = $state(null);
|
|
28
|
+
let buffer = $state.raw(null);
|
|
29
|
+
let loading = $state(true);
|
|
30
|
+
let activePageId = $derived.by(() => { var _a, _b; return (_b = (_a = buffer === null || buffer === void 0 ? void 0 : buffer.current) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ''; });
|
|
31
|
+
const uiManager = new StreamPlayerUiManager();
|
|
32
|
+
onMount(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
uiManager.overviewCollapsed = window && window.innerWidth < window.innerHeight;
|
|
35
|
+
try {
|
|
36
|
+
const streamPayload = yield graphql.query(GetStreamDocument, { id: streamId }).toPromise();
|
|
37
|
+
if (!((_a = streamPayload.data) === null || _a === void 0 ? void 0 : _a.stream)) {
|
|
38
|
+
toastrWarning(localization.streamNotFound);
|
|
39
|
+
(_b = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _b === void 0 ? void 0 : _b.call(on);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
(_c = on === null || on === void 0 ? void 0 : on.streamActivated) === null || _c === void 0 ? void 0 : _c.call(on, {
|
|
43
|
+
title: streamPayload.data.stream.title,
|
|
44
|
+
image: ((_d = streamPayload.data.stream.cover) === null || _d === void 0 ? void 0 : _d.url) || null
|
|
45
|
+
});
|
|
46
|
+
// start tracking the stream
|
|
47
|
+
model = mapStreamPlayerModel(streamPayload.data.stream);
|
|
48
|
+
buffer = new StreamPlayerBuffer({ graphql, streamId });
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
loading = false;
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
onDestroy(() => {
|
|
55
|
+
// end tracking the stream
|
|
56
|
+
});
|
|
57
|
+
const handleChangePage = (index) => {
|
|
58
|
+
if (!buffer) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
buffer.setIndex(index);
|
|
62
|
+
if (uiManager.isMobileView) {
|
|
63
|
+
uiManager.overviewCollapsed = true;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleDimensionsChanged = (dimensions) => {
|
|
67
|
+
uiManager.updateDimensions({
|
|
68
|
+
mainViewColumnWidth: dimensions.mainSceneWidth,
|
|
69
|
+
viewTotalWidth: dimensions.totalWidth
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<div class="stream-player-container">
|
|
75
|
+
{#if loading}
|
|
76
|
+
<Loading positionAbsoluteCenter={true} timeout={600} />
|
|
77
|
+
{/if}
|
|
78
|
+
<div class="stream-player" style={uiManager.globalCssVariables}>
|
|
79
|
+
{#if buffer && model}
|
|
80
|
+
<SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
|
|
81
|
+
<div class="stream-player__content">
|
|
82
|
+
<PlayerSlider buffer={buffer}>
|
|
83
|
+
{#snippet children({ item })}
|
|
84
|
+
{#if item.type === 'general'}
|
|
85
|
+
<StreamPageViewer
|
|
86
|
+
page={item}
|
|
87
|
+
on={{
|
|
88
|
+
progress: (videoId: string, progress: number) => on?.progress?.(videoId, progress),
|
|
89
|
+
productClick: (productId: string) => on?.productClick?.(productId)
|
|
90
|
+
}} />
|
|
91
|
+
{:else if item.type === 'short-video'}
|
|
92
|
+
<ShortVideoViewer
|
|
93
|
+
model={mapToShortVideoViewerModel(item.shortVideo)}
|
|
94
|
+
on={{
|
|
95
|
+
progress: (progress: number) => on?.progress?.(item.id, progress)
|
|
96
|
+
}}
|
|
97
|
+
autoplay="on-appearance"
|
|
98
|
+
showAttachments={uiManager.showShortVideoOverlay} />
|
|
99
|
+
{/if}
|
|
100
|
+
{/snippet}
|
|
101
|
+
</PlayerSlider>
|
|
102
|
+
</div>
|
|
103
|
+
</SpotlightLayout>
|
|
104
|
+
{#if model}
|
|
105
|
+
<Overview
|
|
106
|
+
model={model}
|
|
107
|
+
buffer={buffer}
|
|
108
|
+
activePageId={activePageId}
|
|
109
|
+
uiManager={uiManager}
|
|
110
|
+
localization={localization}
|
|
111
|
+
on={{ setCurrentItem: handleChangePage }} />
|
|
112
|
+
{/if}
|
|
113
|
+
<Controls
|
|
114
|
+
buffer={buffer}
|
|
115
|
+
uiManager={uiManager}
|
|
116
|
+
localization={localization}
|
|
117
|
+
on={{
|
|
118
|
+
closePlayer: () => on?.closePlayer?.(),
|
|
119
|
+
productClick: (productId: string) => on?.productClick?.(productId)
|
|
120
|
+
}} />
|
|
121
|
+
{/if}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<style>@keyframes fadeIn {
|
|
126
|
+
0% {
|
|
127
|
+
opacity: 1;
|
|
128
|
+
}
|
|
129
|
+
50% {
|
|
130
|
+
opacity: 0.4;
|
|
131
|
+
}
|
|
132
|
+
100% {
|
|
133
|
+
opacity: 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
.stream-player-container {
|
|
137
|
+
width: 100%;
|
|
138
|
+
min-width: 100%;
|
|
139
|
+
max-width: 100%;
|
|
140
|
+
height: 100%;
|
|
141
|
+
min-height: 100%;
|
|
142
|
+
max-height: 100%;
|
|
143
|
+
container-type: inline-size;
|
|
144
|
+
display: flex;
|
|
145
|
+
position: relative;
|
|
146
|
+
background: #000000;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.stream-player {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex: 1;
|
|
152
|
+
padding: 0.625rem 0;
|
|
153
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
154
|
+
}
|
|
155
|
+
@container (width < 576px) {
|
|
156
|
+
.stream-player {
|
|
157
|
+
padding: 0;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
.stream-player__content {
|
|
161
|
+
width: 100%;
|
|
162
|
+
height: 100%;
|
|
163
|
+
--short-video-viewer--actions-panel--bottom: 5rem;
|
|
164
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type IStreamPlayerLocalization } from './stream-player-localization.svelte';
|
|
2
|
+
import type { Client } from '@urql/core';
|
|
3
|
+
type Props = {
|
|
4
|
+
streamId: string;
|
|
5
|
+
localization?: IStreamPlayerLocalization;
|
|
6
|
+
graphql: Client;
|
|
7
|
+
on?: {
|
|
8
|
+
closePlayer?: () => void;
|
|
9
|
+
streamActivated?: (data: {
|
|
10
|
+
title: string;
|
|
11
|
+
image: string | null;
|
|
12
|
+
}) => void;
|
|
13
|
+
productClick?: (productId: string) => void;
|
|
14
|
+
progress?: (videoId: string, progress: number) => void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
19
|
+
export default Cmp;
|