@ethlete/core 2.2.1 → 2.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/esm2022/lib/directives/animatable/animatable.directive.mjs +2 -2
- package/esm2022/lib/services/router-state.service.mjs +4 -1
- package/esm2022/lib/services/viewport.service.mjs +72 -3
- package/esm2022/lib/utils/public-api.mjs +3 -1
- package/esm2022/lib/utils/runtime-error.utils.mjs +28 -0
- package/esm2022/lib/utils/selection-model.utils.mjs +292 -0
- package/fesm2022/ethlete-core.mjs +392 -3
- package/fesm2022/ethlete-core.mjs.map +1 -1
- package/lib/services/router-state.service.d.ts +1 -0
- package/lib/services/viewport.service.d.ts +23 -0
- package/lib/utils/public-api.d.ts +2 -0
- package/lib/utils/runtime-error.utils.d.ts +6 -0
- package/lib/utils/selection-model.utils.d.ts +72 -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, assertInInjectionContext, DestroyRef, ElementRef, isDevMode, Directive, Injectable, Inject, Optional, NgZone, EventEmitter, Output, Injector, ViewContainerRef, Pipe, QueryList } from '@angular/core';
|
|
3
3
|
import { DomSanitizer, Meta, Title } from '@angular/platform-browser';
|
|
4
|
-
import { Observable, combineLatest, Subject, startWith, map, takeUntil, distinctUntilChanged, BehaviorSubject, skip, take, tap, debounceTime, merge, fromEvent, filter, switchMap, pairwise,
|
|
4
|
+
import { Observable, combineLatest, Subject, startWith, map, takeUntil, distinctUntilChanged, BehaviorSubject, shareReplay, skip, take, tap, debounceTime, merge, fromEvent, filter, switchMap, pairwise, finalize } from 'rxjs';
|
|
5
5
|
import { coerceCssPixelValue, coerceElement, coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
6
6
|
import { supportsScrollBehavior } from '@angular/cdk/platform';
|
|
7
7
|
import { Overlay } from '@angular/cdk/overlay';
|
|
@@ -585,6 +585,33 @@ const createReactiveBindings = (...values) => {
|
|
|
585
585
|
};
|
|
586
586
|
};
|
|
587
587
|
|
|
588
|
+
class RuntimeError extends Error {
|
|
589
|
+
constructor(code, message, data = '__ET_NO_DATA__') {
|
|
590
|
+
super(formatRuntimeError(code, message));
|
|
591
|
+
this.code = code;
|
|
592
|
+
this.data = data;
|
|
593
|
+
if (data !== '__ET_NO_DATA__') {
|
|
594
|
+
try {
|
|
595
|
+
const _data = clone(data);
|
|
596
|
+
setTimeout(() => {
|
|
597
|
+
console.error(_data);
|
|
598
|
+
}, 1);
|
|
599
|
+
}
|
|
600
|
+
catch {
|
|
601
|
+
setTimeout(() => {
|
|
602
|
+
console.error(data);
|
|
603
|
+
}, 1);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
function formatRuntimeError(code, message) {
|
|
609
|
+
// prefix code with zeros if it's less than 100
|
|
610
|
+
const codeWithZeros = code < 10 ? `00${code}` : code < 100 ? `0${code}` : code;
|
|
611
|
+
const fullCode = `ET${codeWithZeros}`;
|
|
612
|
+
return `${fullCode}${message ? ': ' + message : ''}`;
|
|
613
|
+
}
|
|
614
|
+
|
|
588
615
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
589
616
|
class BehaviorSubjectWithSubscriberCount extends BehaviorSubject {
|
|
590
617
|
constructor() {
|
|
@@ -696,6 +723,297 @@ const scrollToElement = (options) => {
|
|
|
696
723
|
});
|
|
697
724
|
};
|
|
698
725
|
|
|
726
|
+
const isObject = (value) => {
|
|
727
|
+
return typeof value === 'object' && value !== null;
|
|
728
|
+
};
|
|
729
|
+
const getObjectProperty = (obj, prop) => {
|
|
730
|
+
const hasDotNotation = prop.includes('.');
|
|
731
|
+
if (!hasDotNotation)
|
|
732
|
+
return obj[prop];
|
|
733
|
+
const props = prop.split('.');
|
|
734
|
+
let value = obj;
|
|
735
|
+
for (const prop of props) {
|
|
736
|
+
if (!isObject(value))
|
|
737
|
+
return undefined;
|
|
738
|
+
value = value[prop];
|
|
739
|
+
}
|
|
740
|
+
return value;
|
|
741
|
+
};
|
|
742
|
+
class SelectionModel {
|
|
743
|
+
constructor() {
|
|
744
|
+
this._selection$ = new BehaviorSubject([]);
|
|
745
|
+
this._options$ = new BehaviorSubject([]);
|
|
746
|
+
this._valueBinding$ = new BehaviorSubject(null);
|
|
747
|
+
this._keyBinding$ = new BehaviorSubject(null);
|
|
748
|
+
this._labelBinding$ = new BehaviorSubject(null);
|
|
749
|
+
this._allowMultiple$ = new BehaviorSubject(false);
|
|
750
|
+
this._filter$ = new BehaviorSubject('');
|
|
751
|
+
this.value$ = combineLatest([this.selection$, this.valueBinding$, this.allowMultiple$]).pipe(map(([selection, valueBinding, allowMultiple]) => {
|
|
752
|
+
if (allowMultiple) {
|
|
753
|
+
return selection.map((option) => this.getOptionProperty(option, valueBinding));
|
|
754
|
+
}
|
|
755
|
+
const [option] = selection;
|
|
756
|
+
if (!option)
|
|
757
|
+
return null;
|
|
758
|
+
return this.getOptionProperty(option, valueBinding);
|
|
759
|
+
}));
|
|
760
|
+
this.filteredOptions$ = combineLatest([this.options$, this.filter$, this.labelBinding$]).pipe(map(([options, filter]) => this.getFilteredOptions(filter, options)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
761
|
+
this._optionsAndSelection$ = combineLatest([this._options$, this._selection$]);
|
|
762
|
+
}
|
|
763
|
+
get selection$() {
|
|
764
|
+
return this._selection$.asObservable();
|
|
765
|
+
}
|
|
766
|
+
get selection() {
|
|
767
|
+
return this._selection$.value;
|
|
768
|
+
}
|
|
769
|
+
get options$() {
|
|
770
|
+
return this._options$.asObservable();
|
|
771
|
+
}
|
|
772
|
+
get options() {
|
|
773
|
+
return this._options$.value;
|
|
774
|
+
}
|
|
775
|
+
get valueBinding$() {
|
|
776
|
+
return this._valueBinding$.asObservable();
|
|
777
|
+
}
|
|
778
|
+
get valueBinding() {
|
|
779
|
+
return this._valueBinding$.value;
|
|
780
|
+
}
|
|
781
|
+
get keyBinding$() {
|
|
782
|
+
return combineLatest([this._keyBinding$, this.valueBinding$]).pipe(map(([keyBinding, valueBinding]) => keyBinding || valueBinding));
|
|
783
|
+
}
|
|
784
|
+
get keyBinding() {
|
|
785
|
+
return this._keyBinding$.value || this.valueBinding;
|
|
786
|
+
}
|
|
787
|
+
get labelBinding$() {
|
|
788
|
+
return this._labelBinding$.asObservable();
|
|
789
|
+
}
|
|
790
|
+
get labelBinding() {
|
|
791
|
+
return this._labelBinding$.value;
|
|
792
|
+
}
|
|
793
|
+
get allowMultiple$() {
|
|
794
|
+
return this._allowMultiple$.asObservable();
|
|
795
|
+
}
|
|
796
|
+
get allowMultiple() {
|
|
797
|
+
return this._allowMultiple$.value;
|
|
798
|
+
}
|
|
799
|
+
get filter$() {
|
|
800
|
+
return this._filter$.asObservable();
|
|
801
|
+
}
|
|
802
|
+
get filter() {
|
|
803
|
+
return this._filter$.value;
|
|
804
|
+
}
|
|
805
|
+
setSelection(selection) {
|
|
806
|
+
if (!Array.isArray(selection)) {
|
|
807
|
+
selection = [selection];
|
|
808
|
+
}
|
|
809
|
+
this._selection$.next(selection);
|
|
810
|
+
return this;
|
|
811
|
+
}
|
|
812
|
+
setValueBinding(propertyPath) {
|
|
813
|
+
this._valueBinding$.next(propertyPath);
|
|
814
|
+
return this;
|
|
815
|
+
}
|
|
816
|
+
setKeyBinding(propertyPath) {
|
|
817
|
+
this._keyBinding$.next(propertyPath);
|
|
818
|
+
return this;
|
|
819
|
+
}
|
|
820
|
+
setLabelBinding(propertyPath) {
|
|
821
|
+
this._labelBinding$.next(propertyPath);
|
|
822
|
+
return this;
|
|
823
|
+
}
|
|
824
|
+
setOptions(options) {
|
|
825
|
+
this._options$.next(options);
|
|
826
|
+
return this;
|
|
827
|
+
}
|
|
828
|
+
setAllowMultiple(allowMultiple) {
|
|
829
|
+
this._allowMultiple$.next(allowMultiple);
|
|
830
|
+
return this;
|
|
831
|
+
}
|
|
832
|
+
setFilter(filter) {
|
|
833
|
+
const sanitizedFilter = filter?.trim() || '';
|
|
834
|
+
this._filter$.next(sanitizedFilter);
|
|
835
|
+
}
|
|
836
|
+
reset() {
|
|
837
|
+
this._selection$.next([]);
|
|
838
|
+
this._options$.next([]);
|
|
839
|
+
this._valueBinding$.next(null);
|
|
840
|
+
this._keyBinding$.next(null);
|
|
841
|
+
this._labelBinding$.next(null);
|
|
842
|
+
this._allowMultiple$.next(false);
|
|
843
|
+
}
|
|
844
|
+
getOptionByValue$(value) {
|
|
845
|
+
return this._optionsAndSelection$.pipe(map(() => this.getOptionByValue(value)));
|
|
846
|
+
}
|
|
847
|
+
getOptionByLabel$(label) {
|
|
848
|
+
return this._optionsAndSelection$.pipe(map(() => this.getOptionByLabel(label)));
|
|
849
|
+
}
|
|
850
|
+
getOptionByKey$(key) {
|
|
851
|
+
return this._optionsAndSelection$.pipe(map(() => this.getOptionByKey(key)));
|
|
852
|
+
}
|
|
853
|
+
isSelected$(option) {
|
|
854
|
+
return this._selection$.pipe(map(() => this.isSelected(option)));
|
|
855
|
+
}
|
|
856
|
+
getLabel$(option) {
|
|
857
|
+
return this.labelBinding$.pipe(map((labelBinding) => this.getOptionProperty(option, labelBinding)));
|
|
858
|
+
}
|
|
859
|
+
getValue$(option) {
|
|
860
|
+
return this.valueBinding$.pipe(map((valueBinding) => this.getOptionProperty(option, valueBinding)));
|
|
861
|
+
}
|
|
862
|
+
getKey$(option) {
|
|
863
|
+
return this.keyBinding$.pipe(map((keyBinding) => this.getOptionProperty(option, keyBinding)));
|
|
864
|
+
}
|
|
865
|
+
getOptionByValue(value) {
|
|
866
|
+
return this.getOption(value, this.valueBinding);
|
|
867
|
+
}
|
|
868
|
+
getOptionByLabel(label) {
|
|
869
|
+
return this.getOption(label, this.labelBinding);
|
|
870
|
+
}
|
|
871
|
+
getOptionByKey(key) {
|
|
872
|
+
return this.getOption(key, this.keyBinding);
|
|
873
|
+
}
|
|
874
|
+
getOption(value, propertyPath = null, options = [...this.options, ...this.selection]) {
|
|
875
|
+
if (!propertyPath) {
|
|
876
|
+
return options.find((option) => option === value);
|
|
877
|
+
}
|
|
878
|
+
return options.find((option) => {
|
|
879
|
+
if (!isObject(option))
|
|
880
|
+
return false;
|
|
881
|
+
return getObjectProperty(option, propertyPath) === value;
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
getOptionByIndex(index, options = this.getFilteredOptions()) {
|
|
885
|
+
return options[index] || null;
|
|
886
|
+
}
|
|
887
|
+
getOptionByOffset(offset, index, options = this.getFilteredOptions(), config = { clamp: true }) {
|
|
888
|
+
const { loop, clamp } = config;
|
|
889
|
+
const newIndex = index + offset;
|
|
890
|
+
const remainingOffset = newIndex * -1;
|
|
891
|
+
if (newIndex < 0) {
|
|
892
|
+
if (loop) {
|
|
893
|
+
return this.getOptionByOffset(remainingOffset, options.length - 1, options, config);
|
|
894
|
+
}
|
|
895
|
+
if (clamp) {
|
|
896
|
+
return this.getFirstOption();
|
|
897
|
+
}
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
if (newIndex >= options.length) {
|
|
901
|
+
if (loop) {
|
|
902
|
+
return this.getOptionByOffset(remainingOffset, 0, options, config);
|
|
903
|
+
}
|
|
904
|
+
if (clamp) {
|
|
905
|
+
return this.getLastOption();
|
|
906
|
+
}
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
return this.getOptionByIndex(newIndex);
|
|
910
|
+
}
|
|
911
|
+
getFirstOption(options = this.options) {
|
|
912
|
+
return this.getOptionByIndex(0, options);
|
|
913
|
+
}
|
|
914
|
+
getLastOption(options = this.options) {
|
|
915
|
+
return this.getOptionByIndex(options.length - 1, options);
|
|
916
|
+
}
|
|
917
|
+
getOptionIndex(option, options = this.options) {
|
|
918
|
+
const key = this.getKey(option);
|
|
919
|
+
const index = options.findIndex((o) => this.getKey(o) === key);
|
|
920
|
+
return index === -1 ? null : index;
|
|
921
|
+
}
|
|
922
|
+
getNonMultipleSelectedOption() {
|
|
923
|
+
if (this.allowMultiple)
|
|
924
|
+
return null;
|
|
925
|
+
return this.selection[0] || null;
|
|
926
|
+
}
|
|
927
|
+
getNonMultipleSelectedOptionIndex() {
|
|
928
|
+
if (this.allowMultiple)
|
|
929
|
+
return null;
|
|
930
|
+
const opt = this.getNonMultipleSelectedOption();
|
|
931
|
+
if (!opt)
|
|
932
|
+
return null;
|
|
933
|
+
return this.getOptionIndex(opt);
|
|
934
|
+
}
|
|
935
|
+
getNonMultipleOptionByOffsetFromSelected(offset, config = { clamp: true }) {
|
|
936
|
+
if (this.allowMultiple)
|
|
937
|
+
return null;
|
|
938
|
+
const index = this.getNonMultipleSelectedOptionIndex();
|
|
939
|
+
if (index === null)
|
|
940
|
+
return null;
|
|
941
|
+
return this.getOptionByOffset(index, offset, this.getFilteredOptions(), config);
|
|
942
|
+
}
|
|
943
|
+
getLabel(option) {
|
|
944
|
+
return this.getOptionProperty(option, this.labelBinding);
|
|
945
|
+
}
|
|
946
|
+
getValue(option) {
|
|
947
|
+
return this.getOptionProperty(option, this.valueBinding);
|
|
948
|
+
}
|
|
949
|
+
getKey(option) {
|
|
950
|
+
return this.getOptionProperty(option, this.keyBinding);
|
|
951
|
+
}
|
|
952
|
+
getOptionProperty(option, propertyPath) {
|
|
953
|
+
if (!propertyPath || !isObject(option))
|
|
954
|
+
return option;
|
|
955
|
+
return getObjectProperty(option, propertyPath);
|
|
956
|
+
}
|
|
957
|
+
isSelected(option) {
|
|
958
|
+
const optionKey = this.getOptionProperty(option, this.keyBinding);
|
|
959
|
+
return this.getOption(optionKey, this.keyBinding, this.selection) !== undefined;
|
|
960
|
+
}
|
|
961
|
+
getFilteredOptions(filter = this.filter, options = this.options) {
|
|
962
|
+
if (!filter)
|
|
963
|
+
return options;
|
|
964
|
+
const splitFilter = filter.split(' ').filter((f) => f);
|
|
965
|
+
return options.filter((option) => {
|
|
966
|
+
const label = this.getLabel(option);
|
|
967
|
+
if (!label || typeof label !== 'string')
|
|
968
|
+
return false;
|
|
969
|
+
const splitLabel = label.split(' ').filter((l) => l);
|
|
970
|
+
return splitFilter.every((f) => splitLabel.some((l) => l.toLowerCase().includes(f.toLowerCase())));
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
addSelectedOption(option) {
|
|
974
|
+
if (this.allowMultiple) {
|
|
975
|
+
if (this.isSelected(option))
|
|
976
|
+
return;
|
|
977
|
+
this._selection$.next([...this.selection, option]);
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
this._selection$.next([option]);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
removeSelectedOption(option) {
|
|
984
|
+
const optionKey = this.getOptionProperty(option, this.keyBinding);
|
|
985
|
+
if (!this.isSelected(option))
|
|
986
|
+
return;
|
|
987
|
+
this._selection$.next(this.selection.filter((selectedOption) => {
|
|
988
|
+
const key = this.getOptionProperty(selectedOption, this.keyBinding);
|
|
989
|
+
return key !== optionKey;
|
|
990
|
+
}));
|
|
991
|
+
}
|
|
992
|
+
clearSelectedOptions() {
|
|
993
|
+
this._selection$.next([]);
|
|
994
|
+
}
|
|
995
|
+
toggleSelectedOption(option) {
|
|
996
|
+
if (this.isSelected(option)) {
|
|
997
|
+
this.removeSelectedOption(option);
|
|
998
|
+
}
|
|
999
|
+
else {
|
|
1000
|
+
this.addSelectedOption(option);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
toggleAllSelectedOptions() {
|
|
1004
|
+
const filteredOptions = this.getFilteredOptions();
|
|
1005
|
+
const unselectedOptions = filteredOptions.filter((option) => !this.isSelected(option));
|
|
1006
|
+
if (unselectedOptions.length) {
|
|
1007
|
+
const selection = unselectedOptions.filter((o) => !this.selection.some((s) => this.getKey(s) === this.getKey(o)));
|
|
1008
|
+
this._selection$.next([...this.selection, ...selection]);
|
|
1009
|
+
}
|
|
1010
|
+
else {
|
|
1011
|
+
const selection = this.selection.filter((s) => !filteredOptions.some((o) => this.getKey(o) === this.getKey(s)));
|
|
1012
|
+
this._selection$.next(selection);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
|
|
699
1017
|
const scrollBehaviorSupported = supportsScrollBehavior();
|
|
700
1018
|
class SmartBlockScrollStrategy {
|
|
701
1019
|
constructor(_viewportRuler, _routerState, document) {
|
|
@@ -785,7 +1103,7 @@ class AnimatableDirective {
|
|
|
785
1103
|
}
|
|
786
1104
|
set animatedElement(value) {
|
|
787
1105
|
let newElement = null;
|
|
788
|
-
if (value === null || value === undefined) {
|
|
1106
|
+
if (value === null || value === undefined || value === '') {
|
|
789
1107
|
newElement = this._elementRef.nativeElement;
|
|
790
1108
|
}
|
|
791
1109
|
else if (typeof value === 'string') {
|
|
@@ -1243,6 +1561,9 @@ class RouterStateService {
|
|
|
1243
1561
|
get route$() {
|
|
1244
1562
|
return this._route$.asObservable().pipe(distinctUntilChanged());
|
|
1245
1563
|
}
|
|
1564
|
+
get route() {
|
|
1565
|
+
return this._route$.getValue();
|
|
1566
|
+
}
|
|
1246
1567
|
get state$() {
|
|
1247
1568
|
return this._state$.asObservable();
|
|
1248
1569
|
}
|
|
@@ -1432,17 +1753,34 @@ class ViewportService {
|
|
|
1432
1753
|
get is2Xl() {
|
|
1433
1754
|
return this._is2Xl$.value;
|
|
1434
1755
|
}
|
|
1756
|
+
get viewportSize$() {
|
|
1757
|
+
return this._viewportSize$.asObservable();
|
|
1758
|
+
}
|
|
1759
|
+
get viewportSize() {
|
|
1760
|
+
return this._viewportSize$.value;
|
|
1761
|
+
}
|
|
1762
|
+
get scrollbarSize$() {
|
|
1763
|
+
return this._scrollbarSize$.asObservable();
|
|
1764
|
+
}
|
|
1765
|
+
get scrollbarSize() {
|
|
1766
|
+
return this._scrollbarSize$.value;
|
|
1767
|
+
}
|
|
1435
1768
|
get currentViewport() {
|
|
1436
1769
|
return this.getCurrentViewport([this.isXs, this.isSm, this.isMd, this.isLg, this.isXl, this.is2Xl]);
|
|
1437
1770
|
}
|
|
1438
1771
|
constructor(_viewportConfig, _breakpointObserver) {
|
|
1439
1772
|
this._breakpointObserver = _breakpointObserver;
|
|
1773
|
+
this._resizeObserverService = inject(ResizeObserverService);
|
|
1774
|
+
this._viewportMonitorStop$ = new Subject();
|
|
1775
|
+
this._isViewportMonitorEnabled = false;
|
|
1440
1776
|
this._isXs$ = new BehaviorSubject(false);
|
|
1441
1777
|
this._isSm$ = new BehaviorSubject(false);
|
|
1442
1778
|
this._isMd$ = new BehaviorSubject(false);
|
|
1443
1779
|
this._isLg$ = new BehaviorSubject(false);
|
|
1444
1780
|
this._isXl$ = new BehaviorSubject(false);
|
|
1445
1781
|
this._is2Xl$ = new BehaviorSubject(false);
|
|
1782
|
+
this._viewportSize$ = new BehaviorSubject(null);
|
|
1783
|
+
this._scrollbarSize$ = new BehaviorSubject(null);
|
|
1446
1784
|
this.currentViewport$ = combineLatest([this.isXs$, this.isSm$, this.isMd$, this.isLg$, this.isXl$, this.is2Xl$]).pipe(map((val) => this.getCurrentViewport(val)), shareReplay(1));
|
|
1447
1785
|
this._viewportConfig = _viewportConfig || DEFAULT_VIEWPORT_CONFIG;
|
|
1448
1786
|
this._observeDefaultBreakpoints();
|
|
@@ -1455,6 +1793,57 @@ class ViewportService {
|
|
|
1455
1793
|
const mediaQuery = this._buildMediaQuery(options);
|
|
1456
1794
|
return this._breakpointObserver.isMatched(mediaQuery);
|
|
1457
1795
|
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Applies size CSS variables to the documentElement in pixels.
|
|
1798
|
+
* - `--et-vw`: viewport width excluding scrollbar width
|
|
1799
|
+
* - `--et-vh`: viewport height excluding scrollbar height
|
|
1800
|
+
* - `--et-sw`: scrollbar width
|
|
1801
|
+
* - `--et-sh`: scrollbar height
|
|
1802
|
+
*/
|
|
1803
|
+
monitorViewport() {
|
|
1804
|
+
if (this._isViewportMonitorEnabled)
|
|
1805
|
+
return;
|
|
1806
|
+
this._isViewportMonitorEnabled = true;
|
|
1807
|
+
this._resizeObserverService
|
|
1808
|
+
.observe(document.documentElement)
|
|
1809
|
+
.pipe(tap((e) => {
|
|
1810
|
+
const width = e[0].contentRect.width;
|
|
1811
|
+
const height = e[0].contentRect.height;
|
|
1812
|
+
document.documentElement.style.setProperty('--et-vw', `${width}px`);
|
|
1813
|
+
document.documentElement.style.setProperty('--et-vh', `${height}px`);
|
|
1814
|
+
this._viewportSize$.next({ width, height });
|
|
1815
|
+
}), finalize(() => {
|
|
1816
|
+
document.documentElement.style.removeProperty('--et-vw');
|
|
1817
|
+
document.documentElement.style.removeProperty('--et-vh');
|
|
1818
|
+
this._viewportSize$.next(null);
|
|
1819
|
+
}), takeUntil(this._viewportMonitorStop$))
|
|
1820
|
+
.subscribe();
|
|
1821
|
+
const scrollbarRuler = document.createElement('div');
|
|
1822
|
+
scrollbarRuler.style.width = '100px';
|
|
1823
|
+
scrollbarRuler.style.height = '100px';
|
|
1824
|
+
scrollbarRuler.style.overflow = 'scroll';
|
|
1825
|
+
scrollbarRuler.style.position = 'absolute';
|
|
1826
|
+
scrollbarRuler.style.top = '-9999px';
|
|
1827
|
+
document.body.appendChild(scrollbarRuler);
|
|
1828
|
+
this._resizeObserverService
|
|
1829
|
+
.observe(scrollbarRuler)
|
|
1830
|
+
.pipe(tap((e) => {
|
|
1831
|
+
const size = e[0].contentRect.width;
|
|
1832
|
+
document.documentElement.style.setProperty('--et-sw', `${100 - size}px`);
|
|
1833
|
+
document.documentElement.style.setProperty('--et-sh', `${100 - size}px`);
|
|
1834
|
+
this._scrollbarSize$.next({ width: 100 - size, height: 100 - size });
|
|
1835
|
+
}), finalize(() => {
|
|
1836
|
+
document.body.removeChild(scrollbarRuler);
|
|
1837
|
+
document.documentElement.style.removeProperty('--et-vw');
|
|
1838
|
+
document.documentElement.style.removeProperty('--et-vh');
|
|
1839
|
+
this._scrollbarSize$.next(null);
|
|
1840
|
+
}), takeUntil(this._viewportMonitorStop$))
|
|
1841
|
+
.subscribe();
|
|
1842
|
+
}
|
|
1843
|
+
unmonitorViewport() {
|
|
1844
|
+
this._viewportMonitorStop$.next();
|
|
1845
|
+
this._isViewportMonitorEnabled = false;
|
|
1846
|
+
}
|
|
1458
1847
|
_observeDefaultBreakpoints() {
|
|
1459
1848
|
this.observe({ max: 'xs' }).subscribe(this._isXs$);
|
|
1460
1849
|
this.observe({ min: 'sm', max: 'sm' }).subscribe(this._isSm$);
|
|
@@ -3040,5 +3429,5 @@ const Validators = {
|
|
|
3040
3429
|
* Generated bundle index. Do not edit.
|
|
3041
3430
|
*/
|
|
3042
3431
|
|
|
3043
|
-
export { ANIMATABLE_TOKEN, ANIMATED_LIFECYCLE_TOKEN, AnimatableDirective, AnimatedLifecycleDirective, AnimatedOverlayDirective, BehaviorSubjectWithSubscriberCount, ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DELAYABLE_TOKEN, DelayableDirective, ET_PROPERTY_REMOVED, FocusVisibleService, IS_ACTIVE_ELEMENT, IS_ARRAY_NOT_EMPTY, IS_EMAIL, IsActiveElementDirective, 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, SmartBlockScrollStrategy, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, Validators, ViewportService, clamp, clone, createDestroy, createFlipAnimation, createFlipAnimationGroup, createMediaQueryObservable, createReactiveBindings, deleteCookie, elementCanScroll, equal, forceReflow, fromNextFrame, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isElementVisible, isGroupMatch, isKnockoutMatch, mergeSeoConfig, nextFrame, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, scrollToElement, setCookie, toArray, toArrayTrackByFn };
|
|
3432
|
+
export { ANIMATABLE_TOKEN, ANIMATED_LIFECYCLE_TOKEN, AnimatableDirective, AnimatedLifecycleDirective, AnimatedOverlayDirective, BehaviorSubjectWithSubscriberCount, ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DELAYABLE_TOKEN, DelayableDirective, ET_PROPERTY_REMOVED, FocusVisibleService, IS_ACTIVE_ELEMENT, IS_ARRAY_NOT_EMPTY, IS_EMAIL, IsActiveElementDirective, IsArrayNotEmpty, IsEmail, LetContext, LetDirective, MUST_MATCH, Memo, MustMatch, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, RouterStateService, RuntimeError, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SelectionModel, SeoDirective, SmartBlockScrollStrategy, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, Validators, ViewportService, clamp, clone, createDestroy, createFlipAnimation, createFlipAnimationGroup, createMediaQueryObservable, createReactiveBindings, deleteCookie, elementCanScroll, equal, forceReflow, formatRuntimeError, fromNextFrame, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isElementVisible, isGroupMatch, isKnockoutMatch, mergeSeoConfig, nextFrame, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, scrollToElement, setCookie, toArray, toArrayTrackByFn };
|
|
3044
3433
|
//# sourceMappingURL=ethlete-core.mjs.map
|