@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
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class ContinuationToken {
|
|
2
|
-
canLoadMore: boolean;
|
|
3
|
-
value: string | null;
|
|
4
|
-
private constructor();
|
|
5
|
-
static init(): ContinuationToken;
|
|
6
|
-
static fromPayload(value: string | null): ContinuationToken;
|
|
7
|
-
static preventLoading(): ContinuationToken;
|
|
8
|
-
toString(): string | null;
|
|
9
|
-
toJSON(): string | null;
|
|
10
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export class ContinuationToken {
|
|
2
|
-
canLoadMore;
|
|
3
|
-
value;
|
|
4
|
-
constructor(canLoadMore, value) {
|
|
5
|
-
this.canLoadMore = canLoadMore;
|
|
6
|
-
this.value = value;
|
|
7
|
-
}
|
|
8
|
-
static init() {
|
|
9
|
-
// initial state, no data is loaded so far
|
|
10
|
-
return new ContinuationToken(true, null);
|
|
11
|
-
}
|
|
12
|
-
static fromPayload(value) {
|
|
13
|
-
if (value?.length && value.length > 1 && value.length < 5000) {
|
|
14
|
-
// initialized with server response that there is more data, and value is valid
|
|
15
|
-
return new ContinuationToken(true, value);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
// initialized with server response that there is no more data or value is invalid
|
|
19
|
-
return new ContinuationToken(false, null);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
static preventLoading() {
|
|
23
|
-
// additional initilizer, to block further loading
|
|
24
|
-
return new ContinuationToken(false, null);
|
|
25
|
-
}
|
|
26
|
-
toString() {
|
|
27
|
-
return this.value;
|
|
28
|
-
}
|
|
29
|
-
toJSON() {
|
|
30
|
-
return this.value;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type CursorResult } from '../cursor-result';
|
|
2
|
-
import { ContinuationToken } from '../continuation-token';
|
|
3
|
-
import type { IDataLoader } from './data-loader';
|
|
4
|
-
export declare class CursorDataLoader<T> implements IDataLoader<T> {
|
|
5
|
-
items: T[];
|
|
6
|
-
continuationToken: ContinuationToken;
|
|
7
|
-
private loadPage;
|
|
8
|
-
private deferred;
|
|
9
|
-
constructor(init: {
|
|
10
|
-
loadPage: (continuationToken: ContinuationToken) => Promise<CursorResult<T> | null>;
|
|
11
|
-
});
|
|
12
|
-
loadMore: () => Promise<T[]>;
|
|
13
|
-
reset(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {} from '../cursor-result';
|
|
2
|
-
import { Deferred } from '../deferred';
|
|
3
|
-
import { ContinuationToken } from '../continuation-token';
|
|
4
|
-
export class CursorDataLoader {
|
|
5
|
-
items = $state([]);
|
|
6
|
-
continuationToken = $state.raw(ContinuationToken.init());
|
|
7
|
-
loadPage;
|
|
8
|
-
deferred = null;
|
|
9
|
-
constructor(init) {
|
|
10
|
-
this.loadPage = init.loadPage;
|
|
11
|
-
}
|
|
12
|
-
loadMore = async () => {
|
|
13
|
-
if (this.deferred) {
|
|
14
|
-
return this.deferred.promise;
|
|
15
|
-
}
|
|
16
|
-
if (!this.continuationToken.canLoadMore) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
this.deferred = new Deferred();
|
|
20
|
-
let result = await this.loadPage(this.continuationToken);
|
|
21
|
-
if (!result) {
|
|
22
|
-
result = { items: [], continuationToken: ContinuationToken.preventLoading() };
|
|
23
|
-
}
|
|
24
|
-
this.continuationToken = result.continuationToken;
|
|
25
|
-
this.items = [...this.items, ...result.items];
|
|
26
|
-
this.deferred.resolve(result.items);
|
|
27
|
-
this.deferred = null;
|
|
28
|
-
return result.items;
|
|
29
|
-
};
|
|
30
|
-
async reset() {
|
|
31
|
-
this.items = [];
|
|
32
|
-
this.continuationToken = ContinuationToken.init();
|
|
33
|
-
await this.loadMore();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CursorDataLoader } from './cursor-data-loader.svelte';
|
package/dist/core/deferred.d.ts
DELETED
package/dist/core/deferred.js
DELETED
package/dist/core/enums.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare enum PostSourceType {
|
|
2
|
-
Channel = "CHANNEL",
|
|
3
|
-
Group = "GROUP",
|
|
4
|
-
MediaPage = "MEDIA_PAGE",
|
|
5
|
-
Organization = "ORGANIZATION",
|
|
6
|
-
UserProfile = "USER_PROFILE"
|
|
7
|
-
}
|
|
8
|
-
export declare enum AdType {
|
|
9
|
-
BannerResponsive = "BANNER_RESPONSIVE",
|
|
10
|
-
MediaDialogPromotion = "MEDIA_DIALOG_PROMOTION",
|
|
11
|
-
Story = "STORY"
|
|
12
|
-
}
|
|
13
|
-
export declare enum Currency {
|
|
14
|
-
Eur = "EUR",
|
|
15
|
-
Nok = "NOK",
|
|
16
|
-
Usd = "USD"
|
|
17
|
-
}
|
|
18
|
-
export declare enum MediaType {
|
|
19
|
-
Audio = "AUDIO",
|
|
20
|
-
Image = "IMAGE",
|
|
21
|
-
ShortVideo = "SHORT_VIDEO",
|
|
22
|
-
Video = "VIDEO"
|
|
23
|
-
}
|
|
24
|
-
export declare enum MediaFormat {
|
|
25
|
-
W4H3 = "W4H3",
|
|
26
|
-
W16H9 = "W16H9"
|
|
27
|
-
}
|
|
28
|
-
export declare enum ImageScale {
|
|
29
|
-
Big = "BIG",
|
|
30
|
-
Medium = "MEDIUM",
|
|
31
|
-
OriginalEncoded = "ORIGINAL_ENCODED",
|
|
32
|
-
Small = "SMALL"
|
|
33
|
-
}
|
package/dist/core/enums.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export var PostSourceType;
|
|
2
|
-
(function (PostSourceType) {
|
|
3
|
-
PostSourceType["Channel"] = "CHANNEL";
|
|
4
|
-
PostSourceType["Group"] = "GROUP";
|
|
5
|
-
PostSourceType["MediaPage"] = "MEDIA_PAGE";
|
|
6
|
-
PostSourceType["Organization"] = "ORGANIZATION";
|
|
7
|
-
PostSourceType["UserProfile"] = "USER_PROFILE";
|
|
8
|
-
})(PostSourceType || (PostSourceType = {}));
|
|
9
|
-
export var AdType;
|
|
10
|
-
(function (AdType) {
|
|
11
|
-
AdType["BannerResponsive"] = "BANNER_RESPONSIVE";
|
|
12
|
-
AdType["MediaDialogPromotion"] = "MEDIA_DIALOG_PROMOTION";
|
|
13
|
-
AdType["Story"] = "STORY";
|
|
14
|
-
})(AdType || (AdType = {}));
|
|
15
|
-
export var Currency;
|
|
16
|
-
(function (Currency) {
|
|
17
|
-
Currency["Eur"] = "EUR";
|
|
18
|
-
Currency["Nok"] = "NOK";
|
|
19
|
-
Currency["Usd"] = "USD";
|
|
20
|
-
})(Currency || (Currency = {}));
|
|
21
|
-
export var MediaType;
|
|
22
|
-
(function (MediaType) {
|
|
23
|
-
MediaType["Audio"] = "AUDIO";
|
|
24
|
-
MediaType["Image"] = "IMAGE";
|
|
25
|
-
MediaType["ShortVideo"] = "SHORT_VIDEO";
|
|
26
|
-
MediaType["Video"] = "VIDEO";
|
|
27
|
-
})(MediaType || (MediaType = {}));
|
|
28
|
-
export var MediaFormat;
|
|
29
|
-
(function (MediaFormat) {
|
|
30
|
-
MediaFormat["W4H3"] = "W4H3";
|
|
31
|
-
MediaFormat["W16H9"] = "W16H9";
|
|
32
|
-
})(MediaFormat || (MediaFormat = {}));
|
|
33
|
-
export var ImageScale;
|
|
34
|
-
(function (ImageScale) {
|
|
35
|
-
ImageScale["Big"] = "BIG";
|
|
36
|
-
ImageScale["Medium"] = "MEDIUM";
|
|
37
|
-
ImageScale["OriginalEncoded"] = "ORIGINAL_ENCODED";
|
|
38
|
-
ImageScale["Small"] = "SMALL";
|
|
39
|
-
})(ImageScale || (ImageScale = {}));
|
package/dist/core/graphql.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createLocalGQLClient: (graphqlUrl: string, customFetch?: typeof fetch) => import("@urql/core").Client;
|
package/dist/core/graphql.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createClient, fetchExchange } from '@urql/core';
|
|
2
|
-
export const createLocalGQLClient = (graphqlUrl, customFetch) => createClient({
|
|
3
|
-
url: graphqlUrl,
|
|
4
|
-
requestPolicy: 'network-only',
|
|
5
|
-
fetchOptions: {
|
|
6
|
-
credentials: 'include'
|
|
7
|
-
},
|
|
8
|
-
fetch: customFetch || fetch,
|
|
9
|
-
exchanges: [fetchExchange]
|
|
10
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class ImageHelper {
|
|
2
|
-
static checkIsVertical: (url: string) => Promise<boolean>;
|
|
3
|
-
static computeRatio: (src: string) => Promise<ImageSize | null>;
|
|
4
|
-
static getRatio: (metadata: ImageSize) => number;
|
|
5
|
-
}
|
|
6
|
-
type ImageSize = {
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export class ImageHelper {
|
|
2
|
-
static checkIsVertical = async (url) => {
|
|
3
|
-
const ratio = await ImageHelper.computeRatio(url);
|
|
4
|
-
if (!ratio) {
|
|
5
|
-
return false;
|
|
6
|
-
}
|
|
7
|
-
return ratio.height >= ratio.width;
|
|
8
|
-
};
|
|
9
|
-
static computeRatio = async (src) => {
|
|
10
|
-
const setRatio = (imageElement, resolveFn) => {
|
|
11
|
-
if (!imageElement || !imageElement.width) {
|
|
12
|
-
resolveFn(null);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
resolveFn({ width: imageElement.width, height: imageElement.height });
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return new Promise((resolve) => {
|
|
19
|
-
const imageElement = new Image();
|
|
20
|
-
imageElement.onload = () => {
|
|
21
|
-
setRatio(imageElement, resolve);
|
|
22
|
-
};
|
|
23
|
-
imageElement.onerror = () => {
|
|
24
|
-
setRatio(null, resolve);
|
|
25
|
-
};
|
|
26
|
-
imageElement.src = src;
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
static getRatio = (metadata) => metadata.width / metadata.height;
|
|
30
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ImageScale } from '../enums';
|
|
2
|
-
import MobileDetect from 'mobile-detect';
|
|
3
|
-
export class ImageSizeDetectorService {
|
|
4
|
-
userAgent;
|
|
5
|
-
constructor(userAgent = null) {
|
|
6
|
-
this.userAgent = userAgent;
|
|
7
|
-
}
|
|
8
|
-
getImageSize() {
|
|
9
|
-
if (!this.userAgent) {
|
|
10
|
-
return ImageScale.OriginalEncoded;
|
|
11
|
-
}
|
|
12
|
-
const result = new MobileDetect(this.userAgent);
|
|
13
|
-
return result.mobile() ? ImageScale.Medium : ImageScale.OriginalEncoded;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { ImageHelper } from './image-helper';
|
|
2
|
-
export { ImageSizeDetectorService } from './images-size-detector.service';
|
|
3
|
-
export { type MediaItemModel, type MediaItemMetadataModel, type MediaItemWithMetadataModel } from './types';
|
|
4
|
-
export { getMediaItemImageUrl } from './media-item-url.service';
|
package/dist/core/media/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { MediaType } from '../enums';
|
|
2
|
-
export type MediaItemModel = {
|
|
3
|
-
type: MediaType;
|
|
4
|
-
url: string;
|
|
5
|
-
thumbnailUrl: string | null;
|
|
6
|
-
};
|
|
7
|
-
export type MediaItemMetadataModel = {
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
};
|
|
11
|
-
export type MediaItemWithMetadataModel = MediaItemModel & {
|
|
12
|
-
metadata: MediaItemMetadataModel;
|
|
13
|
-
};
|
package/dist/core/media/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/core/toastr.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const toastrWarning: (message: string) => void;
|
package/dist/core/toastr.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const toastrWarning = (message) => {
|
|
2
|
-
const toast = document.createElement('div');
|
|
3
|
-
toast.innerHTML = `
|
|
4
|
-
<span>${message}</span>
|
|
5
|
-
<span style="margin-left: auto; cursor: pointer; color: #666;" onclick="this.parentElement.remove()">x</span>
|
|
6
|
-
`;
|
|
7
|
-
Object.assign(toast.style, {
|
|
8
|
-
display: 'flex',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
gap: '8px',
|
|
11
|
-
background: 'white',
|
|
12
|
-
color: 'black',
|
|
13
|
-
borderRadius: '5px',
|
|
14
|
-
padding: '12px 16px',
|
|
15
|
-
boxShadow: '0 2px 10px rgba(0, 0, 0, 0.1)',
|
|
16
|
-
position: 'fixed',
|
|
17
|
-
bottom: '10px',
|
|
18
|
-
right: '10px',
|
|
19
|
-
width: '300px',
|
|
20
|
-
borderLeft: '4px solid #e0a800',
|
|
21
|
-
borderBottom: '4px solid #e0a800',
|
|
22
|
-
zIndex: 1000
|
|
23
|
-
});
|
|
24
|
-
document.body.appendChild(toast);
|
|
25
|
-
setTimeout(() => toast.remove(), 5000);
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { slideHorizontally } from './slide-horizontally';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { slideHorizontally } from './slide-horizontally';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { sineInOut } from 'svelte/easing';
|
|
2
|
-
import type { TransitionConfig } from 'svelte/transition';
|
|
3
|
-
export declare const slideHorizontally: (node: HTMLElement, { delay, duration, easing }?: {
|
|
4
|
-
delay?: number | undefined;
|
|
5
|
-
duration?: number | undefined;
|
|
6
|
-
easing?: typeof sineInOut | undefined;
|
|
7
|
-
}) => TransitionConfig;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { sineInOut } from 'svelte/easing';
|
|
2
|
-
export const slideHorizontally = (node, { delay = 0, duration = 400, easing = sineInOut } = {}) => {
|
|
3
|
-
const style = getComputedStyle(node);
|
|
4
|
-
const isHtmlElement = (node) => node.nodeType === Node.ELEMENT_NODE;
|
|
5
|
-
const children = Array.from(node.children).filter(isHtmlElement);
|
|
6
|
-
children.forEach((child) => {
|
|
7
|
-
const style = getComputedStyle(child);
|
|
8
|
-
child.style.width = style.width;
|
|
9
|
-
child.style.minWidth = style.width;
|
|
10
|
-
child.style.maxWidth = style.maxWidth;
|
|
11
|
-
});
|
|
12
|
-
const opacity = +style.opacity;
|
|
13
|
-
const width = parseFloat(style.width);
|
|
14
|
-
const padding_left = parseFloat(style.paddingLeft);
|
|
15
|
-
const padding_right = parseFloat(style.paddingRight);
|
|
16
|
-
const margin_left = parseFloat(style.marginLeft);
|
|
17
|
-
const margin_right = parseFloat(style.marginRight);
|
|
18
|
-
const border_left_width = parseFloat(style.borderLeftWidth);
|
|
19
|
-
const border_right_width = parseFloat(style.borderRightWidth);
|
|
20
|
-
let initialT = undefined;
|
|
21
|
-
let initialU = undefined;
|
|
22
|
-
return {
|
|
23
|
-
delay,
|
|
24
|
-
duration,
|
|
25
|
-
easing,
|
|
26
|
-
css: (t, u) => {
|
|
27
|
-
if (initialT === undefined) {
|
|
28
|
-
initialT = t;
|
|
29
|
-
}
|
|
30
|
-
if (initialU === undefined) {
|
|
31
|
-
initialU = u;
|
|
32
|
-
}
|
|
33
|
-
return ('overflow: hidden;' +
|
|
34
|
-
`opacity: ${Math.min(t, 1) * opacity};` +
|
|
35
|
-
`width: ${t * width}px;` +
|
|
36
|
-
`min-width: ${t * width}px;` +
|
|
37
|
-
`padding-left: ${t * padding_left}px;` +
|
|
38
|
-
`padding-right: ${t * padding_right}px;` +
|
|
39
|
-
`margin-left: ${t * margin_left}px;` +
|
|
40
|
-
`margin-right: ${t * margin_right}px;` +
|
|
41
|
-
`border-left-width: ${t * border_left_width}px;` +
|
|
42
|
-
`border-right-width: ${t * border_right_width}px;`);
|
|
43
|
-
},
|
|
44
|
-
// Clean up function to remove the wrapper when the transition is done
|
|
45
|
-
tick: (t, u) => {
|
|
46
|
-
if ((initialT === 0 && t === 1) || (initialU === 0 && u === 1)) {
|
|
47
|
-
children.forEach((child) => {
|
|
48
|
-
child.style.width = '';
|
|
49
|
-
child.style.minWidth = '';
|
|
50
|
-
child.style.maxWidth = '';
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare class ArrayHelper {
|
|
2
|
-
static distinct<T>(items: T[]): T[];
|
|
3
|
-
static distinctBy<T>(items: T[], keyFn: (elem: T) => unknown): T[];
|
|
4
|
-
static intersect<T>(arrays: T[][]): T[];
|
|
5
|
-
static assertHasValue<T>(value: T | null | undefined): value is T;
|
|
6
|
-
/**
|
|
7
|
-
* Find position ("from" and "to" indexes) of the element that was moved inside array (only one element should be moved)
|
|
8
|
-
*/
|
|
9
|
-
static findMovedElement(initial: unknown[], modified: unknown[]): {
|
|
10
|
-
from: number;
|
|
11
|
-
to: number;
|
|
12
|
-
} | undefined;
|
|
13
|
-
static moveArrayItem<T>(arr: T[], from: number, to: number): T[];
|
|
14
|
-
static replaceArrayItem<T>(arr: T[], originalItem: T, newItem: T): T[];
|
|
15
|
-
static randomElement<T>(arr: T[]): T;
|
|
16
|
-
static randomElements<T>(arr: T[], count: number): T[];
|
|
17
|
-
static sortArray<T>(array: T[], propertyFunc: (elem: T) => unknown): T[];
|
|
18
|
-
static sortArrayDescending<T>(array: T[], propertyFunc: (elem: T) => unknown): T[];
|
|
19
|
-
static groupBy<T>(array: T[], keyResolver: (elem: T) => string): Record<string, T[]>;
|
|
20
|
-
static repeat<T>(itemFn: (i: number) => T, length: number): T[];
|
|
21
|
-
static areEqual<T>(array1?: T[] | null, array2?: T[] | null): boolean;
|
|
22
|
-
private static sortArrayInternal;
|
|
23
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
export class ArrayHelper {
|
|
2
|
-
static distinct(items) {
|
|
3
|
-
return Array.from(new Set(items));
|
|
4
|
-
}
|
|
5
|
-
static distinctBy(items, keyFn) {
|
|
6
|
-
return Array.from(new Map(items.map((item) => [keyFn(item), item])).values());
|
|
7
|
-
}
|
|
8
|
-
static intersect(arrays) {
|
|
9
|
-
if (!arrays?.length) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return arrays.reduce((result, current) => result.filter((item) => current.includes(item)));
|
|
13
|
-
}
|
|
14
|
-
static assertHasValue(value) {
|
|
15
|
-
return value !== null && value !== undefined;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Find position ("from" and "to" indexes) of the element that was moved inside array (only one element should be moved)
|
|
19
|
-
*/
|
|
20
|
-
static findMovedElement(initial, modified) {
|
|
21
|
-
if (initial.length !== modified.length) {
|
|
22
|
-
throw new Error('Arrays should have the same number of elements.');
|
|
23
|
-
}
|
|
24
|
-
if (initial.length !== new Set(initial).size || modified.length !== new Set(modified).size) {
|
|
25
|
-
throw new Error("Arrays shouldn't have duplicates.");
|
|
26
|
-
}
|
|
27
|
-
const res = { from: -1, to: -1 };
|
|
28
|
-
let i = 0;
|
|
29
|
-
for (i; i < initial.length; i++) {
|
|
30
|
-
if (initial[i] !== modified[i]) {
|
|
31
|
-
if (initial[i] === modified[i + 1]) {
|
|
32
|
-
res.to = i;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
res.from = i;
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (i === initial.length) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
let j = initial.length;
|
|
44
|
-
for (j; j > i; j--) {
|
|
45
|
-
if (initial[j] !== modified[j]) {
|
|
46
|
-
if (res.from === -1) {
|
|
47
|
-
res.from = j;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
res.to = j;
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return res;
|
|
56
|
-
}
|
|
57
|
-
static moveArrayItem(arr, from, to) {
|
|
58
|
-
if (!arr?.length || from < 0 || from >= arr.length || to < 0 || to >= arr.length || from === to) {
|
|
59
|
-
return arr;
|
|
60
|
-
}
|
|
61
|
-
arr.splice(to, 0, arr.splice(from, 1)[0]);
|
|
62
|
-
return arr;
|
|
63
|
-
}
|
|
64
|
-
static replaceArrayItem(arr, originalItem, newItem) {
|
|
65
|
-
const index = arr.indexOf(originalItem);
|
|
66
|
-
if (index < 0) {
|
|
67
|
-
return arr;
|
|
68
|
-
}
|
|
69
|
-
arr.splice(index, 1, newItem);
|
|
70
|
-
return arr;
|
|
71
|
-
}
|
|
72
|
-
static randomElement(arr) {
|
|
73
|
-
if (!Array.isArray(arr)) {
|
|
74
|
-
throw new Error('Parameter is not an array.');
|
|
75
|
-
}
|
|
76
|
-
return arr[Math.floor(Math.random() * arr.length)];
|
|
77
|
-
}
|
|
78
|
-
static randomElements(arr, count) {
|
|
79
|
-
const result = [];
|
|
80
|
-
for (let i = 0; i < count; i++) {
|
|
81
|
-
let newItem = null;
|
|
82
|
-
while (!newItem) {
|
|
83
|
-
const item = ArrayHelper.randomElement(arr);
|
|
84
|
-
if (!result.includes(item)) {
|
|
85
|
-
newItem = item;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
result.push(newItem);
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
static sortArray(array, propertyFunc) {
|
|
93
|
-
return ArrayHelper.sortArrayInternal(array, true, propertyFunc);
|
|
94
|
-
}
|
|
95
|
-
static sortArrayDescending(array, propertyFunc) {
|
|
96
|
-
return ArrayHelper.sortArrayInternal(array, false, propertyFunc);
|
|
97
|
-
}
|
|
98
|
-
static groupBy(array, keyResolver) {
|
|
99
|
-
return array.reduce((resultValue, value) => {
|
|
100
|
-
const groupKey = keyResolver(value);
|
|
101
|
-
(resultValue[groupKey] = resultValue[groupKey] || []).push(value);
|
|
102
|
-
return resultValue;
|
|
103
|
-
}, {});
|
|
104
|
-
}
|
|
105
|
-
static repeat(itemFn, length) {
|
|
106
|
-
return [...Array(length)].map((_, i) => itemFn(i));
|
|
107
|
-
}
|
|
108
|
-
static areEqual(array1, array2) {
|
|
109
|
-
if (array1 === array2) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
if (!array1 && !array2) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
if (!array1 || !array2) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
return array1.length === array2.length && array1.every((element, index) => element === array2[index]);
|
|
119
|
-
}
|
|
120
|
-
static sortArrayInternal(array, ascending, propertyFunc) {
|
|
121
|
-
const clone = [...array];
|
|
122
|
-
return clone.sort((val1, val2) => {
|
|
123
|
-
const a = propertyFunc(val1);
|
|
124
|
-
const b = propertyFunc(val2);
|
|
125
|
-
const left = ascending ? a : b;
|
|
126
|
-
const right = ascending ? b : a;
|
|
127
|
-
if (!left && !right) {
|
|
128
|
-
return 0;
|
|
129
|
-
}
|
|
130
|
-
if (!left) {
|
|
131
|
-
return -1;
|
|
132
|
-
}
|
|
133
|
-
if (!right) {
|
|
134
|
-
return 1;
|
|
135
|
-
}
|
|
136
|
-
if (typeof left === 'string' && typeof right === 'string') {
|
|
137
|
-
return left.localeCompare(right);
|
|
138
|
-
}
|
|
139
|
-
if (left < right) {
|
|
140
|
-
return -1;
|
|
141
|
-
}
|
|
142
|
-
if (left > right) {
|
|
143
|
-
return 1;
|
|
144
|
-
}
|
|
145
|
-
return 0;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare class DateHelper {
|
|
2
|
-
static toDate(date: LikeDate, resetTime?: boolean): Date;
|
|
3
|
-
static secondsToTimeRepresentation(seconds: number, duration: number): string;
|
|
4
|
-
static getDate(date: LikeDate): number;
|
|
5
|
-
static getYear(date: LikeDate): number;
|
|
6
|
-
static getMonthName(date: LikeDate, locale: string, short?: boolean): string;
|
|
7
|
-
static getWeekdayName(date: LikeDate, locale: string, short?: boolean): string;
|
|
8
|
-
static getMonthRange(date: LikeDate): MonthRange;
|
|
9
|
-
static daysInMonth(date: LikeDate): number;
|
|
10
|
-
static getDayOfWeek(date: LikeDate): number;
|
|
11
|
-
static getShiftedDate(date: LikeDate, daysShift: number): Date;
|
|
12
|
-
static getDateOnlyString(date?: LikeDate): string | null;
|
|
13
|
-
static formatDateRange(startDate: LikeDate, endDate: LikeDate, locale: string): string;
|
|
14
|
-
static dateRangeDescriptionString(startDate: LikeDate, endDate: LikeDate | null | undefined, locale: string): string;
|
|
15
|
-
}
|
|
16
|
-
export declare class DateFormatOptions {
|
|
17
|
-
static dateTimeFormat: Intl.DateTimeFormatOptions;
|
|
18
|
-
static dateTimeWithoutYearFormat: Intl.DateTimeFormatOptions;
|
|
19
|
-
static timeFormat: Intl.DateTimeFormatOptions;
|
|
20
|
-
static dateFormat: Intl.DateTimeFormatOptions;
|
|
21
|
-
static dateFormatWithoutYear: Intl.DateTimeFormatOptions;
|
|
22
|
-
static dateFullMonthFormat: Intl.DateTimeFormatOptions;
|
|
23
|
-
}
|
|
24
|
-
export type MonthRange = {
|
|
25
|
-
firstDay: Date;
|
|
26
|
-
lastDay: Date;
|
|
27
|
-
};
|
|
28
|
-
type LikeDate = string | number | Date;
|
|
29
|
-
export {};
|