@ethlete/core 1.2.0 → 1.4.0
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/esm2020/lib/utils/animation.utils.mjs +26 -2
- package/esm2020/lib/utils/public-api.mjs +2 -1
- package/esm2020/lib/utils/rxjs.utils.mjs +27 -0
- package/fesm2015/ethlete-core.mjs +49 -2
- package/fesm2015/ethlete-core.mjs.map +1 -1
- package/fesm2020/ethlete-core.mjs +52 -2
- package/fesm2020/ethlete-core.mjs.map +1 -1
- package/lib/utils/animation.utils.d.ts +12 -0
- package/lib/utils/public-api.d.ts +1 -0
- package/lib/utils/rxjs.utils.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding, InjectionToken, Injectable, ElementRef, Inject, Optional, isDevMode, Directive, EventEmitter, Output, NgZone, Pipe, QueryList } from '@angular/core';
|
|
3
3
|
import { DomSanitizer, Meta, Title } from '@angular/platform-browser';
|
|
4
|
-
import { fromEvent, Observable, Subject, startWith, map, takeUntil, distinctUntilChanged, BehaviorSubject, filter,
|
|
4
|
+
import { fromEvent, Observable, Subject, combineLatest, startWith, map, takeUntil, distinctUntilChanged, BehaviorSubject, filter, pairwise, debounceTime, shareReplay, tap, merge, skip, switchMap, take } from 'rxjs';
|
|
5
5
|
import { coerceElement, coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
6
6
|
import { DOCUMENT } from '@angular/common';
|
|
7
7
|
import { Router, NavigationEnd } from '@angular/router';
|
|
@@ -362,6 +362,30 @@ const fromNextFrame = () => {
|
|
|
362
362
|
const forceReflow = (element = document.body) => {
|
|
363
363
|
return element.offsetHeight;
|
|
364
364
|
};
|
|
365
|
+
const createFlipAnimationGroup = (config) => {
|
|
366
|
+
const { elements, duration = 250, easing = 'cubic-bezier(0.4, 0, 0.2, 1)' } = config;
|
|
367
|
+
const flips = elements.map((el) => createFlipAnimation({ element: el, duration, easing }));
|
|
368
|
+
const onStart$ = combineLatest(flips.map((animation) => animation.onStart$));
|
|
369
|
+
const onFinish$ = combineLatest(flips.map((animation) => animation.onFinish$));
|
|
370
|
+
const onCancel$ = combineLatest(flips.map((animation) => animation.onCancel$));
|
|
371
|
+
const updateInit = () => {
|
|
372
|
+
flips.forEach((animation) => animation.updateInit());
|
|
373
|
+
};
|
|
374
|
+
const play = () => {
|
|
375
|
+
flips.forEach((animation) => animation.play());
|
|
376
|
+
};
|
|
377
|
+
const cancel = () => {
|
|
378
|
+
flips.forEach((animation) => animation.cancel());
|
|
379
|
+
};
|
|
380
|
+
return {
|
|
381
|
+
updateInit,
|
|
382
|
+
play,
|
|
383
|
+
cancel,
|
|
384
|
+
onStart$,
|
|
385
|
+
onFinish$,
|
|
386
|
+
onCancel$,
|
|
387
|
+
};
|
|
388
|
+
};
|
|
365
389
|
const createFlipAnimation = (config) => {
|
|
366
390
|
const { element: el, duration = 250, easing = 'cubic-bezier(0.4, 0, 0.2, 1)' } = config;
|
|
367
391
|
let initialRect = el.getBoundingClientRect();
|
|
@@ -803,6 +827,32 @@ const createReactiveBindings = (...values) => {
|
|
|
803
827
|
};
|
|
804
828
|
};
|
|
805
829
|
|
|
830
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
831
|
+
class BehaviorSubjectWithSubscriberCount extends BehaviorSubject {
|
|
832
|
+
constructor() {
|
|
833
|
+
super(...arguments);
|
|
834
|
+
this._subscriberCount = 0;
|
|
835
|
+
}
|
|
836
|
+
get subscriberCount() {
|
|
837
|
+
return this._subscriberCount;
|
|
838
|
+
}
|
|
839
|
+
subscribe(observerOrNext) {
|
|
840
|
+
this._subscriberCount++;
|
|
841
|
+
const sub = super.subscribe(observerOrNext);
|
|
842
|
+
return {
|
|
843
|
+
...sub,
|
|
844
|
+
unsubscribe: () => {
|
|
845
|
+
sub.unsubscribe();
|
|
846
|
+
this._subscriberCount--;
|
|
847
|
+
},
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
unsubscribe() {
|
|
851
|
+
this._subscriberCount--;
|
|
852
|
+
return super.unsubscribe();
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
806
856
|
const elementCanScroll = (element) => {
|
|
807
857
|
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = element;
|
|
808
858
|
return scrollHeight > clientHeight || scrollWidth > clientWidth;
|
|
@@ -2513,5 +2563,5 @@ const Validators = {
|
|
|
2513
2563
|
* Generated bundle index. Do not edit.
|
|
2514
2564
|
*/
|
|
2515
2565
|
|
|
2516
|
-
export { ANIMATABLE_TOKEN, ANIMATED_LIFECYCLE_TOKEN, AnimatableDirective, AnimatedLifecycleDirective, ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DestroyService, FocusVisibleService, IS_ARRAY_NOT_EMPTY, IS_EMAIL, IsArrayNotEmpty, IsEmail, LetContext, LetDirective, MUST_MATCH, Memo, MustMatch, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, RouterStateService, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SeoDirective, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, Validators, ViewportService, clamp, clone, createFlipAnimation, createMediaQueryObservable, createReactiveBindings, deleteCookie, elementCanScroll, equal, forceReflow, fromNextFrame, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isGroupMatch, isKnockoutMatch, mergeSeoConfig, nextFrame, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, setCookie, toArray, toArrayTrackByFn };
|
|
2566
|
+
export { ANIMATABLE_TOKEN, ANIMATED_LIFECYCLE_TOKEN, AnimatableDirective, AnimatedLifecycleDirective, BehaviorSubjectWithSubscriberCount, ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DestroyService, FocusVisibleService, IS_ARRAY_NOT_EMPTY, IS_EMAIL, IsArrayNotEmpty, IsEmail, LetContext, LetDirective, MUST_MATCH, Memo, MustMatch, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, RouterStateService, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SeoDirective, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, Validators, ViewportService, clamp, clone, createFlipAnimation, createFlipAnimationGroup, createMediaQueryObservable, createReactiveBindings, deleteCookie, elementCanScroll, equal, forceReflow, fromNextFrame, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isGroupMatch, isKnockoutMatch, mergeSeoConfig, nextFrame, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, setCookie, toArray, toArrayTrackByFn };
|
|
2517
2567
|
//# sourceMappingURL=ethlete-core.mjs.map
|