@streamscloud/embeddable 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +77 -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 +16 -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,239 @@
|
|
|
1
|
+
<script lang="ts">import { slideHorizontally } from '../../core/transitions';
|
|
2
|
+
import { Icon } from '../../ui/icon';
|
|
3
|
+
import { Image, ImageRound } from '../../ui/image';
|
|
4
|
+
import { InfiniteScrolling } from '../../ui/infinite-scrolling';
|
|
5
|
+
import { LineClamp } from '../../ui/line-clamp';
|
|
6
|
+
import { ProportionalContainer } from '../../ui/proportional-container';
|
|
7
|
+
import { TimeAgo } from '../../ui/time-ago';
|
|
8
|
+
import { default as ActionButton } from './action-button.svelte';
|
|
9
|
+
import { StreamPlayerLocalization } from './stream-player-localization.svelte';
|
|
10
|
+
import IconPanelLeftText from '@fluentui/svg-icons/icons/panel_left_text_20_regular.svg';
|
|
11
|
+
let { model, buffer, activePageId, on, uiManager, localization } = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if !uiManager.overviewCollapsed}
|
|
15
|
+
<div class="stream-overview" transition:slideHorizontally|local>
|
|
16
|
+
<div class="stream-overview-info">
|
|
17
|
+
<div class="stream-overview-owner">
|
|
18
|
+
<div class="stream-overview-owner__image">
|
|
19
|
+
<ImageRound src={model.header.image} />
|
|
20
|
+
</div>
|
|
21
|
+
<div class="stream-overview-owner__body">
|
|
22
|
+
<div class="stream-overview-owner__name">
|
|
23
|
+
<LineClamp maxLines={1}>
|
|
24
|
+
{model.header.name}
|
|
25
|
+
</LineClamp>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="stream-overview-owner__meta">
|
|
28
|
+
<LineClamp maxLines={1}>
|
|
29
|
+
<TimeAgo date={model.publishedAt || model.createdAt} />
|
|
30
|
+
</LineClamp>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="stream-overview-info__title">
|
|
35
|
+
<LineClamp maxLines={2}>
|
|
36
|
+
{model.title}
|
|
37
|
+
</LineClamp>
|
|
38
|
+
</div>
|
|
39
|
+
{#if model.subTitle}
|
|
40
|
+
<div class="stream-overview-info__subtitle">
|
|
41
|
+
<LineClamp maxLines={3}>
|
|
42
|
+
{model.subTitle}
|
|
43
|
+
</LineClamp>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
<div class="stream-overview-info__pages">
|
|
47
|
+
{localization.pagesCount(model.pagesCount)}
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="stream-overview-pages">
|
|
51
|
+
<InfiniteScrolling loadMore={buffer.loadMore}>
|
|
52
|
+
<div class="stream-overview-pages__grid">
|
|
53
|
+
{#each buffer.loaded as item, index (item.id)}
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
class="stream-overview-pages__page"
|
|
57
|
+
class:stream-overview-pages__page--active={activePageId === item.id}
|
|
58
|
+
onclick={() => on.setCurrentItem(index)}>
|
|
59
|
+
<ProportionalContainer ratio={9 / 16}>
|
|
60
|
+
<Image src={item.cover} />
|
|
61
|
+
</ProportionalContainer>
|
|
62
|
+
</button>
|
|
63
|
+
{/each}
|
|
64
|
+
</div>
|
|
65
|
+
</InfiniteScrolling>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
{/if}
|
|
69
|
+
|
|
70
|
+
<div class="toggle-collapsed-button">
|
|
71
|
+
<ActionButton on={{ click: () => (uiManager.overviewCollapsed = !uiManager.overviewCollapsed) }}>
|
|
72
|
+
<Icon src={IconPanelLeftText} />
|
|
73
|
+
</ActionButton>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<style>@keyframes fadeIn {
|
|
77
|
+
0% {
|
|
78
|
+
opacity: 1;
|
|
79
|
+
}
|
|
80
|
+
50% {
|
|
81
|
+
opacity: 0.4;
|
|
82
|
+
}
|
|
83
|
+
100% {
|
|
84
|
+
opacity: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.stream-overview {
|
|
88
|
+
background: #1c1c1c;
|
|
89
|
+
height: 100%;
|
|
90
|
+
min-height: 100%;
|
|
91
|
+
max-height: 100%;
|
|
92
|
+
width: 13.75rem;
|
|
93
|
+
min-width: 13.75rem;
|
|
94
|
+
max-width: 13.75rem;
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
min-height: 0;
|
|
98
|
+
padding-bottom: 0.9375rem;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 0;
|
|
102
|
+
left: 0;
|
|
103
|
+
height: 100%;
|
|
104
|
+
z-index: 1;
|
|
105
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
106
|
+
}
|
|
107
|
+
@container (width < 576px) {
|
|
108
|
+
.stream-overview {
|
|
109
|
+
width: 100%;
|
|
110
|
+
min-width: 100%;
|
|
111
|
+
max-width: 100%;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.toggle-collapsed-button {
|
|
116
|
+
position: absolute;
|
|
117
|
+
bottom: var(--stream-player--controls--offset-vertical);
|
|
118
|
+
left: var(--stream-player--controls--offset-horizontal);
|
|
119
|
+
z-index: 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.stream-overview-info {
|
|
123
|
+
padding: 1rem;
|
|
124
|
+
}
|
|
125
|
+
.stream-overview-info__title {
|
|
126
|
+
font-size: 1.125rem;
|
|
127
|
+
line-height: 1.2;
|
|
128
|
+
font-weight: 900;
|
|
129
|
+
color: #ffffff;
|
|
130
|
+
}
|
|
131
|
+
.stream-overview-info__subtitle {
|
|
132
|
+
font-size: 0.9375rem;
|
|
133
|
+
line-height: 1.6;
|
|
134
|
+
font-weight: 500;
|
|
135
|
+
letter-spacing: 0.75px;
|
|
136
|
+
color: #ffffff;
|
|
137
|
+
}
|
|
138
|
+
.stream-overview-info__pages {
|
|
139
|
+
font-size: 0.625rem;
|
|
140
|
+
line-height: 1;
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
color: #999999;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.stream-overview-pages {
|
|
146
|
+
display: flex;
|
|
147
|
+
flex: 1;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
overflow-y: auto;
|
|
150
|
+
overscroll-behavior: contain;
|
|
151
|
+
scrollbar-color: transparent transparent;
|
|
152
|
+
scrollbar-width: thin;
|
|
153
|
+
--custom-scrollbar-background: transparent;
|
|
154
|
+
padding: 0.9375rem 0.9375rem 0;
|
|
155
|
+
}
|
|
156
|
+
.stream-overview-pages::-webkit-scrollbar {
|
|
157
|
+
width: 3px;
|
|
158
|
+
height: 3px;
|
|
159
|
+
background: var(--custom-scrollbar-background, transparent);
|
|
160
|
+
visibility: hidden;
|
|
161
|
+
}
|
|
162
|
+
.stream-overview-pages::-webkit-scrollbar-thumb {
|
|
163
|
+
background: transparent;
|
|
164
|
+
}
|
|
165
|
+
.stream-overview-pages:hover {
|
|
166
|
+
scrollbar-color: var(--custom-scrollbar-color, #7d7d7d) var(--custom-scrollbar-background, transparent);
|
|
167
|
+
scrollbar-width: thin;
|
|
168
|
+
}
|
|
169
|
+
.stream-overview-pages:hover::-webkit-scrollbar {
|
|
170
|
+
width: 3px;
|
|
171
|
+
height: 3px;
|
|
172
|
+
background: var(--custom-scrollbar-background, transparent);
|
|
173
|
+
visibility: hidden;
|
|
174
|
+
}
|
|
175
|
+
.stream-overview-pages:hover::-webkit-scrollbar-thumb {
|
|
176
|
+
background: var(--custom-scrollbar-color, #7d7d7d);
|
|
177
|
+
}
|
|
178
|
+
.stream-overview-pages__grid {
|
|
179
|
+
display: flex;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
align-items: center;
|
|
182
|
+
gap: 2.5rem;
|
|
183
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
184
|
+
}
|
|
185
|
+
@container (width < 576px) {
|
|
186
|
+
.stream-overview-pages__grid {
|
|
187
|
+
display: grid;
|
|
188
|
+
width: 100%;
|
|
189
|
+
grid-template-columns: repeat(auto-fill, minmax(9.375rem, 1fr));
|
|
190
|
+
gap: 1.25rem;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
.stream-overview-pages__page {
|
|
194
|
+
width: 6.25rem;
|
|
195
|
+
border-radius: 0.125rem;
|
|
196
|
+
overflow: hidden;
|
|
197
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
198
|
+
}
|
|
199
|
+
@container (width < 576px) {
|
|
200
|
+
.stream-overview-pages__page {
|
|
201
|
+
width: auto;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
.stream-overview-pages__page--active {
|
|
205
|
+
outline: 2px solid #5a8dec;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.stream-overview-owner {
|
|
209
|
+
display: flex;
|
|
210
|
+
gap: 0.5rem;
|
|
211
|
+
margin-bottom: 0.5rem;
|
|
212
|
+
}
|
|
213
|
+
.stream-overview-owner__image {
|
|
214
|
+
width: 2rem;
|
|
215
|
+
min-width: 2rem;
|
|
216
|
+
max-width: 2rem;
|
|
217
|
+
height: 2rem;
|
|
218
|
+
min-height: 2rem;
|
|
219
|
+
max-height: 2rem;
|
|
220
|
+
--image--rounded--inner--border-color: #111827;
|
|
221
|
+
--image--rounded--outer--border-color: #f3f4f6;
|
|
222
|
+
--image--rounded--outer--border-width: 0.0625rem;
|
|
223
|
+
}
|
|
224
|
+
.stream-overview-owner__body {
|
|
225
|
+
display: flex;
|
|
226
|
+
flex-direction: column;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
color: #ffffff;
|
|
229
|
+
}
|
|
230
|
+
.stream-overview-owner__name {
|
|
231
|
+
font-size: 0.75rem;
|
|
232
|
+
line-height: 1.2;
|
|
233
|
+
font-weight: 500;
|
|
234
|
+
}
|
|
235
|
+
.stream-overview-owner__meta {
|
|
236
|
+
font-size: 0.625rem;
|
|
237
|
+
line-height: 1.2;
|
|
238
|
+
font-weight: 500;
|
|
239
|
+
}</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StreamPlayerBuffer } from './stream-player-buffer.svelte';
|
|
2
|
+
import { StreamPlayerLocalization } from './stream-player-localization.svelte';
|
|
3
|
+
import type { StreamPlayerModel } from './types';
|
|
4
|
+
import type { StreamPlayerUiManager } from './ui-manager.svelte';
|
|
5
|
+
type Props = {
|
|
6
|
+
model: StreamPlayerModel;
|
|
7
|
+
activePageId: string;
|
|
8
|
+
buffer: StreamPlayerBuffer;
|
|
9
|
+
uiManager: StreamPlayerUiManager;
|
|
10
|
+
localization: StreamPlayerLocalization;
|
|
11
|
+
on: {
|
|
12
|
+
setCurrentItem: (index: number) => void;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const StreamOverview: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type StreamOverview = ReturnType<typeof StreamOverview>;
|
|
17
|
+
export default StreamOverview;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type StreamPageViewerModel } from '../stream-page-viewer';
|
|
2
|
+
import type { IPlayerBuffer } from '../../ui/player';
|
|
3
|
+
import type { Client } from '@urql/core';
|
|
4
|
+
export declare class StreamPlayerBuffer implements IPlayerBuffer<StreamPageViewerModel> {
|
|
5
|
+
readonly loaded: StreamPageViewerModel[];
|
|
6
|
+
readonly currentIndex: number;
|
|
7
|
+
readonly current: StreamPageViewerModel | null;
|
|
8
|
+
readonly canLoadNext: boolean;
|
|
9
|
+
readonly canLoadPrevious: boolean;
|
|
10
|
+
readonly navigationDisabled: boolean;
|
|
11
|
+
readonly animationDuration = 1200;
|
|
12
|
+
private _pagesLoader;
|
|
13
|
+
private _currentIndex;
|
|
14
|
+
private _loaded;
|
|
15
|
+
constructor(data: {
|
|
16
|
+
streamId: string;
|
|
17
|
+
graphql: Client;
|
|
18
|
+
});
|
|
19
|
+
loadMore: () => Promise<StreamPageViewerModel[]>;
|
|
20
|
+
loadNext: () => Promise<void>;
|
|
21
|
+
loadPrevious: () => Promise<void>;
|
|
22
|
+
setIndex: (index: number) => void;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
private warmUpBuffer;
|
|
25
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ContinuationToken } from '../../core/continuation-token';
|
|
2
|
+
import { CursorDataLoader } from '../../core/data-loaders';
|
|
3
|
+
import { ImageScale } from '../../core/enums';
|
|
4
|
+
import { Utils } from '../../core/utils';
|
|
5
|
+
import {} from '../stream-page-viewer';
|
|
6
|
+
import { mapToStreamPageViewerModel } from '../stream-page-viewer/mapper';
|
|
7
|
+
import { GetStreamPagesDocument } from './operations.generated';
|
|
8
|
+
export class StreamPlayerBuffer {
|
|
9
|
+
loaded = $derived.by(() => this._loaded);
|
|
10
|
+
currentIndex = $derived.by(() => this._currentIndex);
|
|
11
|
+
current = $derived(this.currentIndex >= 0 ? this.loaded[this.currentIndex] : null);
|
|
12
|
+
canLoadNext = $derived(this.currentIndex < this.loaded.length - 1);
|
|
13
|
+
canLoadPrevious = $derived(this.currentIndex > 0);
|
|
14
|
+
navigationDisabled = $derived(!this.canLoadNext && !this.canLoadPrevious);
|
|
15
|
+
animationDuration = 1200;
|
|
16
|
+
_pagesLoader;
|
|
17
|
+
_currentIndex = $state(-1);
|
|
18
|
+
_loaded = $state.raw([]);
|
|
19
|
+
constructor(data) {
|
|
20
|
+
const { streamId, graphql } = data;
|
|
21
|
+
this._pagesLoader = new CursorDataLoader({
|
|
22
|
+
loadPage: async (continuationToken) => {
|
|
23
|
+
const payload = await graphql
|
|
24
|
+
.query(GetStreamPagesDocument, {
|
|
25
|
+
input: {
|
|
26
|
+
limit: 10,
|
|
27
|
+
continuationToken,
|
|
28
|
+
filter: {
|
|
29
|
+
streamId
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
image_scale: ImageScale.OriginalEncoded
|
|
33
|
+
})
|
|
34
|
+
.toPromise();
|
|
35
|
+
const data = payload.data?.streamPages;
|
|
36
|
+
if (!data) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const items = data.items.map(mapToStreamPageViewerModel);
|
|
40
|
+
this._loaded = [...this._loaded, ...items];
|
|
41
|
+
return {
|
|
42
|
+
items: items,
|
|
43
|
+
continuationToken: ContinuationToken.fromPayload(data.continuationToken)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.warmUpBuffer();
|
|
48
|
+
this.loadNext = Utils.throttle(this.loadNext, this.animationDuration);
|
|
49
|
+
this.loadPrevious = Utils.throttle(this.loadPrevious, this.animationDuration);
|
|
50
|
+
}
|
|
51
|
+
loadMore = () => this._pagesLoader.loadMore();
|
|
52
|
+
loadNext = async () => {
|
|
53
|
+
if (!this.canLoadNext) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
++this._currentIndex;
|
|
57
|
+
this.warmUpBuffer();
|
|
58
|
+
};
|
|
59
|
+
loadPrevious = async () => {
|
|
60
|
+
if (!this.canLoadPrevious) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
--this._currentIndex;
|
|
64
|
+
};
|
|
65
|
+
setIndex = (index) => {
|
|
66
|
+
this._currentIndex = index;
|
|
67
|
+
this.warmUpBuffer();
|
|
68
|
+
};
|
|
69
|
+
reset = () => {
|
|
70
|
+
this._pagesLoader.reset();
|
|
71
|
+
};
|
|
72
|
+
warmUpBuffer = async () => {
|
|
73
|
+
const bufferSize = 5;
|
|
74
|
+
if (this.loaded.length >= this.currentIndex + bufferSize) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await this._pagesLoader.loadMore();
|
|
78
|
+
if (this._currentIndex < 0) {
|
|
79
|
+
if (this.loaded.length > 0) {
|
|
80
|
+
this._currentIndex = 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IShortVideoDetailsLocalization } from '../../short-videos/short-video-viewer';
|
|
2
|
+
export interface IStreamPlayerLocalization {
|
|
3
|
+
streamNotFound?: string;
|
|
4
|
+
pagesCount?: (count: number) => string;
|
|
5
|
+
shortVideoDetailsLocalization?: IShortVideoDetailsLocalization;
|
|
6
|
+
}
|
|
7
|
+
export declare class StreamPlayerLocalization {
|
|
8
|
+
streamNotFound: string;
|
|
9
|
+
pagesCount: (count: number) => string;
|
|
10
|
+
shortVideoDetailsLocalization: IShortVideoDetailsLocalization | undefined;
|
|
11
|
+
constructor(init?: IStreamPlayerLocalization);
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class StreamPlayerLocalization {
|
|
2
|
+
streamNotFound = $state('Stream not found');
|
|
3
|
+
pagesCount = $state((count) => (count === 1 ? '1 page' : `${count} pages`));
|
|
4
|
+
shortVideoDetailsLocalization = $state(undefined);
|
|
5
|
+
constructor(init) {
|
|
6
|
+
this.streamNotFound = init?.streamNotFound || this.streamNotFound;
|
|
7
|
+
this.pagesCount = init?.pagesCount || this.pagesCount;
|
|
8
|
+
this.shortVideoDetailsLocalization = init?.shortVideoDetailsLocalization || this.shortVideoDetailsLocalization;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class StreamPlayerUiManager {
|
|
2
|
+
overviewCollapsed: boolean;
|
|
3
|
+
shortVideoDetailsCollapsed: boolean;
|
|
4
|
+
globalCssVariables: string;
|
|
5
|
+
isMobileView: boolean;
|
|
6
|
+
showShortVideoOverlay: boolean;
|
|
7
|
+
private readonly actionButtonSize;
|
|
8
|
+
private readonly navigationButtonSize;
|
|
9
|
+
private readonly controlsOffsetHorizontal;
|
|
10
|
+
private readonly controlsOffsetVertical;
|
|
11
|
+
private viewTotalWidth;
|
|
12
|
+
private mainViewColumnWidth;
|
|
13
|
+
updateDimensions: (dimensions: {
|
|
14
|
+
viewTotalWidth: number;
|
|
15
|
+
mainViewColumnWidth: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class StreamPlayerUiManager {
|
|
2
|
+
overviewCollapsed = $state(false);
|
|
3
|
+
shortVideoDetailsCollapsed = $state(true);
|
|
4
|
+
globalCssVariables = $derived.by(() => {
|
|
5
|
+
const values = [
|
|
6
|
+
`--stream-player--action-button--size: ${this.actionButtonSize}px`,
|
|
7
|
+
`--stream-player--navigation-button--size: ${this.navigationButtonSize}px`,
|
|
8
|
+
`--stream-player--controls--offset-horizontal: ${this.controlsOffsetHorizontal}px`,
|
|
9
|
+
`--stream-player--controls--offset-vertical: ${this.controlsOffsetVertical}px`,
|
|
10
|
+
`--stream-player--sidebar--available-space: ${(this.viewTotalWidth - this.mainViewColumnWidth) / 2}px`
|
|
11
|
+
];
|
|
12
|
+
return values.join(';');
|
|
13
|
+
});
|
|
14
|
+
isMobileView = $derived.by(() => this.viewTotalWidth <= 576);
|
|
15
|
+
showShortVideoOverlay = $derived.by(() => (this.viewTotalWidth - this.mainViewColumnWidth) / 2 <= 70);
|
|
16
|
+
actionButtonSize = 30;
|
|
17
|
+
navigationButtonSize = 40;
|
|
18
|
+
controlsOffsetHorizontal = 15;
|
|
19
|
+
controlsOffsetVertical = 10;
|
|
20
|
+
viewTotalWidth = $state(0);
|
|
21
|
+
mainViewColumnWidth = $state(0);
|
|
22
|
+
updateDimensions = (dimensions) => {
|
|
23
|
+
this.viewTotalWidth = dimensions.viewTotalWidth;
|
|
24
|
+
this.mainViewColumnWidth = dimensions.mainViewColumnWidth;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">import ButtonBase from './resources/button-base.svelte';
|
|
2
|
+
import ButtonTheme from './resources/button-theme.svelte';
|
|
3
|
+
let { type = 'button', disabled = false, autofocus = false, style = null, size = null, on, children } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<ButtonTheme style={style} size={size}>
|
|
7
|
+
<ButtonBase disabled={disabled} type={type} autofocus={autofocus} on={on}>
|
|
8
|
+
{@render children()}
|
|
9
|
+
</ButtonBase>
|
|
10
|
+
</ButtonTheme>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonStyle, ButtonSize } from './resources/button-types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = {
|
|
4
|
+
type?: 'button' | 'submit' | 'reset';
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
autofocus?: boolean;
|
|
7
|
+
style?: ButtonStyle | null;
|
|
8
|
+
size?: ButtonSize | null;
|
|
9
|
+
on?: {
|
|
10
|
+
click: (e: MouseEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
children: Snippet;
|
|
13
|
+
};
|
|
14
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
15
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
16
|
+
export default Cmp;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts">import { onMount } from 'svelte';
|
|
2
|
+
let { type = 'button', disabled = false, autofocus = false, on, children } = $props();
|
|
3
|
+
let buttonRef;
|
|
4
|
+
onMount(() => {
|
|
5
|
+
if (autofocus) {
|
|
6
|
+
buttonRef.focus();
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<button class="button" disabled={disabled} type={type} bind:this={buttonRef} onclick={(e) => on?.click?.(e)}>
|
|
12
|
+
<span class="button__text">
|
|
13
|
+
{@render children()}
|
|
14
|
+
</span>
|
|
15
|
+
</button>
|
|
16
|
+
|
|
17
|
+
<style>@keyframes fadeIn {
|
|
18
|
+
0% {
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
50% {
|
|
22
|
+
opacity: 0.4;
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.button {
|
|
29
|
+
--_button--font--size: var(--button--font--size, 1rem);
|
|
30
|
+
--_button--font--color: var(--button--font--color, black);
|
|
31
|
+
--_button--font-weight: var(--button--font-weight, 400);
|
|
32
|
+
--_button--text--font-size: var(--button--text--font-size, 0.75em);
|
|
33
|
+
--_button--icon--font-size: var(--button--icon--font-size, 1em);
|
|
34
|
+
--_button--justify-content: var(--button--justify-content, center);
|
|
35
|
+
--_button--background: var(--button--background, white);
|
|
36
|
+
--_button--background--hover: var(--button--background--hover, var(--_button--background));
|
|
37
|
+
--_button--background--active: var(--button--background--active, var(--_button--background));
|
|
38
|
+
--_button--background--disabled: var(--button--background--disabled, var(--_button--background));
|
|
39
|
+
--_button--border: var(--button--border, none);
|
|
40
|
+
--_button--border-radius: var(--button--border-radius, 0.25em);
|
|
41
|
+
--_button--padding--vertical: var(--button--padding--vertical, 0);
|
|
42
|
+
--_button--padding--horizontal: var(--button--padding--horizontal, 1em);
|
|
43
|
+
--_button--min-width: var(--button--min-width, 0);
|
|
44
|
+
--_button--height: var(--button--height, 2em);
|
|
45
|
+
--_button--box-shadow: var(--button--box-shadow, none);
|
|
46
|
+
font-size: var(--_button--font--size);
|
|
47
|
+
font-weight: var(--_button--font-weight);
|
|
48
|
+
padding: var(--_button--padding--vertical) var(--_button--padding--horizontal);
|
|
49
|
+
color: var(--_button--font--color);
|
|
50
|
+
background: var(--_button--background);
|
|
51
|
+
box-shadow: var(--_button--box-shadow);
|
|
52
|
+
border: var(--_button--border);
|
|
53
|
+
border-radius: var(--_button--border-radius);
|
|
54
|
+
min-width: var(--_button--min-width);
|
|
55
|
+
max-width: 100%;
|
|
56
|
+
height: var(--_button--height);
|
|
57
|
+
outline: none;
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
flex: 1;
|
|
60
|
+
justify-content: var(--_button--justify-content);
|
|
61
|
+
align-items: center;
|
|
62
|
+
vertical-align: middle;
|
|
63
|
+
transition: background-color linear 0.2s, color linear 0.2s, border-color linear 0.2s, filter linear 0.2s;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
}
|
|
66
|
+
.button__text {
|
|
67
|
+
width: 100%;
|
|
68
|
+
text-align: center;
|
|
69
|
+
font-size: var(--_button--text--font-size);
|
|
70
|
+
--icon-text--global--font-size: 1rem;
|
|
71
|
+
--icon-text--text--font-size: var(--_button--text--font-size);
|
|
72
|
+
--icon-text--icon--font-size: var(--_button--icon--font-size);
|
|
73
|
+
--icon-text--justify-content: var(--_button--justify-content);
|
|
74
|
+
}
|
|
75
|
+
.button:not(:disabled):hover {
|
|
76
|
+
background: var(--_button--background--hover);
|
|
77
|
+
}
|
|
78
|
+
.button:not(:disabled):active {
|
|
79
|
+
background: var(--_button--background--active);
|
|
80
|
+
}
|
|
81
|
+
.button:disabled {
|
|
82
|
+
cursor: default;
|
|
83
|
+
background: var(--_button--background--disabled);
|
|
84
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
type?: 'button' | 'submit' | 'reset';
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
autofocus?: boolean;
|
|
6
|
+
on?: {
|
|
7
|
+
click?: (e: MouseEvent) => void;
|
|
8
|
+
};
|
|
9
|
+
children: Snippet;
|
|
10
|
+
};
|
|
11
|
+
declare const ButtonBase: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type ButtonBase = ReturnType<typeof ButtonBase>;
|
|
13
|
+
export default ButtonBase;
|