@streamscloud/embeddable 2.0.4 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/core/continuation-token.d.ts +0 -10
- package/dist/core/continuation-token.js +0 -32
- package/dist/core/cursor-result.d.ts +0 -9
- package/dist/core/cursor-result.js +0 -1
- package/dist/core/data-loaders/cursor-data-loader.svelte.d.ts +0 -14
- package/dist/core/data-loaders/cursor-data-loader.svelte.js +0 -35
- package/dist/core/data-loaders/data-loader.d.ts +0 -4
- package/dist/core/data-loaders/data-loader.js +0 -1
- package/dist/core/data-loaders/index.d.ts +0 -2
- package/dist/core/data-loaders/index.js +0 -1
- package/dist/core/deferred.d.ts +0 -6
- package/dist/core/deferred.js +0 -13
- package/dist/core/enums.d.ts +0 -33
- package/dist/core/enums.js +0 -39
- package/dist/core/graphql.d.ts +0 -1
- package/dist/core/graphql.js +0 -10
- package/dist/core/media/image-helper.d.ts +0 -10
- package/dist/core/media/image-helper.js +0 -30
- package/dist/core/media/images-size-detector.service.d.ts +0 -6
- package/dist/core/media/images-size-detector.service.js +0 -15
- package/dist/core/media/index.d.ts +0 -4
- package/dist/core/media/index.js +0 -4
- package/dist/core/media/media-item-url.service.d.ts +0 -2
- package/dist/core/media/media-item-url.service.js +0 -3
- package/dist/core/media/types.d.ts +0 -13
- package/dist/core/media/types.js +0 -1
- package/dist/core/toastr.d.ts +0 -1
- package/dist/core/toastr.js +0 -26
- package/dist/core/transitions/index.d.ts +0 -1
- package/dist/core/transitions/index.js +0 -1
- package/dist/core/transitions/slide-horizontally.d.ts +0 -7
- package/dist/core/transitions/slide-horizontally.js +0 -55
- package/dist/core/utils/array-helper.d.ts +0 -23
- package/dist/core/utils/array-helper.js +0 -148
- package/dist/core/utils/date-helper.d.ts +0 -29
- package/dist/core/utils/date-helper.js +0 -146
- package/dist/core/utils/dom-helper.d.ts +0 -12
- package/dist/core/utils/dom-helper.js +0 -76
- package/dist/core/utils/html-helper.d.ts +0 -40
- package/dist/core/utils/html-helper.js +0 -97
- package/dist/core/utils/index.d.ts +0 -3
- package/dist/core/utils/index.js +0 -3
- package/dist/core/utils/number-helper.d.ts +0 -6
- package/dist/core/utils/number-helper.js +0 -28
- package/dist/core/utils/string-generator.d.ts +0 -2
- package/dist/core/utils/string-generator.js +0 -15
- package/dist/core/utils/string-helper.d.ts +0 -10
- package/dist/core/utils/string-helper.js +0 -53
- package/dist/core/utils/url-helper.d.ts +0 -3
- package/dist/core/utils/url-helper.js +0 -13
- package/dist/core/utils/utils.d.ts +0 -28
- package/dist/core/utils/utils.js +0 -100
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/products/price-helper.d.ts +0 -4
- package/dist/products/price-helper.js +0 -47
- package/dist/short-videos/short-video-viewer/cmp.ad.svelte +0 -74
- package/dist/short-videos/short-video-viewer/cmp.ad.svelte.d.ts +0 -7
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte +0 -70
- package/dist/short-videos/short-video-viewer/cmp.attachments-inline.svelte.d.ts +0 -7
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +0 -68
- package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +0 -9
- package/dist/short-videos/short-video-viewer/cmp.product.svelte +0 -156
- package/dist/short-videos/short-video-viewer/cmp.product.svelte.d.ts +0 -10
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +0 -124
- package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +0 -10
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +0 -86
- package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +0 -9
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +0 -133
- package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +0 -12
- package/dist/short-videos/short-video-viewer/description.svelte +0 -46
- package/dist/short-videos/short-video-viewer/description.svelte.d.ts +0 -9
- package/dist/short-videos/short-video-viewer/index.d.ts +0 -9
- package/dist/short-videos/short-video-viewer/index.js +0 -6
- package/dist/short-videos/short-video-viewer/mapper.d.ts +0 -3
- package/dist/short-videos/short-video-viewer/mapper.js +0 -56
- package/dist/short-videos/short-video-viewer/operations.generated.d.ts +0 -56
- package/dist/short-videos/short-video-viewer/operations.generated.js +0 -151
- package/dist/short-videos/short-video-viewer/operations.graphql +0 -53
- package/dist/short-videos/short-video-viewer/short-video-attachments-localization.svelte.d.ts +0 -12
- 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.d.ts +0 -13
- 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.d.ts +0 -7
- 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-video-viewer/types.d.ts +0 -40
- package/dist/short-videos/short-video-viewer/types.js +0 -1
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.d.ts +0 -12
- package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +0 -26
- package/dist/short-videos/short-videos-player/action-button.svelte +0 -38
- package/dist/short-videos/short-videos-player/action-button.svelte.d.ts +0 -10
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +0 -91
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +0 -13
- package/dist/short-videos/short-videos-player/controls.svelte +0 -222
- package/dist/short-videos/short-videos-player/controls.svelte.d.ts +0 -15
- package/dist/short-videos/short-videos-player/index.d.ts +0 -28
- package/dist/short-videos/short-videos-player/index.js +0 -40
- 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/short-videos/short-videos-player/ui-manager.svelte.d.ts +0 -16
- package/dist/short-videos/short-videos-player/ui-manager.svelte.js +0 -25
- package/dist/streams/layout/cmp.layout.svelte +0 -34
- package/dist/streams/layout/cmp.layout.svelte.d.ts +0 -9
- package/dist/streams/layout/cmp.slot-content.svelte +0 -32
- package/dist/streams/layout/cmp.slot-content.svelte.d.ts +0 -9
- package/dist/streams/layout/cmp.slot.svelte +0 -26
- package/dist/streams/layout/cmp.slot.svelte.d.ts +0 -9
- package/dist/streams/layout/component.d.ts +0 -6
- package/dist/streams/layout/component.js +0 -1
- package/dist/streams/layout/css-values.d.ts +0 -10
- package/dist/streams/layout/css-values.js +0 -1
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte +0 -16
- package/dist/streams/layout/element-views/cmp.container-stream-element.svelte.d.ts +0 -11
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte +0 -38
- package/dist/streams/layout/element-views/cmp.image-ref-stream-element.svelte.d.ts +0 -9
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte +0 -30
- package/dist/streams/layout/element-views/cmp.images-stream-element.svelte.d.ts +0 -9
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte +0 -97
- package/dist/streams/layout/element-views/cmp.price-stream-element.svelte.d.ts +0 -11
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte +0 -6
- package/dist/streams/layout/element-views/cmp.short-video-stream-element.svelte.d.ts +0 -7
- package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte +0 -45
- package/dist/streams/layout/element-views/cmp.spacer-stream-element.svelte.d.ts +0 -9
- package/dist/streams/layout/element-views/cmp.stream-element.svelte +0 -60
- package/dist/streams/layout/element-views/cmp.stream-element.svelte.d.ts +0 -13
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte +0 -23
- package/dist/streams/layout/element-views/cmp.text-ref-stream-element.svelte.d.ts +0 -9
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte +0 -8
- package/dist/streams/layout/element-views/cmp.text-stream-element.svelte.d.ts +0 -7
- package/dist/streams/layout/element-views/data-by-key-accessor.d.ts +0 -3
- package/dist/streams/layout/element-views/data-by-key-accessor.js +0 -55
- package/dist/streams/layout/element-views/index.d.ts +0 -11
- package/dist/streams/layout/element-views/index.js +0 -9
- 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/elements.d.ts +0 -51
- package/dist/streams/layout/elements.js +0 -1
- package/dist/streams/layout/enums.d.ts +0 -45
- package/dist/streams/layout/enums.js +0 -54
- package/dist/streams/layout/index.d.ts +0 -19
- package/dist/streams/layout/index.js +0 -15
- package/dist/streams/layout/layout.d.ts +0 -13
- package/dist/streams/layout/layout.js +0 -1
- package/dist/streams/layout/models/index.d.ts +0 -6
- package/dist/streams/layout/models/index.js +0 -1
- package/dist/streams/layout/models/mapper.d.ts +0 -3
- package/dist/streams/layout/models/mapper.js +0 -62
- package/dist/streams/layout/models/stream-layout-blob-model.d.ts +0 -4
- package/dist/streams/layout/models/stream-layout-blob-model.js +0 -1
- package/dist/streams/layout/models/stream-layout-media-item-model.d.ts +0 -6
- package/dist/streams/layout/models/stream-layout-media-item-model.js +0 -1
- package/dist/streams/layout/models/stream-layout-post-header-model.d.ts +0 -11
- package/dist/streams/layout/models/stream-layout-post-header-model.js +0 -1
- package/dist/streams/layout/models/stream-layout-product-model.d.ts +0 -19
- package/dist/streams/layout/models/stream-layout-product-model.js +0 -1
- package/dist/streams/layout/models/stream-layout-short-video-model.d.ts +0 -31
- package/dist/streams/layout/models/stream-layout-short-video-model.js +0 -1
- package/dist/streams/layout/serializer.d.ts +0 -3
- package/dist/streams/layout/serializer.js +0 -6
- package/dist/streams/layout/slot-data-input.d.ts +0 -14
- package/dist/streams/layout/slot-data-input.js +0 -1
- package/dist/streams/layout/slot-data.d.ts +0 -18
- package/dist/streams/layout/slot-data.js +0 -1
- package/dist/streams/layout/slot.d.ts +0 -16
- package/dist/streams/layout/slot.js +0 -1
- package/dist/streams/layout/styles-transformer.d.ts +0 -13
- package/dist/streams/layout/styles-transformer.js +0 -140
- package/dist/streams/layout/styles.d.ts +0 -43
- package/dist/streams/layout/styles.js +0 -1
- package/dist/streams/layout/type-guards.d.ts +0 -8
- package/dist/streams/layout/type-guards.js +0 -21
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +0 -13
- package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +0 -7
- package/dist/streams/stream-page-viewer/index.d.ts +0 -2
- package/dist/streams/stream-page-viewer/index.js +0 -1
- package/dist/streams/stream-page-viewer/mapper.d.ts +0 -3
- package/dist/streams/stream-page-viewer/mapper.js +0 -22
- package/dist/streams/stream-page-viewer/operations.generated.d.ts +0 -10
- package/dist/streams/stream-page-viewer/operations.generated.js +0 -27
- package/dist/streams/stream-page-viewer/operations.graphql +0 -8
- 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-page-viewer/types.d.ts +0 -18
- package/dist/streams/stream-page-viewer/types.js +0 -1
- package/dist/streams/stream-player/action-button.svelte +0 -38
- package/dist/streams/stream-player/action-button.svelte.d.ts +0 -10
- package/dist/streams/stream-player/cmp.stream-player.svelte +0 -149
- package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +0 -17
- package/dist/streams/stream-player/controls.svelte +0 -230
- package/dist/streams/stream-player/controls.svelte.d.ts +0 -14
- package/dist/streams/stream-player/index.d.ts +0 -36
- package/dist/streams/stream-player/index.js +0 -50
- package/dist/streams/stream-player/mapper.d.ts +0 -3
- package/dist/streams/stream-player/mapper.js +0 -15
- package/dist/streams/stream-player/operations.generated.d.ts +0 -65
- package/dist/streams/stream-player/operations.generated.js +0 -196
- package/dist/streams/stream-player/operations.graphql +0 -35
- package/dist/streams/stream-player/stream-overview.svelte +0 -239
- package/dist/streams/stream-player/stream-overview.svelte.d.ts +0 -17
- package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +0 -25
- package/dist/streams/stream-player/stream-player-buffer.svelte.js +0 -84
- 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/streams/stream-player/types.d.ts +0 -12
- package/dist/streams/stream-player/types.js +0 -1
- package/dist/streams/stream-player/ui-manager.svelte.d.ts +0 -17
- package/dist/streams/stream-player/ui-manager.svelte.js +0 -26
- package/dist/ui/button/cmp.button.svelte +0 -10
- package/dist/ui/button/cmp.button.svelte.d.ts +0 -16
- package/dist/ui/button/index.d.ts +0 -2
- package/dist/ui/button/index.js +0 -2
- package/dist/ui/button/resources/button-base.svelte +0 -84
- package/dist/ui/button/resources/button-base.svelte.d.ts +0 -13
- package/dist/ui/button/resources/button-theme.svelte +0 -204
- package/dist/ui/button/resources/button-theme.svelte.d.ts +0 -10
- package/dist/ui/button/resources/button-types.d.ts +0 -21
- package/dist/ui/button/resources/button-types.js +0 -23
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte +0 -5
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte.d.ts +0 -7
- package/dist/ui/dynamic-component/index.d.ts +0 -2
- package/dist/ui/dynamic-component/index.js +0 -2
- package/dist/ui/dynamic-component/types.svelte.d.ts +0 -11
- package/dist/ui/dynamic-component/types.svelte.js +0 -13
- package/dist/ui/icon/cmp.icon.svelte +0 -113
- package/dist/ui/icon/cmp.icon.svelte.d.ts +0 -8
- package/dist/ui/icon/index.d.ts +0 -2
- package/dist/ui/icon/index.js +0 -2
- package/dist/ui/icon/types.d.ts +0 -9
- package/dist/ui/icon/types.js +0 -10
- package/dist/ui/image/cmp.image-round.svelte +0 -41
- package/dist/ui/image/cmp.image-round.svelte.d.ts +0 -11
- package/dist/ui/image/cmp.image-rounded.svelte +0 -71
- package/dist/ui/image/cmp.image-rounded.svelte.d.ts +0 -11
- package/dist/ui/image/cmp.image-stub.svelte +0 -34
- package/dist/ui/image/cmp.image-stub.svelte.d.ts +0 -18
- package/dist/ui/image/cmp.image.svelte +0 -82
- package/dist/ui/image/cmp.image.svelte.d.ts +0 -13
- package/dist/ui/image/image-state.d.ts +0 -6
- package/dist/ui/image/image-state.js +0 -17
- package/dist/ui/image/index.d.ts +0 -4
- package/dist/ui/image/index.js +0 -4
- package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte +0 -84
- package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte.d.ts +0 -11
- package/dist/ui/infinite-scrolling/index.d.ts +0 -1
- package/dist/ui/infinite-scrolling/index.js +0 -1
- package/dist/ui/line-clamp/cmp.line-clamp.svelte +0 -89
- package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +0 -12
- package/dist/ui/line-clamp/index.d.ts +0 -2
- package/dist/ui/line-clamp/index.js +0 -2
- package/dist/ui/line-clamp/line-clamp-localization.svelte.d.ts +0 -9
- package/dist/ui/line-clamp/line-clamp-localization.svelte.js +0 -15
- package/dist/ui/line-clamp/line-clamp-types.d.ts +0 -3
- package/dist/ui/line-clamp/line-clamp-types.js +0 -1
- package/dist/ui/line-clamp/line-clamp-utils.d.ts +0 -8
- package/dist/ui/line-clamp/line-clamp-utils.js +0 -33
- package/dist/ui/loading/cmp.loading.svelte +0 -97
- package/dist/ui/loading/cmp.loading.svelte.d.ts +0 -9
- package/dist/ui/loading/index.d.ts +0 -1
- package/dist/ui/loading/index.js +0 -1
- package/dist/ui/media-item-view/cmp.media-item-view.svelte +0 -91
- package/dist/ui/media-item-view/cmp.media-item-view.svelte.d.ts +0 -13
- package/dist/ui/media-item-view/index.d.ts +0 -1
- package/dist/ui/media-item-view/index.js +0 -1
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte +0 -278
- package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte.d.ts +0 -13
- package/dist/ui/media-items-gallery/index.d.ts +0 -1
- package/dist/ui/media-items-gallery/index.js +0 -1
- package/dist/ui/media-items-gallery/types.d.ts +0 -12
- package/dist/ui/media-items-gallery/types.js +0 -35
- package/dist/ui/media-playback/index.d.ts +0 -2
- package/dist/ui/media-playback/index.js +0 -2
- package/dist/ui/media-playback/playback-manager.svelte.d.ts +0 -25
- package/dist/ui/media-playback/playback-manager.svelte.js +0 -62
- package/dist/ui/media-playback/volume-manager.svelte.d.ts +0 -10
- package/dist/ui/media-playback/volume-manager.svelte.js +0 -27
- package/dist/ui/player/cmp.player-slider.svelte +0 -161
- package/dist/ui/player/cmp.player-slider.svelte.d.ts +0 -33
- package/dist/ui/player/index.d.ts +0 -4
- package/dist/ui/player/index.js +0 -3
- package/dist/ui/player/player-buffer.svelte.d.ts +0 -28
- package/dist/ui/player/player-buffer.svelte.js +0 -64
- package/dist/ui/player/prevent-slider-scroll.d.ts +0 -5
- package/dist/ui/player/prevent-slider-scroll.js +0 -11
- package/dist/ui/player/types.d.ts +0 -14
- package/dist/ui/player/types.js +0 -1
- package/dist/ui/progress/cmp.progress.svelte +0 -37
- package/dist/ui/progress/cmp.progress.svelte.d.ts +0 -6
- package/dist/ui/progress/index.d.ts +0 -1
- package/dist/ui/progress/index.js +0 -1
- package/dist/ui/proportional-container/cmp.proportional-container.svelte +0 -39
- package/dist/ui/proportional-container/cmp.proportional-container.svelte.d.ts +0 -8
- package/dist/ui/proportional-container/index.d.ts +0 -1
- package/dist/ui/proportional-container/index.js +0 -1
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +0 -63
- package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +0 -12
- package/dist/ui/seek-bar/index.d.ts +0 -1
- package/dist/ui/seek-bar/index.js +0 -1
- package/dist/ui/shadow-dom/_normalize.scss +0 -350
- package/dist/ui/shadow-dom/_reset.scss +0 -189
- package/dist/ui/shadow-dom/index.d.ts +0 -1
- package/dist/ui/shadow-dom/index.js +0 -1
- package/dist/ui/shadow-dom/shadow-host.d.ts +0 -8
- package/dist/ui/shadow-dom/shadow-host.js +0 -40
- package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte +0 -120
- package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte.d.ts +0 -18
- package/dist/ui/spotlight-layout/index.d.ts +0 -1
- package/dist/ui/spotlight-layout/index.js +0 -1
- package/dist/ui/time-ago/cmp.time-ago.svelte +0 -69
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +0 -9
- package/dist/ui/time-ago/index.d.ts +0 -2
- package/dist/ui/time-ago/index.js +0 -1
- package/dist/ui/time-ago/time-ago-localization.svelte.d.ts +0 -21
- package/dist/ui/time-ago/time-ago-localization.svelte.js +0 -39
- package/dist/ui/video/cmp.video.svelte +0 -377
- package/dist/ui/video/cmp.video.svelte.d.ts +0 -24
- package/dist/ui/video/index.d.ts +0 -1
- package/dist/ui/video/index.js +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
-
import { calculateImageState, ImageState } from './image-state';
|
|
3
|
-
import IconImageOff from '@fluentui/svg-icons/icons/image_off_20_regular.svg';
|
|
4
|
-
let { src, alt = '', showStubOnError = false, on, stub } = $props();
|
|
5
|
-
let hasError = $state(false);
|
|
6
|
-
const imageState = $derived(calculateImageState(src, hasError, showStubOnError));
|
|
7
|
-
const onLoad = () => {
|
|
8
|
-
hasError = false;
|
|
9
|
-
on === null || on === void 0 ? void 0 : on.load(true);
|
|
10
|
-
};
|
|
11
|
-
const onLoadError = () => {
|
|
12
|
-
hasError = true;
|
|
13
|
-
on === null || on === void 0 ? void 0 : on.load(false);
|
|
14
|
-
};
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<div class="image">
|
|
18
|
-
{#if !!src}
|
|
19
|
-
<img class="image__img" class:image__img--hidden={imageState !== ImageState.showImage} src={src} alt={alt || ''} onload={onLoad} onerror={onLoadError} />
|
|
20
|
-
{/if}
|
|
21
|
-
|
|
22
|
-
{#if imageState === ImageState.showError}
|
|
23
|
-
<div class="image__load-error">
|
|
24
|
-
<Icon src={IconImageOff} />
|
|
25
|
-
</div>
|
|
26
|
-
{/if}
|
|
27
|
-
|
|
28
|
-
{#if imageState === ImageState.showStub}
|
|
29
|
-
{#if stub}
|
|
30
|
-
{@render stub()}
|
|
31
|
-
{:else}
|
|
32
|
-
<div class="image__img image__img--stub"></div>
|
|
33
|
-
{/if}
|
|
34
|
-
{/if}
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<style>@keyframes fadeIn {
|
|
38
|
-
0% {
|
|
39
|
-
opacity: 1;
|
|
40
|
-
}
|
|
41
|
-
50% {
|
|
42
|
-
opacity: 0.4;
|
|
43
|
-
}
|
|
44
|
-
100% {
|
|
45
|
-
opacity: 1;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
.image {
|
|
49
|
-
--_image--background: var(--image--background, transparent);
|
|
50
|
-
--_image--border-radius: var(--image--border-radius, 0);
|
|
51
|
-
--_image--object-fit: var(--image--object-fit, cover);
|
|
52
|
-
--_image--stub--background: var(--image--stub--background, #e5e7eb);
|
|
53
|
-
position: relative;
|
|
54
|
-
width: 100%;
|
|
55
|
-
height: 100%;
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
border-radius: var(--_image--border-radius);
|
|
58
|
-
background: var(--_image--background);
|
|
59
|
-
}
|
|
60
|
-
:global([data-theme="dark"]) .image {
|
|
61
|
-
--_image--stub--background: var(--image--stub--background, #374151);
|
|
62
|
-
}
|
|
63
|
-
.image__img {
|
|
64
|
-
width: 100%;
|
|
65
|
-
height: 100%;
|
|
66
|
-
z-index: 2;
|
|
67
|
-
object-fit: var(--_image--object-fit);
|
|
68
|
-
}
|
|
69
|
-
.image__img--hidden {
|
|
70
|
-
display: none;
|
|
71
|
-
}
|
|
72
|
-
.image__img--stub {
|
|
73
|
-
background: var(--_image--stub--background);
|
|
74
|
-
}
|
|
75
|
-
.image__load-error {
|
|
76
|
-
position: absolute;
|
|
77
|
-
top: 50%;
|
|
78
|
-
left: 50%;
|
|
79
|
-
transform: translate(-50%, -50%);
|
|
80
|
-
font-size: 1.2em;
|
|
81
|
-
text-align: center;
|
|
82
|
-
}</style>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
type Props = {
|
|
3
|
-
src: string | null | undefined;
|
|
4
|
-
alt?: string;
|
|
5
|
-
showStubOnError?: boolean;
|
|
6
|
-
on?: {
|
|
7
|
-
load: (loadedSuccessfully: boolean) => void;
|
|
8
|
-
};
|
|
9
|
-
stub?: Snippet;
|
|
10
|
-
};
|
|
11
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
13
|
-
export default Cmp;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export var ImageState;
|
|
2
|
-
(function (ImageState) {
|
|
3
|
-
ImageState[ImageState["showImage"] = 0] = "showImage";
|
|
4
|
-
ImageState[ImageState["showError"] = 1] = "showError";
|
|
5
|
-
ImageState[ImageState["showStub"] = 2] = "showStub";
|
|
6
|
-
})(ImageState || (ImageState = {}));
|
|
7
|
-
export const calculateImageState = (src, isError, showStubOnError) => {
|
|
8
|
-
if (isError && !showStubOnError) {
|
|
9
|
-
return ImageState.showError;
|
|
10
|
-
}
|
|
11
|
-
else if (!src || (isError && showStubOnError)) {
|
|
12
|
-
return ImageState.showStub;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return ImageState.showImage;
|
|
16
|
-
}
|
|
17
|
-
};
|
package/dist/ui/image/index.d.ts
DELETED
package/dist/ui/image/index.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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 { Loading } from '../loading';
|
|
11
|
-
import { onDestroy, onMount } from 'svelte';
|
|
12
|
-
let { loadMore, container = null, actuationOffset = '', children, loading } = $props();
|
|
13
|
-
let isLoading = $state(false);
|
|
14
|
-
let paginationTrigger;
|
|
15
|
-
let itemsContainer;
|
|
16
|
-
let intersectionObserver;
|
|
17
|
-
let resizeObserver;
|
|
18
|
-
onMount(() => {
|
|
19
|
-
intersectionObserver = new IntersectionObserver((e) => {
|
|
20
|
-
const [entries] = e;
|
|
21
|
-
if (entries.isIntersecting) {
|
|
22
|
-
onLoadMore();
|
|
23
|
-
}
|
|
24
|
-
}, {
|
|
25
|
-
root: container,
|
|
26
|
-
rootMargin: actuationOffset
|
|
27
|
-
});
|
|
28
|
-
resizeObserver = new ResizeObserver(() => {
|
|
29
|
-
intersectionObserver.unobserve(paginationTrigger);
|
|
30
|
-
intersectionObserver.observe(paginationTrigger);
|
|
31
|
-
});
|
|
32
|
-
resizeObserver.observe(itemsContainer);
|
|
33
|
-
});
|
|
34
|
-
onDestroy(() => {
|
|
35
|
-
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
36
|
-
intersectionObserver === null || intersectionObserver === void 0 ? void 0 : intersectionObserver.disconnect();
|
|
37
|
-
});
|
|
38
|
-
const onLoadMore = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
if (isLoading) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
isLoading = true;
|
|
43
|
-
try {
|
|
44
|
-
yield loadMore();
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
isLoading = false;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<div class="infinite-scrolling">
|
|
53
|
-
<div bind:this={itemsContainer}>
|
|
54
|
-
{@render children()}
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div class="infinite-scrolling__pagination-trigger" bind:this={paginationTrigger}></div>
|
|
58
|
-
{#if isLoading}
|
|
59
|
-
{#if loading}
|
|
60
|
-
{@render loading()}
|
|
61
|
-
{:else}
|
|
62
|
-
<div class="infinite-scrolling__loading-container">
|
|
63
|
-
<Loading timeout={500} />
|
|
64
|
-
</div>
|
|
65
|
-
{/if}
|
|
66
|
-
{/if}
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<style>.infinite-scrolling {
|
|
70
|
-
--infinite-scrolling--overflow-y_: var(--infinite-scrolling--overflow-y, initial);
|
|
71
|
-
overflow-y: var(--infinite-scrolling--overflow-y_);
|
|
72
|
-
min-height: calc(2em + 0.3125em * 2);
|
|
73
|
-
position: relative;
|
|
74
|
-
width: 100%;
|
|
75
|
-
}
|
|
76
|
-
.infinite-scrolling__pagination-trigger {
|
|
77
|
-
border: 1px solid transparent;
|
|
78
|
-
}
|
|
79
|
-
.infinite-scrolling__loading-container {
|
|
80
|
-
position: absolute;
|
|
81
|
-
bottom: 0.3125em;
|
|
82
|
-
left: 50%;
|
|
83
|
-
transform: translateX(-50%);
|
|
84
|
-
}</style>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type Snippet } from 'svelte';
|
|
2
|
-
type Props = {
|
|
3
|
-
loadMore: () => Promise<unknown>;
|
|
4
|
-
container?: HTMLElement | null;
|
|
5
|
-
actuationOffset?: string;
|
|
6
|
-
children: Snippet;
|
|
7
|
-
loading?: Snippet;
|
|
8
|
-
};
|
|
9
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
10
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
11
|
-
export default Cmp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as InfiniteScrolling } from './cmp.infinite-scrolling.svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as InfiniteScrolling } from './cmp.infinite-scrolling.svelte';
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { LineClampLocalization } from './line-clamp-localization.svelte';
|
|
2
|
-
import { LineClampUtils } from './line-clamp-utils';
|
|
3
|
-
import { onDestroy, onMount } from 'svelte';
|
|
4
|
-
let { value = undefined, maxLines = 3, localization: localizationInit, enableShowMore = false, children } = $props();
|
|
5
|
-
const localization = $derived(new LineClampLocalization(localizationInit));
|
|
6
|
-
let parent;
|
|
7
|
-
let element;
|
|
8
|
-
let clampWrapperRef;
|
|
9
|
-
let isTruncated = $state(false);
|
|
10
|
-
let showingAllText = $state(false);
|
|
11
|
-
let resizeObserver = null;
|
|
12
|
-
onMount(() => {
|
|
13
|
-
let parentElement = element.parentElement;
|
|
14
|
-
if (!parentElement || !('clientHeight' in parentElement)) {
|
|
15
|
-
console.error('Unsupported parent for multiline clamper');
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
parent = parentElement;
|
|
19
|
-
clamp();
|
|
20
|
-
resizeObserver = new ResizeObserver(clamp);
|
|
21
|
-
resizeObserver.observe(parent);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
onDestroy(() => {
|
|
25
|
-
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
26
|
-
resizeObserver = null;
|
|
27
|
-
});
|
|
28
|
-
const clamp = () => {
|
|
29
|
-
isTruncated = clampWrapperRef.scrollHeight > clampWrapperRef.offsetHeight;
|
|
30
|
-
if (showingAllText) {
|
|
31
|
-
setClampValue('unset');
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
let clampValue;
|
|
35
|
-
if (maxLines === 'auto') {
|
|
36
|
-
clampValue = LineClampUtils.calculateClampValue(parent);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
clampValue = maxLines;
|
|
40
|
-
}
|
|
41
|
-
setClampValue(clampValue.toString());
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const setClampValue = (value) => {
|
|
45
|
-
clampWrapperRef.style.setProperty('-webkit-line-clamp', value);
|
|
46
|
-
};
|
|
47
|
-
const toggleShowMore = () => {
|
|
48
|
-
showingAllText = !showingAllText;
|
|
49
|
-
clamp();
|
|
50
|
-
};
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<div class="line-clamp" bind:this={element}>
|
|
54
|
-
<div class="line-clamp__wrapper" bind:this={clampWrapperRef}>
|
|
55
|
-
{#if children}
|
|
56
|
-
{@render children()}
|
|
57
|
-
{:else if value}
|
|
58
|
-
{@html value}
|
|
59
|
-
{/if}
|
|
60
|
-
</div>
|
|
61
|
-
{#if enableShowMore && (isTruncated || showingAllText)}
|
|
62
|
-
<button type="button" class="line-clamp__show-more-button" onclick={toggleShowMore}>
|
|
63
|
-
{#if showingAllText}
|
|
64
|
-
{localization.showLess}
|
|
65
|
-
{:else}
|
|
66
|
-
{localization.showMore}
|
|
67
|
-
{/if}
|
|
68
|
-
</button>
|
|
69
|
-
{/if}
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<style>.line-clamp {
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: 100%;
|
|
75
|
-
display: flex;
|
|
76
|
-
flex-direction: column;
|
|
77
|
-
}
|
|
78
|
-
.line-clamp__wrapper {
|
|
79
|
-
display: -webkit-box;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
word-break: break-word;
|
|
82
|
-
white-space: var(--line-clamp-white-space, pre-line);
|
|
83
|
-
-webkit-box-orient: vertical;
|
|
84
|
-
}
|
|
85
|
-
.line-clamp__show-more-button {
|
|
86
|
-
margin-top: 0.5em;
|
|
87
|
-
font-size: 0.9em;
|
|
88
|
-
opacity: 0.8;
|
|
89
|
-
}</style>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ILineClampLocalization } from './line-clamp-localization.svelte';
|
|
2
|
-
import { type Snippet } from 'svelte';
|
|
3
|
-
type Props = {
|
|
4
|
-
value?: string | null;
|
|
5
|
-
maxLines?: number | 'auto';
|
|
6
|
-
enableShowMore?: boolean;
|
|
7
|
-
localization?: ILineClampLocalization;
|
|
8
|
-
children?: Snippet;
|
|
9
|
-
};
|
|
10
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
11
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
12
|
-
export default Cmp;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export class LineClampLocalization {
|
|
2
|
-
showLess = $state('Show less');
|
|
3
|
-
showMore = $state('Show more');
|
|
4
|
-
constructor(init) {
|
|
5
|
-
if (!init) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
if (init.showLess !== undefined) {
|
|
9
|
-
this.showLess = init.showLess;
|
|
10
|
-
}
|
|
11
|
-
if (init.showMore !== undefined) {
|
|
12
|
-
this.showMore = init.showMore;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SupportedHtmlElement } from './line-clamp-types';
|
|
2
|
-
export declare class LineClampUtils {
|
|
3
|
-
static calculateClampValue(elm: SupportedHtmlElement): number;
|
|
4
|
-
static getContentMaxHeight(elm: SupportedHtmlElement): number;
|
|
5
|
-
private static num;
|
|
6
|
-
private static getNumberStyleValue;
|
|
7
|
-
private static getContentLineHeight;
|
|
8
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export class LineClampUtils {
|
|
2
|
-
static calculateClampValue(elm) {
|
|
3
|
-
const maxHeight = LineClampUtils.getContentMaxHeight(elm);
|
|
4
|
-
const lineHeight = LineClampUtils.getContentLineHeight(elm);
|
|
5
|
-
return Math.floor(maxHeight / lineHeight);
|
|
6
|
-
}
|
|
7
|
-
static getContentMaxHeight(elm) {
|
|
8
|
-
const propsToExtractHeightOf = ['padding-top', 'padding-bottom', 'border-top-width', 'border-bottom-width'];
|
|
9
|
-
const valueToExclude = propsToExtractHeightOf.map((p) => LineClampUtils.getNumberStyleValue(elm, p)).reduce((prev, curr) => prev + curr);
|
|
10
|
-
const maxHeightStyle = LineClampUtils.getNumberStyleValue(elm, 'max-height');
|
|
11
|
-
const heightStyle = LineClampUtils.getNumberStyleValue(elm, 'height');
|
|
12
|
-
const elementHeight = maxHeightStyle || heightStyle || elm.clientHeight;
|
|
13
|
-
return elementHeight - valueToExclude;
|
|
14
|
-
}
|
|
15
|
-
static num(str) {
|
|
16
|
-
return parseFloat((str + '').replace(/[^\d.]/g, ''));
|
|
17
|
-
}
|
|
18
|
-
static getNumberStyleValue(elm, style) {
|
|
19
|
-
const styleValue = window.getComputedStyle(elm, null).getPropertyValue(style);
|
|
20
|
-
if (styleValue.indexOf('px') < 0) {
|
|
21
|
-
return 0;
|
|
22
|
-
}
|
|
23
|
-
return LineClampUtils.num(styleValue);
|
|
24
|
-
}
|
|
25
|
-
static getContentLineHeight(elm) {
|
|
26
|
-
const lineHeight = LineClampUtils.getNumberStyleValue(elm, 'line-height');
|
|
27
|
-
if (lineHeight) {
|
|
28
|
-
return lineHeight;
|
|
29
|
-
}
|
|
30
|
-
console.warn('line-clamp: line-height is not set, using font-size * 1.2', elm);
|
|
31
|
-
return LineClampUtils.getNumberStyleValue(elm, 'font-size') * 1.2;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { onMount } from 'svelte';
|
|
2
|
-
let { positionFixedCenter = false, positionAbsoluteCenter = false, blocking = false, timeout = 0 } = $props();
|
|
3
|
-
let visible = $state(false);
|
|
4
|
-
onMount(() => {
|
|
5
|
-
setTimeout(() => (visible = true), timeout);
|
|
6
|
-
});
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
{#if visible && blocking}
|
|
10
|
-
<div class="loading-ring-overlay" class:loading-ring-overlay--fixed={positionFixedCenter}></div>
|
|
11
|
-
{/if}
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
class="la-ball-clip-rotate"
|
|
15
|
-
class:la-ball-clip-rotate--absolute-center={positionAbsoluteCenter}
|
|
16
|
-
class:la-ball-clip-rotate--fixed-center={positionFixedCenter}
|
|
17
|
-
class:la-ball-clip-rotate--visible={visible}>
|
|
18
|
-
<div class="la-ball-clip-rotate__spin"></div>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<style>@keyframes fadeIn {
|
|
22
|
-
0% {
|
|
23
|
-
opacity: 1;
|
|
24
|
-
}
|
|
25
|
-
50% {
|
|
26
|
-
opacity: 0.4;
|
|
27
|
-
}
|
|
28
|
-
100% {
|
|
29
|
-
opacity: 1;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
.loading-ring-overlay {
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: 0;
|
|
35
|
-
left: 0;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
38
|
-
background-color: rgba(0, 0, 0, 0.3);
|
|
39
|
-
z-index: 999;
|
|
40
|
-
}
|
|
41
|
-
.loading-ring-overlay--fixed {
|
|
42
|
-
position: fixed;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.la-ball-clip-rotate {
|
|
46
|
-
--loading--spinner-color_: var(--loading--spinner-color, #144ab0);
|
|
47
|
-
color: var(--loading--spinner-color_);
|
|
48
|
-
display: block;
|
|
49
|
-
opacity: 0;
|
|
50
|
-
width: 2em;
|
|
51
|
-
height: 2em;
|
|
52
|
-
z-index: 10;
|
|
53
|
-
}
|
|
54
|
-
:global([data-theme="dark"]) .la-ball-clip-rotate {
|
|
55
|
-
--loading--spinner-color_: var(--loading--spinner-color, #5a8dec);
|
|
56
|
-
}
|
|
57
|
-
.la-ball-clip-rotate--visible {
|
|
58
|
-
opacity: 1;
|
|
59
|
-
}
|
|
60
|
-
.la-ball-clip-rotate--absolute-center {
|
|
61
|
-
position: absolute;
|
|
62
|
-
top: 50%;
|
|
63
|
-
left: 50%;
|
|
64
|
-
transform: translate(-50%, -50%);
|
|
65
|
-
}
|
|
66
|
-
.la-ball-clip-rotate--fixed-center {
|
|
67
|
-
position: fixed;
|
|
68
|
-
top: 50%;
|
|
69
|
-
left: 50%;
|
|
70
|
-
transform: translate(-50%, -50%);
|
|
71
|
-
z-index: 1;
|
|
72
|
-
}
|
|
73
|
-
.la-ball-clip-rotate__spin {
|
|
74
|
-
position: relative;
|
|
75
|
-
box-sizing: border-box;
|
|
76
|
-
display: inline-block;
|
|
77
|
-
float: none;
|
|
78
|
-
border: 0.125em solid currentColor;
|
|
79
|
-
width: 2em;
|
|
80
|
-
height: 2em;
|
|
81
|
-
background: transparent;
|
|
82
|
-
border-bottom-color: transparent;
|
|
83
|
-
border-radius: 100%;
|
|
84
|
-
animation: ball-clip-rotate 0.75s linear infinite;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@keyframes ball-clip-rotate {
|
|
88
|
-
0% {
|
|
89
|
-
transform: rotate(0deg);
|
|
90
|
-
}
|
|
91
|
-
50% {
|
|
92
|
-
transform: rotate(180deg);
|
|
93
|
-
}
|
|
94
|
-
100% {
|
|
95
|
-
transform: rotate(360deg);
|
|
96
|
-
}
|
|
97
|
-
}</style>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Loading } from './cmp.loading.svelte';
|
package/dist/ui/loading/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Loading } from './cmp.loading.svelte';
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { MediaFormat, MediaType } from '../../core/enums';
|
|
2
|
-
import { getMediaItemImageUrl } from '../../core/media';
|
|
3
|
-
import { Image } from '../image';
|
|
4
|
-
import { ProportionalContainer } from '../proportional-container';
|
|
5
|
-
import { Video } from '../video';
|
|
6
|
-
let { media, ratio = 0, inert = false, on } = $props();
|
|
7
|
-
const handleClick = (e) => {
|
|
8
|
-
if (on === null || on === void 0 ? void 0 : on.click) {
|
|
9
|
-
e.stopPropagation();
|
|
10
|
-
on.click();
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const parsedRatio = $derived.by(() => {
|
|
14
|
-
if (!ratio || ratio === 'fit-parent') {
|
|
15
|
-
return 0;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
if (typeof ratio !== 'number') {
|
|
19
|
-
return ratio === MediaFormat.W16H9 ? 16 / 9 : 4 / 3;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return ratio;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
{#if media}
|
|
29
|
-
{#snippet mediaView()}
|
|
30
|
-
{#if media.type === MediaType.Image}
|
|
31
|
-
<div class="media-item-view__image" onclick={handleClick} onkeydown={() => {}} role="none">
|
|
32
|
-
<Image src={getMediaItemImageUrl(media)} />
|
|
33
|
-
</div>
|
|
34
|
-
{:else}
|
|
35
|
-
<div class="media-item-view__video" onclick={handleClick} onkeydown={() => {}} role="none">
|
|
36
|
-
<Video src={media.url} poster={media.thumbnailUrl} inert={!!on?.click} />
|
|
37
|
-
</div>
|
|
38
|
-
{/if}
|
|
39
|
-
{/snippet}
|
|
40
|
-
|
|
41
|
-
<div class="media-item-view" class:media-item-view--clickable={on?.click} class:media-item-view--fit-parent={ratio === 'fit-parent'} inert={inert}>
|
|
42
|
-
{#if parsedRatio}
|
|
43
|
-
<ProportionalContainer ratio={parsedRatio}>
|
|
44
|
-
{@render mediaView()}
|
|
45
|
-
</ProportionalContainer>
|
|
46
|
-
{:else}
|
|
47
|
-
{@render mediaView()}
|
|
48
|
-
{/if}
|
|
49
|
-
</div>
|
|
50
|
-
{/if}
|
|
51
|
-
|
|
52
|
-
<style>@keyframes fadeIn {
|
|
53
|
-
0% {
|
|
54
|
-
opacity: 1;
|
|
55
|
-
}
|
|
56
|
-
50% {
|
|
57
|
-
opacity: 0.4;
|
|
58
|
-
}
|
|
59
|
-
100% {
|
|
60
|
-
opacity: 1;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
.media-item-view {
|
|
64
|
-
width: 100%;
|
|
65
|
-
min-width: 100%;
|
|
66
|
-
max-width: 100%;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
position: relative;
|
|
69
|
-
--video--media-fit: cover;
|
|
70
|
-
}
|
|
71
|
-
.media-item-view--fit-parent {
|
|
72
|
-
width: 100%;
|
|
73
|
-
min-width: 100%;
|
|
74
|
-
max-width: 100%;
|
|
75
|
-
height: 100%;
|
|
76
|
-
min-height: 100%;
|
|
77
|
-
max-height: 100%;
|
|
78
|
-
}
|
|
79
|
-
.media-item-view__image {
|
|
80
|
-
width: 100%;
|
|
81
|
-
height: 100%;
|
|
82
|
-
cursor: pointer;
|
|
83
|
-
}
|
|
84
|
-
.media-item-view__video {
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: 100%;
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
}
|
|
89
|
-
.media-item-view--clickable {
|
|
90
|
-
cursor: pointer;
|
|
91
|
-
}</style>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MediaFormat } from '../../core/enums';
|
|
2
|
-
import { type MediaItemModel } from '../../core/media';
|
|
3
|
-
type Props = {
|
|
4
|
-
media: MediaItemModel | null;
|
|
5
|
-
ratio?: number | MediaFormat | 'fit-parent';
|
|
6
|
-
inert?: boolean;
|
|
7
|
-
on?: {
|
|
8
|
-
click?: () => void;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type Cmp = ReturnType<typeof Cmp>;
|
|
13
|
-
export default Cmp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as MediaItemView } from './cmp.media-item-view.svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as MediaItemView } from './cmp.media-item-view.svelte';
|