@ethlete/core 0.2.0-next.0 → 0.2.0-next.10
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/decorators/index.mjs +2 -0
- package/esm2020/lib/decorators/memo/memo.decorator.mjs +2 -2
- package/esm2020/lib/directives/click-outside/click-outside.directive.mjs +37 -0
- package/esm2020/lib/directives/click-outside/public-api.mjs +2 -0
- package/esm2020/lib/directives/cursor-drag-scroll/cursor-drag-scroll.constants.mjs +3 -0
- package/esm2020/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.mjs +147 -0
- package/esm2020/lib/directives/cursor-drag-scroll/public-api.mjs +2 -0
- package/esm2020/lib/directives/let/let.directive.mjs +8 -8
- package/esm2020/lib/directives/observe-content/observe-content.directive.mjs +68 -0
- package/esm2020/lib/directives/observe-content/public-api.mjs +2 -0
- package/esm2020/lib/directives/observe-resize/observe-resize.directive.mjs +68 -0
- package/esm2020/lib/directives/observe-resize/public-api.mjs +2 -0
- package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.constants.mjs +3 -0
- package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.directive.mjs +171 -0
- package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.types.mjs +2 -0
- package/esm2020/lib/directives/observe-scroll-state/public-api.mjs +3 -0
- package/esm2020/lib/directives/public-api.mjs +10 -1
- package/esm2020/lib/directives/repeat/repeat.directive.mjs +10 -11
- package/esm2020/lib/directives/scroll-observer-first-element/index.mjs +2 -0
- package/esm2020/lib/directives/scroll-observer-first-element/public-api.mjs +2 -0
- package/esm2020/lib/directives/scroll-observer-first-element/scroll-observer-first-element.directive.mjs +31 -0
- package/esm2020/lib/directives/scroll-observer-ignore-target/index.mjs +2 -0
- package/esm2020/lib/directives/scroll-observer-ignore-target/public-api.mjs +2 -0
- package/esm2020/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.mjs +18 -0
- package/esm2020/lib/directives/scroll-observer-last-element/index.mjs +2 -0
- package/esm2020/lib/directives/scroll-observer-last-element/public-api.mjs +2 -0
- package/esm2020/lib/directives/scroll-observer-last-element/scroll-observer-last-element.directive.mjs +34 -0
- package/esm2020/lib/directives/seo/public-api.mjs +5 -0
- package/esm2020/lib/directives/seo/seo.directive.constants.mjs +3 -0
- package/esm2020/lib/directives/seo/seo.directive.mjs +166 -0
- package/esm2020/lib/directives/seo/seo.directive.types.mjs +2 -0
- package/esm2020/lib/directives/seo/seo.directive.utils.mjs +7 -0
- package/esm2020/lib/pipes/normalize-game-result-type/normalize-game-result-type.pipe.mjs +15 -0
- package/esm2020/lib/pipes/normalize-game-result-type/normalize-game-result-type.types.mjs +2 -0
- package/esm2020/lib/pipes/normalize-game-result-type/normalize-game-result-type.util.mjs +34 -0
- package/esm2020/lib/pipes/normalize-game-result-type/public-api.mjs +4 -0
- package/esm2020/lib/pipes/normalize-match-participants/normalize-match-participants.pipe.mjs +15 -0
- package/esm2020/lib/pipes/normalize-match-participants/normalize-match-participants.types.mjs +2 -0
- package/esm2020/lib/pipes/normalize-match-participants/normalize-match-participants.util.mjs +47 -0
- package/esm2020/lib/pipes/normalize-match-participants/public-api.mjs +4 -0
- package/esm2020/lib/pipes/normalize-match-score/normalize-match-score.pipe.mjs +15 -0
- package/esm2020/lib/pipes/normalize-match-score/normalize-match-score.types.mjs +2 -0
- package/esm2020/lib/pipes/normalize-match-score/normalize-match-score.util.mjs +126 -0
- package/esm2020/lib/pipes/normalize-match-score/public-api.mjs +4 -0
- package/esm2020/lib/pipes/normalize-match-state/index.mjs +2 -0
- package/esm2020/lib/pipes/normalize-match-state/normalize-match-state.constants.mjs +2 -0
- package/esm2020/lib/pipes/normalize-match-state/normalize-match-state.pipe.mjs +15 -0
- package/esm2020/lib/pipes/normalize-match-state/normalize-match-state.util.mjs +19 -0
- package/esm2020/lib/pipes/normalize-match-state/public-api.mjs +4 -0
- package/esm2020/lib/pipes/normalize-match-type/normalize-match-type.pipe.mjs +15 -0
- package/esm2020/lib/pipes/normalize-match-type/normalize-match-type.util.mjs +38 -0
- package/esm2020/lib/pipes/normalize-match-type/public-api.mjs +3 -0
- package/esm2020/lib/pipes/public-api.mjs +6 -1
- package/esm2020/lib/pipes/to-array/to-array.pipe.mjs +3 -3
- package/esm2020/lib/services/click-observer.service.mjs +73 -0
- package/esm2020/lib/services/content-observer.service.mjs +79 -0
- package/esm2020/lib/services/destroy.service.mjs +19 -0
- package/esm2020/lib/services/focus-visible.service.mjs +7 -7
- package/esm2020/lib/services/index.mjs +2 -0
- package/esm2020/lib/services/public-api.mjs +6 -2
- package/esm2020/lib/services/resize-observer.service.mjs +75 -0
- package/esm2020/lib/services/viewport.service.mjs +43 -18
- package/esm2020/lib/types/angular.types.mjs +2 -0
- package/esm2020/lib/types/i18n.types.mjs +2 -0
- package/esm2020/lib/types/public-api.mjs +3 -1
- package/esm2020/lib/utils/index.mjs +2 -0
- package/esm2020/lib/utils/public-api.mjs +2 -1
- package/esm2020/lib/utils/scrollable.utils.mjs +5 -0
- package/fesm2015/ethlete-core.mjs +1413 -116
- package/fesm2015/ethlete-core.mjs.map +1 -1
- package/fesm2020/ethlete-core.mjs +1410 -116
- package/fesm2020/ethlete-core.mjs.map +1 -1
- package/lib/decorators/index.d.ts +1 -0
- package/lib/directives/click-outside/click-outside.directive.d.ts +12 -0
- package/lib/directives/click-outside/public-api.d.ts +1 -0
- package/lib/directives/cursor-drag-scroll/cursor-drag-scroll.constants.d.ts +2 -0
- package/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.d.ts +27 -0
- package/lib/directives/cursor-drag-scroll/public-api.d.ts +1 -0
- package/lib/directives/let/let.directive.d.ts +1 -1
- package/lib/directives/observe-content/observe-content.directive.d.ts +22 -0
- package/lib/directives/observe-content/public-api.d.ts +1 -0
- package/lib/directives/observe-resize/observe-resize.directive.d.ts +22 -0
- package/lib/directives/observe-resize/public-api.d.ts +1 -0
- package/lib/directives/observe-scroll-state/observe-scroll-state.constants.d.ts +3 -0
- package/lib/directives/observe-scroll-state/observe-scroll-state.directive.d.ts +31 -0
- package/lib/directives/observe-scroll-state/observe-scroll-state.types.d.ts +6 -0
- package/lib/directives/observe-scroll-state/public-api.d.ts +3 -0
- package/lib/directives/public-api.d.ts +9 -0
- package/lib/directives/repeat/repeat.directive.d.ts +3 -4
- package/lib/directives/scroll-observer-first-element/index.d.ts +1 -0
- package/lib/directives/scroll-observer-first-element/public-api.d.ts +1 -0
- package/lib/directives/scroll-observer-first-element/scroll-observer-first-element.directive.d.ts +10 -0
- package/lib/directives/scroll-observer-ignore-target/index.d.ts +1 -0
- package/lib/directives/scroll-observer-ignore-target/public-api.d.ts +1 -0
- package/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.d.ts +6 -0
- package/lib/directives/scroll-observer-last-element/index.d.ts +1 -0
- package/lib/directives/scroll-observer-last-element/public-api.d.ts +1 -0
- package/lib/directives/scroll-observer-last-element/scroll-observer-last-element.directive.d.ts +10 -0
- package/lib/directives/seo/public-api.d.ts +4 -0
- package/lib/directives/seo/seo.directive.constants.d.ts +3 -0
- package/lib/directives/seo/seo.directive.d.ts +21 -0
- package/lib/directives/seo/seo.directive.types.d.ts +51 -0
- package/lib/directives/seo/seo.directive.utils.d.ts +2 -0
- package/lib/pipes/normalize-game-result-type/normalize-game-result-type.pipe.d.ts +7 -0
- package/lib/pipes/normalize-game-result-type/normalize-game-result-type.types.d.ts +4 -0
- package/lib/pipes/normalize-game-result-type/normalize-game-result-type.util.d.ts +2 -0
- package/lib/pipes/normalize-game-result-type/public-api.d.ts +3 -0
- package/lib/pipes/normalize-match-participants/normalize-match-participants.pipe.d.ts +7 -0
- package/lib/pipes/normalize-match-participants/normalize-match-participants.types.d.ts +21 -0
- package/lib/pipes/normalize-match-participants/normalize-match-participants.util.d.ts +4 -0
- package/lib/pipes/normalize-match-participants/public-api.d.ts +3 -0
- package/lib/pipes/normalize-match-score/normalize-match-score.pipe.d.ts +7 -0
- package/lib/pipes/normalize-match-score/normalize-match-score.types.d.ts +12 -0
- package/lib/pipes/normalize-match-score/normalize-match-score.util.d.ts +27 -0
- package/lib/pipes/normalize-match-score/public-api.d.ts +3 -0
- package/lib/pipes/normalize-match-state/index.d.ts +1 -0
- package/lib/pipes/normalize-match-state/normalize-match-state.constants.d.ts +7 -0
- package/lib/pipes/normalize-match-state/normalize-match-state.pipe.d.ts +7 -0
- package/lib/pipes/normalize-match-state/normalize-match-state.util.d.ts +3 -0
- package/lib/pipes/normalize-match-state/public-api.d.ts +3 -0
- package/lib/pipes/normalize-match-type/normalize-match-type.pipe.d.ts +7 -0
- package/lib/pipes/normalize-match-type/normalize-match-type.util.d.ts +3 -0
- package/lib/pipes/normalize-match-type/public-api.d.ts +2 -0
- package/lib/pipes/public-api.d.ts +5 -0
- package/lib/services/click-observer.service.d.ts +21 -0
- package/lib/services/content-observer.service.d.ts +21 -0
- package/lib/services/destroy.service.d.ts +9 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/public-api.d.ts +5 -1
- package/lib/services/resize-observer.service.d.ts +21 -0
- package/lib/services/viewport.service.d.ts +3 -0
- package/lib/services/viewport.types.d.ts +1 -1
- package/lib/types/angular.types.d.ts +3 -0
- package/lib/types/i18n.types.d.ts +4 -0
- package/lib/types/public-api.d.ts +2 -0
- package/lib/types/viewport.types.d.ts +2 -2
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/public-api.d.ts +1 -0
- package/lib/utils/scrollable.utils.d.ts +1 -0
- package/package.json +8 -6
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
3
|
-
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
2
|
+
import { InjectionToken, Injectable, inject, Inject, Optional, ElementRef, EventEmitter, Directive, Output, Input, NgZone, HostBinding, Pipe } from '@angular/core';
|
|
3
|
+
import { coerceElement, coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
4
|
+
import { fromEvent, Observable, Subject, BehaviorSubject, combineLatest, map, shareReplay, startWith, debounceTime, tap, takeUntil, take } from 'rxjs';
|
|
5
|
+
import { DOCUMENT } from '@angular/common';
|
|
4
6
|
import { __decorate, __metadata } from 'tslib';
|
|
5
|
-
import { BehaviorSubject, map, shareReplay } from 'rxjs';
|
|
6
7
|
import * as i1 from '@angular/cdk/layout';
|
|
7
|
-
import {
|
|
8
|
+
import { debounceTime as debounceTime$1 } from 'rxjs/operators';
|
|
9
|
+
import { Meta, Title } from '@angular/platform-browser';
|
|
8
10
|
|
|
9
11
|
const VIEWPORT_CONFIG = new InjectionToken('ViewportConfig');
|
|
10
12
|
/**
|
|
@@ -37,7 +39,7 @@ function memoize(func, resolver, cache) {
|
|
|
37
39
|
memoized.cache = cache;
|
|
38
40
|
return memoized;
|
|
39
41
|
}
|
|
40
|
-
const defaultResolver = (...args) => args
|
|
42
|
+
const defaultResolver = (...args) => args.join('-');
|
|
41
43
|
const Memo = (config = {}) => (_, __, descriptor) => {
|
|
42
44
|
var _a, _b;
|
|
43
45
|
if (typeof descriptor.value !== 'function') {
|
|
@@ -49,115 +51,269 @@ const Memo = (config = {}) => (_, __, descriptor) => {
|
|
|
49
51
|
return descriptor;
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
55
|
+
class ClickObserverFactory {
|
|
56
|
+
create() {
|
|
57
|
+
return fromEvent(document, 'click');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
ClickObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
61
|
+
ClickObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickObserverFactory, providedIn: 'root' });
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickObserverFactory, decorators: [{
|
|
63
|
+
type: Injectable,
|
|
64
|
+
args: [{ providedIn: 'root' }]
|
|
65
|
+
}] });
|
|
66
|
+
class ClickObserverService {
|
|
67
|
+
constructor(_clickObserverFactory) {
|
|
68
|
+
this._clickObserverFactory = _clickObserverFactory;
|
|
69
|
+
this._observedElements = new Map();
|
|
70
|
+
}
|
|
71
|
+
ngOnDestroy() {
|
|
72
|
+
this._observedElements.forEach((_, element) => this._cleanupObserver(element));
|
|
73
|
+
}
|
|
74
|
+
observe(elementOrRef) {
|
|
75
|
+
const element = coerceElement(elementOrRef);
|
|
76
|
+
return new Observable((observer) => {
|
|
77
|
+
const stream = this._observeElement(element);
|
|
78
|
+
const subscription = stream.subscribe(observer);
|
|
79
|
+
return () => {
|
|
80
|
+
subscription.unsubscribe();
|
|
81
|
+
this._unobserveElement(element);
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
_observeElement(element) {
|
|
86
|
+
if (!this._observedElements.has(element)) {
|
|
87
|
+
const stream = new Subject();
|
|
88
|
+
const observer = this._clickObserverFactory.create();
|
|
89
|
+
const sub = observer.subscribe((event) => stream.next(event));
|
|
90
|
+
this._observedElements.set(element, { observer: sub, stream, count: 1 });
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this._observedElements.get(element).count++;
|
|
94
|
+
}
|
|
95
|
+
return this._observedElements.get(element).stream;
|
|
96
|
+
}
|
|
97
|
+
_unobserveElement(element) {
|
|
98
|
+
if (this._observedElements.has(element)) {
|
|
99
|
+
this._observedElements.get(element).count--;
|
|
100
|
+
if (!this._observedElements.get(element).count) {
|
|
101
|
+
this._cleanupObserver(element);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
_cleanupObserver(element) {
|
|
106
|
+
if (this._observedElements.has(element)) {
|
|
107
|
+
const { observer, stream } = this._observedElements.get(element);
|
|
108
|
+
if (observer) {
|
|
109
|
+
observer.unsubscribe();
|
|
110
|
+
}
|
|
111
|
+
stream.complete();
|
|
112
|
+
this._observedElements.delete(element);
|
|
113
|
+
}
|
|
58
114
|
}
|
|
59
115
|
}
|
|
116
|
+
ClickObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickObserverService, deps: [{ token: ClickObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
117
|
+
ClickObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickObserverService, providedIn: 'root' });
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickObserverService, decorators: [{
|
|
119
|
+
type: Injectable,
|
|
120
|
+
args: [{ providedIn: 'root' }]
|
|
121
|
+
}], ctorParameters: function () { return [{ type: ClickObserverFactory }]; } });
|
|
60
122
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this._templateRef = null;
|
|
66
|
-
this._viewRef = null;
|
|
67
|
-
this._templateRef = templateRef;
|
|
123
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
124
|
+
class MutationObserverFactory {
|
|
125
|
+
create(callback) {
|
|
126
|
+
return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
|
|
68
127
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
128
|
+
}
|
|
129
|
+
MutationObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: MutationObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
130
|
+
MutationObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: MutationObserverFactory, providedIn: 'root' });
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: MutationObserverFactory, decorators: [{
|
|
132
|
+
type: Injectable,
|
|
133
|
+
args: [{ providedIn: 'root' }]
|
|
134
|
+
}] });
|
|
135
|
+
class ContentObserverService {
|
|
136
|
+
constructor(_mutationObserverFactory) {
|
|
137
|
+
this._mutationObserverFactory = _mutationObserverFactory;
|
|
138
|
+
this._observedElements = new Map();
|
|
72
139
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return true;
|
|
140
|
+
ngOnDestroy() {
|
|
141
|
+
this._observedElements.forEach((_, element) => this._cleanupObserver(element));
|
|
76
142
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
143
|
+
observe(elementOrRef) {
|
|
144
|
+
const element = coerceElement(elementOrRef);
|
|
145
|
+
return new Observable((observer) => {
|
|
146
|
+
const stream = this._observeElement(element);
|
|
147
|
+
const subscription = stream.subscribe(observer);
|
|
148
|
+
return () => {
|
|
149
|
+
subscription.unsubscribe();
|
|
150
|
+
this._unobserveElement(element);
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
_observeElement(element) {
|
|
155
|
+
if (!this._observedElements.has(element)) {
|
|
156
|
+
const stream = new Subject();
|
|
157
|
+
const observer = this._mutationObserverFactory.create((mutations) => stream.next(mutations));
|
|
158
|
+
if (observer) {
|
|
159
|
+
observer.observe(element, {
|
|
160
|
+
characterData: true,
|
|
161
|
+
childList: true,
|
|
162
|
+
subtree: true,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
this._observedElements.set(element, { observer, stream, count: 1 });
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
this._observedElements.get(element).count++;
|
|
169
|
+
}
|
|
170
|
+
return this._observedElements.get(element).stream;
|
|
171
|
+
}
|
|
172
|
+
_unobserveElement(element) {
|
|
173
|
+
if (this._observedElements.has(element)) {
|
|
174
|
+
this._observedElements.get(element).count--;
|
|
175
|
+
if (!this._observedElements.get(element).count) {
|
|
176
|
+
this._cleanupObserver(element);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
_cleanupObserver(element) {
|
|
181
|
+
if (this._observedElements.has(element)) {
|
|
182
|
+
const { observer, stream } = this._observedElements.get(element);
|
|
183
|
+
if (observer) {
|
|
184
|
+
observer.disconnect();
|
|
82
185
|
}
|
|
186
|
+
stream.complete();
|
|
187
|
+
this._observedElements.delete(element);
|
|
83
188
|
}
|
|
84
189
|
}
|
|
85
190
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
89
|
-
type:
|
|
90
|
-
args: [{
|
|
91
|
-
|
|
92
|
-
standalone: true,
|
|
93
|
-
}]
|
|
94
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { etLet: [{
|
|
95
|
-
type: Input
|
|
96
|
-
}] } });
|
|
191
|
+
ContentObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ContentObserverService, deps: [{ token: MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
192
|
+
ContentObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ContentObserverService, providedIn: 'root' });
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ContentObserverService, decorators: [{
|
|
194
|
+
type: Injectable,
|
|
195
|
+
args: [{ providedIn: 'root' }]
|
|
196
|
+
}], ctorParameters: function () { return [{ type: MutationObserverFactory }]; } });
|
|
97
197
|
|
|
98
|
-
class
|
|
99
|
-
constructor(
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this._repeatCount = 2;
|
|
198
|
+
class DestroyService {
|
|
199
|
+
constructor() {
|
|
200
|
+
this._destroy$ = new Subject();
|
|
201
|
+
this.destroy$ = this._destroy$.asObservable();
|
|
103
202
|
}
|
|
104
|
-
|
|
105
|
-
|
|
203
|
+
ngOnDestroy() {
|
|
204
|
+
this._destroy$.next(true);
|
|
205
|
+
this._destroy$.unsubscribe();
|
|
106
206
|
}
|
|
107
|
-
|
|
108
|
-
|
|
207
|
+
}
|
|
208
|
+
DestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: DestroyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
209
|
+
DestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: DestroyService });
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: DestroyService, decorators: [{
|
|
211
|
+
type: Injectable
|
|
212
|
+
}] });
|
|
213
|
+
|
|
214
|
+
class FocusVisibleService {
|
|
215
|
+
get isFocusVisible() {
|
|
216
|
+
return this._hadKeyboardEvent;
|
|
109
217
|
}
|
|
110
|
-
|
|
111
|
-
this.
|
|
218
|
+
constructor() {
|
|
219
|
+
this._document = inject(DOCUMENT);
|
|
220
|
+
this._hadKeyboardEvent = false;
|
|
221
|
+
this._document.addEventListener('keydown', this.onKeyDown.bind(this), true);
|
|
222
|
+
this._document.addEventListener('mousedown', this.onPointerDown.bind(this), true);
|
|
223
|
+
this._document.addEventListener('pointerdown', this.onPointerDown.bind(this), true);
|
|
224
|
+
this._document.addEventListener('touchstart', this.onPointerDown.bind(this), true);
|
|
112
225
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
226
|
+
onKeyDown(e) {
|
|
227
|
+
if (e.metaKey || e.altKey || e.ctrlKey) {
|
|
228
|
+
return;
|
|
116
229
|
}
|
|
230
|
+
this._hadKeyboardEvent = true;
|
|
231
|
+
}
|
|
232
|
+
onPointerDown() {
|
|
233
|
+
this._hadKeyboardEvent = false;
|
|
117
234
|
}
|
|
118
235
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
122
|
-
type:
|
|
236
|
+
FocusVisibleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusVisibleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
237
|
+
FocusVisibleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusVisibleService, providedIn: 'root' });
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusVisibleService, decorators: [{
|
|
239
|
+
type: Injectable,
|
|
123
240
|
args: [{
|
|
124
|
-
|
|
125
|
-
standalone: true,
|
|
241
|
+
providedIn: 'root',
|
|
126
242
|
}]
|
|
127
|
-
}], ctorParameters: function () { return [
|
|
128
|
-
type: Input,
|
|
129
|
-
args: ['etRepeat']
|
|
130
|
-
}] } });
|
|
131
|
-
|
|
132
|
-
const toArray = (value) => {
|
|
133
|
-
return Array.from({ length: value }, (_, i) => i);
|
|
134
|
-
};
|
|
135
|
-
const toArrayTrackByFn = (_, item) => item;
|
|
243
|
+
}], ctorParameters: function () { return []; } });
|
|
136
244
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
245
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
246
|
+
class ResizeObserverFactory {
|
|
247
|
+
create(callback) {
|
|
248
|
+
return typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(callback);
|
|
140
249
|
}
|
|
141
250
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
145
|
-
type:
|
|
146
|
-
args: [{
|
|
251
|
+
ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
252
|
+
ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ResizeObserverFactory, decorators: [{
|
|
254
|
+
type: Injectable,
|
|
255
|
+
args: [{ providedIn: 'root' }]
|
|
147
256
|
}] });
|
|
257
|
+
class ResizeObserverService {
|
|
258
|
+
constructor(_mutationObserverFactory) {
|
|
259
|
+
this._mutationObserverFactory = _mutationObserverFactory;
|
|
260
|
+
this._observedElements = new Map();
|
|
261
|
+
}
|
|
262
|
+
ngOnDestroy() {
|
|
263
|
+
this._observedElements.forEach((_, element) => this._cleanupObserver(element));
|
|
264
|
+
}
|
|
265
|
+
observe(elementOrRef) {
|
|
266
|
+
const element = coerceElement(elementOrRef);
|
|
267
|
+
return new Observable((observer) => {
|
|
268
|
+
const stream = this._observeElement(element);
|
|
269
|
+
const subscription = stream.subscribe(observer);
|
|
270
|
+
return () => {
|
|
271
|
+
subscription.unsubscribe();
|
|
272
|
+
this._unobserveElement(element);
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
_observeElement(element) {
|
|
277
|
+
if (!this._observedElements.has(element)) {
|
|
278
|
+
const stream = new Subject();
|
|
279
|
+
const observer = this._mutationObserverFactory.create((resizes) => stream.next(resizes));
|
|
280
|
+
if (observer) {
|
|
281
|
+
observer.observe(element);
|
|
282
|
+
}
|
|
283
|
+
this._observedElements.set(element, { observer, stream, count: 1 });
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
this._observedElements.get(element).count++;
|
|
287
|
+
}
|
|
288
|
+
return this._observedElements.get(element).stream;
|
|
289
|
+
}
|
|
290
|
+
_unobserveElement(element) {
|
|
291
|
+
if (this._observedElements.has(element)) {
|
|
292
|
+
this._observedElements.get(element).count--;
|
|
293
|
+
if (!this._observedElements.get(element).count) {
|
|
294
|
+
this._cleanupObserver(element);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
_cleanupObserver(element) {
|
|
299
|
+
if (this._observedElements.has(element)) {
|
|
300
|
+
const { observer, stream } = this._observedElements.get(element);
|
|
301
|
+
if (observer) {
|
|
302
|
+
observer.disconnect();
|
|
303
|
+
}
|
|
304
|
+
stream.complete();
|
|
305
|
+
this._observedElements.delete(element);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
310
|
+
ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
|
|
311
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ResizeObserverService, decorators: [{
|
|
312
|
+
type: Injectable,
|
|
313
|
+
args: [{ providedIn: 'root' }]
|
|
314
|
+
}], ctorParameters: function () { return [{ type: ResizeObserverFactory }]; } });
|
|
148
315
|
|
|
149
316
|
class ViewportService {
|
|
150
|
-
constructor(_viewportConfig, _breakpointObserver) {
|
|
151
|
-
this._breakpointObserver = _breakpointObserver;
|
|
152
|
-
this._isXs$ = new BehaviorSubject(false);
|
|
153
|
-
this._isSm$ = new BehaviorSubject(false);
|
|
154
|
-
this._isMd$ = new BehaviorSubject(false);
|
|
155
|
-
this._isLg$ = new BehaviorSubject(false);
|
|
156
|
-
this._isXl$ = new BehaviorSubject(false);
|
|
157
|
-
this._is2Xl$ = new BehaviorSubject(false);
|
|
158
|
-
this._viewportConfig = _viewportConfig || DEFAULT_VIEWPORT_CONFIG;
|
|
159
|
-
this._observeDefaultBreakpoints();
|
|
160
|
-
}
|
|
161
317
|
get isXs$() {
|
|
162
318
|
return this._isXs$.asObservable();
|
|
163
319
|
}
|
|
@@ -194,6 +350,21 @@ class ViewportService {
|
|
|
194
350
|
get is2Xl() {
|
|
195
351
|
return this._is2Xl$.value;
|
|
196
352
|
}
|
|
353
|
+
get currentViewport() {
|
|
354
|
+
return this.getCurrentViewport([this.isXs, this.isSm, this.isMd, this.isLg, this.isXl, this.is2Xl]);
|
|
355
|
+
}
|
|
356
|
+
constructor(_viewportConfig, _breakpointObserver) {
|
|
357
|
+
this._breakpointObserver = _breakpointObserver;
|
|
358
|
+
this._isXs$ = new BehaviorSubject(false);
|
|
359
|
+
this._isSm$ = new BehaviorSubject(false);
|
|
360
|
+
this._isMd$ = new BehaviorSubject(false);
|
|
361
|
+
this._isLg$ = new BehaviorSubject(false);
|
|
362
|
+
this._isXl$ = new BehaviorSubject(false);
|
|
363
|
+
this._is2Xl$ = new BehaviorSubject(false);
|
|
364
|
+
this.currentViewport$ = combineLatest([this.isXs$, this.isSm$, this.isMd$, this.isLg$, this.isXl$, this.is2Xl$]).pipe(map((val) => this.getCurrentViewport(val)), shareReplay());
|
|
365
|
+
this._viewportConfig = _viewportConfig || DEFAULT_VIEWPORT_CONFIG;
|
|
366
|
+
this._observeDefaultBreakpoints();
|
|
367
|
+
}
|
|
197
368
|
observe(options) {
|
|
198
369
|
const mediaQuery = this._buildMediaQuery(options);
|
|
199
370
|
return this._breakpointObserver.observe(mediaQuery).pipe(map((x) => x.matches), shareReplay());
|
|
@@ -222,7 +393,7 @@ class ViewportService {
|
|
|
222
393
|
// Due to scaling, the actual size of the viewport may be a decimal number.
|
|
223
394
|
// Eg. on Windows 11 with 150% scaling, the viewport size may be 1535.33px
|
|
224
395
|
// and thus not matching any of the default breakpoints.
|
|
225
|
-
return size + 0.
|
|
396
|
+
return size + 0.9;
|
|
226
397
|
}
|
|
227
398
|
_buildMediaQuery(options) {
|
|
228
399
|
if (!options.min && !options.max) {
|
|
@@ -250,9 +421,30 @@ class ViewportService {
|
|
|
250
421
|
}
|
|
251
422
|
return mediaQueryParts.join(' ');
|
|
252
423
|
}
|
|
424
|
+
getCurrentViewport([isXs, isSm, isMd, isLg, isXl, is2Xl]) {
|
|
425
|
+
if (isXs) {
|
|
426
|
+
return 'xs';
|
|
427
|
+
}
|
|
428
|
+
else if (isSm) {
|
|
429
|
+
return 'sm';
|
|
430
|
+
}
|
|
431
|
+
else if (isMd) {
|
|
432
|
+
return 'md';
|
|
433
|
+
}
|
|
434
|
+
else if (isLg) {
|
|
435
|
+
return 'lg';
|
|
436
|
+
}
|
|
437
|
+
else if (isXl) {
|
|
438
|
+
return 'xl';
|
|
439
|
+
}
|
|
440
|
+
else if (is2Xl) {
|
|
441
|
+
return '2xl';
|
|
442
|
+
}
|
|
443
|
+
return 'xs';
|
|
444
|
+
}
|
|
253
445
|
}
|
|
254
|
-
ViewportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
255
|
-
ViewportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
446
|
+
ViewportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ViewportService, deps: [{ token: VIEWPORT_CONFIG, optional: true }, { token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
447
|
+
ViewportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ViewportService, providedIn: 'root' });
|
|
256
448
|
__decorate([
|
|
257
449
|
Memo(),
|
|
258
450
|
__metadata("design:type", Function),
|
|
@@ -270,7 +462,7 @@ __decorate([
|
|
|
270
462
|
__metadata("design:paramtypes", [Object]),
|
|
271
463
|
__metadata("design:returntype", void 0)
|
|
272
464
|
], ViewportService.prototype, "_buildMediaQuery", null);
|
|
273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ViewportService, decorators: [{
|
|
274
466
|
type: Injectable,
|
|
275
467
|
args: [{
|
|
276
468
|
providedIn: 'root',
|
|
@@ -284,36 +476,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.3", ngImpor
|
|
|
284
476
|
}] }, { type: i1.BreakpointObserver }];
|
|
285
477
|
}, propDecorators: { _getViewportSize: [], _buildMediaQuery: [] } });
|
|
286
478
|
|
|
287
|
-
class
|
|
479
|
+
class ClickOutsideDirective {
|
|
288
480
|
constructor() {
|
|
289
|
-
this.
|
|
290
|
-
this.
|
|
291
|
-
this.
|
|
292
|
-
this.
|
|
293
|
-
this._document.addEventListener('pointerdown', this.onPointerDown.bind(this), true);
|
|
294
|
-
this._document.addEventListener('touchstart', this.onPointerDown.bind(this), true);
|
|
295
|
-
}
|
|
296
|
-
get isFocusVisible() {
|
|
297
|
-
return this._hadKeyboardEvent;
|
|
481
|
+
this._elementRef = inject(ElementRef);
|
|
482
|
+
this._clickObserverService = inject(ClickObserverService);
|
|
483
|
+
this._subscription = null;
|
|
484
|
+
this.etClickOutside = new EventEmitter();
|
|
298
485
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
486
|
+
ngOnInit() {
|
|
487
|
+
setTimeout(() => {
|
|
488
|
+
this._subscription = this._clickObserverService.observe(this._elementRef.nativeElement).subscribe((event) => {
|
|
489
|
+
const activeElement = event.target;
|
|
490
|
+
const isInside = this._elementRef.nativeElement.contains(activeElement);
|
|
491
|
+
if (!isInside) {
|
|
492
|
+
this.etClickOutside.emit(event);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
});
|
|
304
496
|
}
|
|
305
|
-
|
|
306
|
-
|
|
497
|
+
ngOnDestroy() {
|
|
498
|
+
var _a;
|
|
499
|
+
(_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
307
500
|
}
|
|
308
501
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
312
|
-
type:
|
|
502
|
+
ClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
503
|
+
ClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ClickOutsideDirective, isStandalone: true, selector: "[etClickOutside]", outputs: { etClickOutside: "etClickOutside" }, ngImport: i0 });
|
|
504
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ClickOutsideDirective, decorators: [{
|
|
505
|
+
type: Directive,
|
|
313
506
|
args: [{
|
|
314
|
-
|
|
507
|
+
selector: '[etClickOutside]',
|
|
508
|
+
standalone: true,
|
|
315
509
|
}]
|
|
316
|
-
}],
|
|
510
|
+
}], propDecorators: { etClickOutside: [{
|
|
511
|
+
type: Output
|
|
512
|
+
}] } });
|
|
317
513
|
|
|
318
514
|
const provideViewportConfig = (viewportConfig) => {
|
|
319
515
|
return { provide: VIEWPORT_CONFIG, useValue: viewportConfig };
|
|
@@ -323,9 +519,1110 @@ const clamp = (value, min = 0, max = 100) => {
|
|
|
323
519
|
return Math.max(min, Math.min(max, value));
|
|
324
520
|
};
|
|
325
521
|
|
|
522
|
+
const elementCanScroll = (element) => {
|
|
523
|
+
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = element;
|
|
524
|
+
return scrollHeight > clientHeight || scrollWidth > clientWidth;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const CURSOR_DRAG_SCROLLING_CLASS = 'et-cursor-drag-scroll--scrolling';
|
|
528
|
+
const CURSOR_DRAG_SCROLLING_PREPARED_CLASS = 'et-cursor-drag-scroll--prepared';
|
|
529
|
+
|
|
530
|
+
class CursorDragScrollDirective {
|
|
531
|
+
constructor() {
|
|
532
|
+
this._subscriptions = [];
|
|
533
|
+
this._destroy$ = inject(DestroyService).destroy$;
|
|
534
|
+
this._elementRef = inject(ElementRef);
|
|
535
|
+
this._contentObserverService = inject(ContentObserverService);
|
|
536
|
+
this._resizeObserverService = inject(ResizeObserverService);
|
|
537
|
+
this._bufferUntilScroll = 5;
|
|
538
|
+
this._mouseUp$ = new Subject();
|
|
539
|
+
this._isScrolling = false;
|
|
540
|
+
this._canScroll = false;
|
|
541
|
+
this._currentScrollState = {
|
|
542
|
+
top: 0,
|
|
543
|
+
left: 0,
|
|
544
|
+
x: 0,
|
|
545
|
+
y: 0,
|
|
546
|
+
};
|
|
547
|
+
this._enabled = false;
|
|
548
|
+
}
|
|
549
|
+
get enabled() {
|
|
550
|
+
return this._enabled;
|
|
551
|
+
}
|
|
552
|
+
set enabled(value) {
|
|
553
|
+
this._enabled = coerceBooleanProperty(value);
|
|
554
|
+
if (this._enabled) {
|
|
555
|
+
this._enableCursorDragScroll();
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
this._disableCursorDragScroll();
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
ngAfterViewInit() {
|
|
562
|
+
if (this.enabled) {
|
|
563
|
+
this._enableCursorDragScroll();
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
this._disableCursorDragScroll();
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
_enableCursorDragScroll() {
|
|
570
|
+
const contentResizeSub = combineLatest([
|
|
571
|
+
this._contentObserverService.observe(this._elementRef.nativeElement).pipe(startWith(null)),
|
|
572
|
+
this._resizeObserverService.observe(this._elementRef.nativeElement).pipe(startWith(null)),
|
|
573
|
+
])
|
|
574
|
+
.pipe(debounceTime(25), tap(() => this._updateCanScrollState()), takeUntil(this._destroy$))
|
|
575
|
+
.subscribe();
|
|
576
|
+
const mousedownSub = fromEvent(this._elementRef.nativeElement, 'mousedown')
|
|
577
|
+
.pipe(tap((e) => this._onMouseDown(e)), takeUntil(this._destroy$))
|
|
578
|
+
.subscribe();
|
|
579
|
+
this._subscriptions.push(contentResizeSub, mousedownSub);
|
|
580
|
+
this._updateCanScrollState();
|
|
581
|
+
}
|
|
582
|
+
_disableCursorDragScroll() {
|
|
583
|
+
this._subscriptions.forEach((sub) => sub.unsubscribe());
|
|
584
|
+
this._subscriptions.length = 0;
|
|
585
|
+
this._elementRef.nativeElement.style.cursor = 'default';
|
|
586
|
+
}
|
|
587
|
+
_onMouseDown(e) {
|
|
588
|
+
var _a;
|
|
589
|
+
if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) || !this._canScroll) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
const element = this._elementRef.nativeElement;
|
|
593
|
+
element.classList.add(CURSOR_DRAG_SCROLLING_PREPARED_CLASS);
|
|
594
|
+
this._elementRef.nativeElement.style.scrollSnapType = 'none';
|
|
595
|
+
this._elementRef.nativeElement.style.scrollBehavior = 'unset';
|
|
596
|
+
this._currentScrollState = {
|
|
597
|
+
left: this._elementRef.nativeElement.scrollLeft,
|
|
598
|
+
top: this._elementRef.nativeElement.scrollTop,
|
|
599
|
+
x: e.clientX,
|
|
600
|
+
y: e.clientY,
|
|
601
|
+
};
|
|
602
|
+
fromEvent(document, 'mousemove')
|
|
603
|
+
.pipe(tap((e) => this._mouseMoveHandler(e)), takeUntil(this._mouseUp$), takeUntil(this._destroy$))
|
|
604
|
+
.subscribe();
|
|
605
|
+
fromEvent(document, 'mouseup')
|
|
606
|
+
.pipe(tap(() => this._mouseUpHandler()), take(1), takeUntil(this._destroy$))
|
|
607
|
+
.subscribe();
|
|
608
|
+
}
|
|
609
|
+
_mouseMoveHandler(e) {
|
|
610
|
+
var _a;
|
|
611
|
+
e.preventDefault();
|
|
612
|
+
if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
const dx = e.clientX - this._currentScrollState.x;
|
|
616
|
+
const dy = e.clientY - this._currentScrollState.y;
|
|
617
|
+
if (Math.abs(dx) > this._bufferUntilScroll || Math.abs(dy) > this._bufferUntilScroll) {
|
|
618
|
+
const element = this._elementRef.nativeElement;
|
|
619
|
+
if (!this._isScrolling) {
|
|
620
|
+
this._isScrolling = true;
|
|
621
|
+
element.style.cursor = 'grabbing';
|
|
622
|
+
element.classList.add(CURSOR_DRAG_SCROLLING_CLASS);
|
|
623
|
+
element.scroll({
|
|
624
|
+
top: this._currentScrollState.top - dy,
|
|
625
|
+
left: this._currentScrollState.left - dx,
|
|
626
|
+
behavior: 'smooth',
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
element.scrollTop = this._currentScrollState.top - dy;
|
|
631
|
+
element.scrollLeft = this._currentScrollState.left - dx;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
_mouseUpHandler() {
|
|
636
|
+
var _a;
|
|
637
|
+
this._mouseUp$.next(true);
|
|
638
|
+
this._isScrolling = false;
|
|
639
|
+
if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
this._elementRef.nativeElement.style.scrollSnapType = '';
|
|
643
|
+
this._elementRef.nativeElement.style.scrollBehavior = '';
|
|
644
|
+
this._elementRef.nativeElement.style.cursor = 'grab';
|
|
645
|
+
this._elementRef.nativeElement.classList.remove(CURSOR_DRAG_SCROLLING_CLASS);
|
|
646
|
+
this._elementRef.nativeElement.classList.remove(CURSOR_DRAG_SCROLLING_PREPARED_CLASS);
|
|
647
|
+
}
|
|
648
|
+
_updateCanScrollState() {
|
|
649
|
+
this._canScroll = elementCanScroll(this._elementRef.nativeElement);
|
|
650
|
+
if (this._canScroll) {
|
|
651
|
+
this._elementRef.nativeElement.style.cursor = 'grab';
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
this._elementRef.nativeElement.style.cursor = 'default';
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
CursorDragScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CursorDragScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
659
|
+
CursorDragScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: CursorDragScrollDirective, isStandalone: true, selector: "[etCursorDragScroll]", inputs: { enabled: ["etCursorDragScroll", "enabled"] }, providers: [DestroyService], exportAs: ["etCursorDragScroll"], ngImport: i0 });
|
|
660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CursorDragScrollDirective, decorators: [{
|
|
661
|
+
type: Directive,
|
|
662
|
+
args: [{
|
|
663
|
+
selector: '[etCursorDragScroll]',
|
|
664
|
+
exportAs: 'etCursorDragScroll',
|
|
665
|
+
standalone: true,
|
|
666
|
+
providers: [DestroyService],
|
|
667
|
+
}]
|
|
668
|
+
}], propDecorators: { enabled: [{
|
|
669
|
+
type: Input,
|
|
670
|
+
args: ['etCursorDragScroll']
|
|
671
|
+
}] } });
|
|
672
|
+
|
|
673
|
+
class LetContext {
|
|
674
|
+
constructor() {
|
|
675
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
676
|
+
this.$implicit = null;
|
|
677
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
678
|
+
this.etLet = null;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
class LetDirective {
|
|
683
|
+
set etLet(value) {
|
|
684
|
+
this._context.$implicit = this._context.etLet = value;
|
|
685
|
+
this._updateView();
|
|
686
|
+
}
|
|
687
|
+
constructor(_viewContainer, templateRef) {
|
|
688
|
+
this._viewContainer = _viewContainer;
|
|
689
|
+
this._context = new LetContext();
|
|
690
|
+
this._templateRef = null;
|
|
691
|
+
this._viewRef = null;
|
|
692
|
+
this._templateRef = templateRef;
|
|
693
|
+
}
|
|
694
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
695
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
696
|
+
return true;
|
|
697
|
+
}
|
|
698
|
+
_updateView() {
|
|
699
|
+
if (!this._viewRef) {
|
|
700
|
+
this._viewContainer.clear();
|
|
701
|
+
if (this._templateRef) {
|
|
702
|
+
this._viewRef = this._viewContainer.createEmbeddedView(this._templateRef, this._context);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
LetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: LetDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
708
|
+
LetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: LetDirective, isStandalone: true, selector: "[etLet]", inputs: { etLet: "etLet" }, ngImport: i0 });
|
|
709
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: LetDirective, decorators: [{
|
|
710
|
+
type: Directive,
|
|
711
|
+
args: [{
|
|
712
|
+
selector: '[etLet]',
|
|
713
|
+
standalone: true,
|
|
714
|
+
}]
|
|
715
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { etLet: [{
|
|
716
|
+
type: Input
|
|
717
|
+
}] } });
|
|
718
|
+
|
|
719
|
+
class ObserveContentDirective {
|
|
720
|
+
constructor() {
|
|
721
|
+
this._contentObserver = inject(ContentObserverService);
|
|
722
|
+
this._elementRef = inject(ElementRef);
|
|
723
|
+
this._ngZone = inject(NgZone);
|
|
724
|
+
this.event = new EventEmitter();
|
|
725
|
+
this._disabled = false;
|
|
726
|
+
this._debounce = null;
|
|
727
|
+
this._currentSubscription = null;
|
|
728
|
+
}
|
|
729
|
+
get disabled() {
|
|
730
|
+
return this._disabled;
|
|
731
|
+
}
|
|
732
|
+
set disabled(value) {
|
|
733
|
+
this._disabled = coerceBooleanProperty(value);
|
|
734
|
+
this._disabled ? this._unsubscribe() : this._subscribe();
|
|
735
|
+
}
|
|
736
|
+
get debounce() {
|
|
737
|
+
return this._debounce;
|
|
738
|
+
}
|
|
739
|
+
set debounce(value) {
|
|
740
|
+
this._debounce = coerceNumberProperty(value);
|
|
741
|
+
this._subscribe();
|
|
742
|
+
}
|
|
743
|
+
ngAfterContentInit() {
|
|
744
|
+
if (!this._currentSubscription && !this.disabled) {
|
|
745
|
+
this._subscribe();
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
ngOnDestroy() {
|
|
749
|
+
this._unsubscribe();
|
|
750
|
+
}
|
|
751
|
+
_subscribe() {
|
|
752
|
+
this._unsubscribe();
|
|
753
|
+
const stream = this._contentObserver.observe(this._elementRef);
|
|
754
|
+
this._ngZone.runOutsideAngular(() => {
|
|
755
|
+
this._currentSubscription = (this.debounce ? stream.pipe(debounceTime$1(this.debounce)) : stream).subscribe(this.event);
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
_unsubscribe() {
|
|
759
|
+
var _a;
|
|
760
|
+
(_a = this._currentSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
ObserveContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ObserveContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
764
|
+
ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ObserveContentDirective, isStandalone: true, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: { event: "etObserveContent" }, exportAs: ["etObserveContent"], ngImport: i0 });
|
|
765
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ObserveContentDirective, decorators: [{
|
|
766
|
+
type: Directive,
|
|
767
|
+
args: [{
|
|
768
|
+
selector: '[etObserveContent]',
|
|
769
|
+
exportAs: 'etObserveContent',
|
|
770
|
+
standalone: true,
|
|
771
|
+
}]
|
|
772
|
+
}], propDecorators: { event: [{
|
|
773
|
+
type: Output,
|
|
774
|
+
args: ['etObserveContent']
|
|
775
|
+
}], disabled: [{
|
|
776
|
+
type: Input,
|
|
777
|
+
args: ['etObserveContentDisabled']
|
|
778
|
+
}], debounce: [{
|
|
779
|
+
type: Input,
|
|
780
|
+
args: ['etObserveContentDebounce']
|
|
781
|
+
}] } });
|
|
782
|
+
|
|
783
|
+
class ObserveResizeDirective {
|
|
784
|
+
constructor() {
|
|
785
|
+
this._resizeObserver = inject(ResizeObserverService);
|
|
786
|
+
this._elementRef = inject(ElementRef);
|
|
787
|
+
this._ngZone = inject(NgZone);
|
|
788
|
+
this.event = new EventEmitter();
|
|
789
|
+
this._disabled = false;
|
|
790
|
+
this._debounce = null;
|
|
791
|
+
this._currentSubscription = null;
|
|
792
|
+
}
|
|
793
|
+
get disabled() {
|
|
794
|
+
return this._disabled;
|
|
795
|
+
}
|
|
796
|
+
set disabled(value) {
|
|
797
|
+
this._disabled = coerceBooleanProperty(value);
|
|
798
|
+
this._disabled ? this._unsubscribe() : this._subscribe();
|
|
799
|
+
}
|
|
800
|
+
get debounce() {
|
|
801
|
+
return this._debounce;
|
|
802
|
+
}
|
|
803
|
+
set debounce(value) {
|
|
804
|
+
this._debounce = coerceNumberProperty(value);
|
|
805
|
+
this._subscribe();
|
|
806
|
+
}
|
|
807
|
+
ngAfterContentInit() {
|
|
808
|
+
if (!this._currentSubscription && !this.disabled) {
|
|
809
|
+
this._subscribe();
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
ngOnDestroy() {
|
|
813
|
+
this._unsubscribe();
|
|
814
|
+
}
|
|
815
|
+
_subscribe() {
|
|
816
|
+
this._unsubscribe();
|
|
817
|
+
const stream = this._resizeObserver.observe(this._elementRef);
|
|
818
|
+
this._ngZone.runOutsideAngular(() => {
|
|
819
|
+
this._currentSubscription = (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
_unsubscribe() {
|
|
823
|
+
var _a;
|
|
824
|
+
(_a = this._currentSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
ObserveResizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ObserveResizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
828
|
+
ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: { event: "etObserveResize" }, exportAs: ["etObserveResize"], ngImport: i0 });
|
|
829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ObserveResizeDirective, decorators: [{
|
|
830
|
+
type: Directive,
|
|
831
|
+
args: [{
|
|
832
|
+
selector: '[etObserveResize]',
|
|
833
|
+
exportAs: 'etObserveResize',
|
|
834
|
+
standalone: true,
|
|
835
|
+
}]
|
|
836
|
+
}], propDecorators: { event: [{
|
|
837
|
+
type: Output,
|
|
838
|
+
args: ['etObserveResize']
|
|
839
|
+
}], disabled: [{
|
|
840
|
+
type: Input,
|
|
841
|
+
args: ['etObserveResizeDisabled']
|
|
842
|
+
}], debounce: [{
|
|
843
|
+
type: Input,
|
|
844
|
+
args: ['etObserveResizeDebounce']
|
|
845
|
+
}] } });
|
|
846
|
+
|
|
847
|
+
const SCROLL_OBSERVER_FIRST_ELEMENT_CLASS = 'et-scroll-observer-first-element';
|
|
848
|
+
class ScrollObserverFirstElementDirective {
|
|
849
|
+
constructor() {
|
|
850
|
+
this._isFirstElement = false;
|
|
851
|
+
}
|
|
852
|
+
get isFirstElement() {
|
|
853
|
+
return this._isFirstElement;
|
|
854
|
+
}
|
|
855
|
+
set isFirstElement(value) {
|
|
856
|
+
this._isFirstElement = coerceBooleanProperty(value);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
ScrollObserverFirstElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ScrollObserverFirstElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
860
|
+
ScrollObserverFirstElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ScrollObserverFirstElementDirective, isStandalone: true, selector: "[etScrollObserverFirstElement]", inputs: { isFirstElement: ["etScrollObserverFirstElement", "isFirstElement"] }, host: { properties: { "class.et-scroll-observer-first-element": "this.isFirstElement" } }, ngImport: i0 });
|
|
861
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ScrollObserverFirstElementDirective, decorators: [{
|
|
862
|
+
type: Directive,
|
|
863
|
+
args: [{
|
|
864
|
+
selector: '[etScrollObserverFirstElement]',
|
|
865
|
+
standalone: true,
|
|
866
|
+
}]
|
|
867
|
+
}], propDecorators: { isFirstElement: [{
|
|
868
|
+
type: Input,
|
|
869
|
+
args: ['etScrollObserverFirstElement']
|
|
870
|
+
}, {
|
|
871
|
+
type: HostBinding,
|
|
872
|
+
args: [`class.${SCROLL_OBSERVER_FIRST_ELEMENT_CLASS}`]
|
|
873
|
+
}] } });
|
|
874
|
+
|
|
875
|
+
const SCROLL_OBSERVER_IGNORE_TARGET_CLASS = 'et-scroll-observer-ignore-target';
|
|
876
|
+
class ScrollObserverIgnoreTargetDirective {
|
|
877
|
+
}
|
|
878
|
+
ScrollObserverIgnoreTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ScrollObserverIgnoreTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
879
|
+
ScrollObserverIgnoreTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ScrollObserverIgnoreTargetDirective, isStandalone: true, selector: "[etScrollObserverIgnoreTarget]", host: { classAttribute: "et-scroll-observer-ignore-target" }, ngImport: i0 });
|
|
880
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ScrollObserverIgnoreTargetDirective, decorators: [{
|
|
881
|
+
type: Directive,
|
|
882
|
+
args: [{
|
|
883
|
+
selector: '[etScrollObserverIgnoreTarget]',
|
|
884
|
+
standalone: true,
|
|
885
|
+
host: {
|
|
886
|
+
class: SCROLL_OBSERVER_IGNORE_TARGET_CLASS,
|
|
887
|
+
},
|
|
888
|
+
}]
|
|
889
|
+
}] });
|
|
890
|
+
|
|
891
|
+
const SCROLL_OBSERVER_LAST_ELEMENT_CLASS = 'et-scroll-observer-last-element';
|
|
892
|
+
class ScrollObserverLastElementDirective {
|
|
893
|
+
constructor() {
|
|
894
|
+
this._isLastElement = false;
|
|
895
|
+
}
|
|
896
|
+
get isLastElement() {
|
|
897
|
+
return this._isLastElement;
|
|
898
|
+
}
|
|
899
|
+
set isLastElement(value) {
|
|
900
|
+
this._isLastElement = coerceBooleanProperty(value);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
ScrollObserverLastElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ScrollObserverLastElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
904
|
+
ScrollObserverLastElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ScrollObserverLastElementDirective, isStandalone: true, selector: "[etScrollObserverLastElement]", inputs: { isLastElement: ["etScrollObserverLastElement", "isLastElement"] }, host: { properties: { "class.et-scroll-observer-last-element": "this.isLastElement" }, classAttribute: "et-scroll-observer-last-element" }, ngImport: i0 });
|
|
905
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ScrollObserverLastElementDirective, decorators: [{
|
|
906
|
+
type: Directive,
|
|
907
|
+
args: [{
|
|
908
|
+
selector: '[etScrollObserverLastElement]',
|
|
909
|
+
standalone: true,
|
|
910
|
+
host: {
|
|
911
|
+
class: SCROLL_OBSERVER_LAST_ELEMENT_CLASS,
|
|
912
|
+
},
|
|
913
|
+
}]
|
|
914
|
+
}], propDecorators: { isLastElement: [{
|
|
915
|
+
type: Input,
|
|
916
|
+
args: ['etScrollObserverLastElement']
|
|
917
|
+
}, {
|
|
918
|
+
type: HostBinding,
|
|
919
|
+
args: [`class.${SCROLL_OBSERVER_LAST_ELEMENT_CLASS}`]
|
|
920
|
+
}] } });
|
|
921
|
+
|
|
922
|
+
const OBSERVE_SCROLL_STATE = new InjectionToken('OBSERVE_SCROLL_STATE');
|
|
923
|
+
|
|
924
|
+
class ObserveScrollStateDirective {
|
|
925
|
+
constructor() {
|
|
926
|
+
this._destroy$ = inject(DestroyService).destroy$;
|
|
927
|
+
this._elementRef = inject(ElementRef);
|
|
928
|
+
this._contentObserverService = inject(ContentObserverService);
|
|
929
|
+
this._resizeObserverService = inject(ResizeObserverService);
|
|
930
|
+
this._observedChildren = {
|
|
931
|
+
first: this._firstCurrentChild,
|
|
932
|
+
last: this._lastCurrentChild,
|
|
933
|
+
};
|
|
934
|
+
this._rootMargin = 0;
|
|
935
|
+
this._threshold = 1;
|
|
936
|
+
this._intersectionObserver = null;
|
|
937
|
+
this.etObserveScrollState = new EventEmitter();
|
|
938
|
+
}
|
|
939
|
+
get _firstCurrentChild() {
|
|
940
|
+
const explicitFirstElement = this._elementRef.nativeElement.querySelector(`.${SCROLL_OBSERVER_FIRST_ELEMENT_CLASS}`);
|
|
941
|
+
if (explicitFirstElement) {
|
|
942
|
+
return explicitFirstElement;
|
|
943
|
+
}
|
|
944
|
+
const element = this._elementRef.nativeElement.children[0];
|
|
945
|
+
return this._getNonIgnoredChild(element, 'next');
|
|
946
|
+
}
|
|
947
|
+
get _lastCurrentChild() {
|
|
948
|
+
const explicitLastElement = this._elementRef.nativeElement.querySelector(`.${SCROLL_OBSERVER_LAST_ELEMENT_CLASS}`);
|
|
949
|
+
if (explicitLastElement) {
|
|
950
|
+
return explicitLastElement;
|
|
951
|
+
}
|
|
952
|
+
const element = this._elementRef.nativeElement.children[this._elementRef.nativeElement.children.length - 1];
|
|
953
|
+
return this._getNonIgnoredChild(element, 'previous');
|
|
954
|
+
}
|
|
955
|
+
get observerRootMargin() {
|
|
956
|
+
return this._rootMargin;
|
|
957
|
+
}
|
|
958
|
+
set observerRootMargin(value) {
|
|
959
|
+
this._rootMargin = coerceNumberProperty(value);
|
|
960
|
+
}
|
|
961
|
+
get observerThreshold() {
|
|
962
|
+
return this._threshold;
|
|
963
|
+
}
|
|
964
|
+
set observerThreshold(value) {
|
|
965
|
+
this._threshold = coerceNumberProperty(value);
|
|
966
|
+
}
|
|
967
|
+
ngOnInit() {
|
|
968
|
+
this._contentObserverService
|
|
969
|
+
.observe(this._elementRef.nativeElement)
|
|
970
|
+
.pipe(tap(() => this._checkChildren()), takeUntil(this._destroy$))
|
|
971
|
+
.subscribe();
|
|
972
|
+
this._resizeObserverService
|
|
973
|
+
.observe(this._elementRef.nativeElement)
|
|
974
|
+
.pipe(debounceTime(25), tap(() => {
|
|
975
|
+
const canScroll = elementCanScroll(this._elementRef.nativeElement);
|
|
976
|
+
if ((!this._intersectionObserver && canScroll) || (this._intersectionObserver && !canScroll)) {
|
|
977
|
+
this._checkChildren();
|
|
978
|
+
}
|
|
979
|
+
}), takeUntil(this._destroy$))
|
|
980
|
+
.subscribe();
|
|
981
|
+
this._checkChildren();
|
|
982
|
+
}
|
|
983
|
+
ngOnDestroy() {
|
|
984
|
+
this._clearIntersectionObserver();
|
|
985
|
+
}
|
|
986
|
+
_checkChildren() {
|
|
987
|
+
this._clearIntersectionObserver();
|
|
988
|
+
if (this._firstCurrentChild === this._lastCurrentChild ||
|
|
989
|
+
!this._firstCurrentChild ||
|
|
990
|
+
!this._lastCurrentChild ||
|
|
991
|
+
!elementCanScroll(this._elementRef.nativeElement)) {
|
|
992
|
+
this._unobserveChild('first');
|
|
993
|
+
this._unobserveChild('last');
|
|
994
|
+
this.etObserveScrollState.emit({
|
|
995
|
+
isAtStart: true,
|
|
996
|
+
isAtEnd: true,
|
|
997
|
+
canScroll: false,
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
this._intersectionObserver = this._initiateIntersectionObserver();
|
|
1002
|
+
this._observeChild('first', this._firstCurrentChild);
|
|
1003
|
+
this._observeChild('last', this._lastCurrentChild);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
_initiateIntersectionObserver() {
|
|
1007
|
+
const observer = new IntersectionObserver((entries) => {
|
|
1008
|
+
var _a, _b, _c, _d;
|
|
1009
|
+
const { first, last } = this._observedChildren;
|
|
1010
|
+
const isAtStart = (_b = (_a = entries.find((entry) => entry.target === first)) === null || _a === void 0 ? void 0 : _a.isIntersecting) !== null && _b !== void 0 ? _b : false;
|
|
1011
|
+
const isAtEnd = (_d = (_c = entries.find((entry) => entry.target === last)) === null || _c === void 0 ? void 0 : _c.isIntersecting) !== null && _d !== void 0 ? _d : false;
|
|
1012
|
+
this.etObserveScrollState.emit({
|
|
1013
|
+
isAtStart,
|
|
1014
|
+
isAtEnd,
|
|
1015
|
+
canScroll: !isAtStart || !isAtEnd,
|
|
1016
|
+
});
|
|
1017
|
+
}, {
|
|
1018
|
+
root: this._elementRef.nativeElement,
|
|
1019
|
+
rootMargin: `${this._rootMargin}px`,
|
|
1020
|
+
threshold: this._threshold,
|
|
1021
|
+
});
|
|
1022
|
+
return observer;
|
|
1023
|
+
}
|
|
1024
|
+
_observeChild(child, element) {
|
|
1025
|
+
var _a;
|
|
1026
|
+
(_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.observe(element);
|
|
1027
|
+
this._observedChildren[child] = element;
|
|
1028
|
+
element.classList.add(`et-scroll-observer-observing-${child}-element`);
|
|
1029
|
+
}
|
|
1030
|
+
_unobserveChild(child) {
|
|
1031
|
+
var _a;
|
|
1032
|
+
const observedChild = this._observedChildren[child];
|
|
1033
|
+
if (!observedChild) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
observedChild.classList.remove('et-scroll-observer-observing-first-element', 'et-scroll-observer-observing-last-element');
|
|
1037
|
+
(_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.unobserve(observedChild);
|
|
1038
|
+
this._observedChildren[child] = null;
|
|
1039
|
+
}
|
|
1040
|
+
_clearIntersectionObserver() {
|
|
1041
|
+
var _a;
|
|
1042
|
+
(_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1043
|
+
this._intersectionObserver = null;
|
|
1044
|
+
}
|
|
1045
|
+
_getNonIgnoredChild(element, direction) {
|
|
1046
|
+
if (!element) {
|
|
1047
|
+
return null;
|
|
1048
|
+
}
|
|
1049
|
+
if (element === null || element === void 0 ? void 0 : element.classList.contains(SCROLL_OBSERVER_IGNORE_TARGET_CLASS)) {
|
|
1050
|
+
const nextElement = element[`${direction}ElementSibling`];
|
|
1051
|
+
if (!nextElement) {
|
|
1052
|
+
return null;
|
|
1053
|
+
}
|
|
1054
|
+
return this._getNonIgnoredChild(nextElement, direction);
|
|
1055
|
+
}
|
|
1056
|
+
return element;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
ObserveScrollStateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ObserveScrollStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1060
|
+
ObserveScrollStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: ObserveScrollStateDirective, isStandalone: true, selector: "[etObserveScrollState]", inputs: { observerRootMargin: "observerRootMargin", observerThreshold: "observerThreshold" }, outputs: { etObserveScrollState: "etObserveScrollState" }, providers: [
|
|
1061
|
+
{
|
|
1062
|
+
provide: OBSERVE_SCROLL_STATE,
|
|
1063
|
+
useExisting: ObserveScrollStateDirective,
|
|
1064
|
+
},
|
|
1065
|
+
DestroyService,
|
|
1066
|
+
], exportAs: ["etObserveScrollState"], ngImport: i0 });
|
|
1067
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ObserveScrollStateDirective, decorators: [{
|
|
1068
|
+
type: Directive,
|
|
1069
|
+
args: [{
|
|
1070
|
+
selector: '[etObserveScrollState]',
|
|
1071
|
+
exportAs: 'etObserveScrollState',
|
|
1072
|
+
standalone: true,
|
|
1073
|
+
providers: [
|
|
1074
|
+
{
|
|
1075
|
+
provide: OBSERVE_SCROLL_STATE,
|
|
1076
|
+
useExisting: ObserveScrollStateDirective,
|
|
1077
|
+
},
|
|
1078
|
+
DestroyService,
|
|
1079
|
+
],
|
|
1080
|
+
}]
|
|
1081
|
+
}], propDecorators: { observerRootMargin: [{
|
|
1082
|
+
type: Input
|
|
1083
|
+
}], observerThreshold: [{
|
|
1084
|
+
type: Input
|
|
1085
|
+
}], etObserveScrollState: [{
|
|
1086
|
+
type: Output
|
|
1087
|
+
}] } });
|
|
1088
|
+
|
|
1089
|
+
class RepeatDirective {
|
|
1090
|
+
get repeatCount() {
|
|
1091
|
+
return this._repeatCount;
|
|
1092
|
+
}
|
|
1093
|
+
set repeatCount(value) {
|
|
1094
|
+
this._repeatCount = coerceNumberProperty(value);
|
|
1095
|
+
this._render();
|
|
1096
|
+
}
|
|
1097
|
+
constructor(_mainTemplateRef, _viewContainerRef) {
|
|
1098
|
+
this._mainTemplateRef = _mainTemplateRef;
|
|
1099
|
+
this._viewContainerRef = _viewContainerRef;
|
|
1100
|
+
this._repeatCount = 2;
|
|
1101
|
+
}
|
|
1102
|
+
_render() {
|
|
1103
|
+
this._viewContainerRef.clear();
|
|
1104
|
+
for (let i = 0; i < this.repeatCount; i++) {
|
|
1105
|
+
this._viewContainerRef.createEmbeddedView(this._mainTemplateRef);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
RepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: RepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1110
|
+
RepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: RepeatDirective, isStandalone: true, selector: "[etRepeat]", inputs: { repeatCount: ["etRepeat", "repeatCount"] }, ngImport: i0 });
|
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: RepeatDirective, decorators: [{
|
|
1112
|
+
type: Directive,
|
|
1113
|
+
args: [{
|
|
1114
|
+
selector: '[etRepeat]',
|
|
1115
|
+
standalone: true,
|
|
1116
|
+
}]
|
|
1117
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { repeatCount: [{
|
|
1118
|
+
type: Input,
|
|
1119
|
+
args: ['etRepeat']
|
|
1120
|
+
}] } });
|
|
1121
|
+
|
|
1122
|
+
const SEO_DIRECTIVE_TOKEN = new InjectionToken('SEO_DIRECTIVE_TOKEN');
|
|
1123
|
+
|
|
1124
|
+
const mergeSeoConfig = (config, parentConfig) => {
|
|
1125
|
+
return Object.assign(Object.assign({}, parentConfig), config);
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
class SeoDirective {
|
|
1129
|
+
constructor() {
|
|
1130
|
+
this._metaService = inject(Meta);
|
|
1131
|
+
this._titleService = inject(Title);
|
|
1132
|
+
this._onDeactivate$ = new Subject();
|
|
1133
|
+
this._isDeactivated = false;
|
|
1134
|
+
this.parent = inject(SEO_DIRECTIVE_TOKEN, { optional: true, skipSelf: true });
|
|
1135
|
+
this._config = {};
|
|
1136
|
+
}
|
|
1137
|
+
get config() {
|
|
1138
|
+
return this._config;
|
|
1139
|
+
}
|
|
1140
|
+
ngOnInit() {
|
|
1141
|
+
var _a;
|
|
1142
|
+
(_a = this.parent) === null || _a === void 0 ? void 0 : _a._deactivate();
|
|
1143
|
+
}
|
|
1144
|
+
ngOnDestroy() {
|
|
1145
|
+
var _a;
|
|
1146
|
+
this._deactivate();
|
|
1147
|
+
this._cleanUp();
|
|
1148
|
+
(_a = this.parent) === null || _a === void 0 ? void 0 : _a._activate();
|
|
1149
|
+
}
|
|
1150
|
+
// TODO(TRB): This should get split up into multiple methods to make it more readable
|
|
1151
|
+
// - updateTitle
|
|
1152
|
+
// - updateMeta
|
|
1153
|
+
// - updateLink
|
|
1154
|
+
updateConfig(config) {
|
|
1155
|
+
var _a;
|
|
1156
|
+
this._config = mergeSeoConfig(config, ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.config) || {});
|
|
1157
|
+
if (this._isDeactivated) {
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
this._deactivate();
|
|
1161
|
+
this._activate();
|
|
1162
|
+
}
|
|
1163
|
+
_activate() {
|
|
1164
|
+
this._onDeactivate$.next(false);
|
|
1165
|
+
this._isDeactivated = false;
|
|
1166
|
+
for (const [key, value] of Object.entries(this._config)) {
|
|
1167
|
+
if (value instanceof Observable) {
|
|
1168
|
+
value.pipe(takeUntil(this._onDeactivate$)).subscribe((value) => this._update(key, value));
|
|
1169
|
+
}
|
|
1170
|
+
else if (Array.isArray(value)) {
|
|
1171
|
+
value.forEach((value) => {
|
|
1172
|
+
if (value instanceof Observable) {
|
|
1173
|
+
value.pipe(takeUntil(this._onDeactivate$)).subscribe((value) => this._update(key, value));
|
|
1174
|
+
}
|
|
1175
|
+
else {
|
|
1176
|
+
this._update(key, value);
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
else if (typeof value === 'object' && value !== null) {
|
|
1181
|
+
for (const [subKey, subValue] of Object.entries(value)) {
|
|
1182
|
+
if (subValue instanceof Observable) {
|
|
1183
|
+
subValue.pipe(takeUntil(this._onDeactivate$)).subscribe((value) => this._update(`${key}:${subKey}`, value));
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
this._update(`${key}:${subKey}`, subValue);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
else {
|
|
1191
|
+
this._update(key, value);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
_deactivate() {
|
|
1196
|
+
this._onDeactivate$.next(true);
|
|
1197
|
+
this._isDeactivated = true;
|
|
1198
|
+
}
|
|
1199
|
+
_update(key, value) {
|
|
1200
|
+
switch (key) {
|
|
1201
|
+
case 'title':
|
|
1202
|
+
if (value && typeof value === 'string') {
|
|
1203
|
+
this._titleService.setTitle(value);
|
|
1204
|
+
}
|
|
1205
|
+
break;
|
|
1206
|
+
case 'canonical':
|
|
1207
|
+
{
|
|
1208
|
+
const link = document.querySelector(`link[rel="${key}"]`);
|
|
1209
|
+
if (link) {
|
|
1210
|
+
link.setAttribute('href', value);
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
const newLink = document.createElement('link');
|
|
1214
|
+
newLink.setAttribute('rel', key);
|
|
1215
|
+
newLink.setAttribute('href', value);
|
|
1216
|
+
document.head.appendChild(newLink);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
break;
|
|
1220
|
+
case 'alternate':
|
|
1221
|
+
{
|
|
1222
|
+
const link = document.querySelector(`link[rel="${key}"][hreflang="${value.hreflang}"]`);
|
|
1223
|
+
if (link) {
|
|
1224
|
+
link.setAttribute('href', value.href);
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
const newLink = document.createElement('link');
|
|
1228
|
+
newLink.setAttribute('rel', key);
|
|
1229
|
+
newLink.setAttribute('hreflang', value.hreflang);
|
|
1230
|
+
newLink.setAttribute('href', value.href);
|
|
1231
|
+
document.head.appendChild(newLink);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
break;
|
|
1235
|
+
default:
|
|
1236
|
+
if (value !== undefined && value !== null) {
|
|
1237
|
+
const val = Array.isArray(value) ? value.join(', ') : value;
|
|
1238
|
+
this._metaService.updateTag({ name: key, content: val });
|
|
1239
|
+
}
|
|
1240
|
+
else {
|
|
1241
|
+
this._metaService.removeTag(`name="${key}"`);
|
|
1242
|
+
}
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
_cleanUp() {
|
|
1247
|
+
var _a, _b, _c, _d, _e;
|
|
1248
|
+
for (const key in this._config) {
|
|
1249
|
+
if (key === 'alternate') {
|
|
1250
|
+
const links = document.querySelectorAll(`link[rel="${key}"]`);
|
|
1251
|
+
links.forEach((link) => {
|
|
1252
|
+
link.remove();
|
|
1253
|
+
});
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
if (key === 'canonical') {
|
|
1257
|
+
const link = document.querySelector(`link[rel="${key}"]`);
|
|
1258
|
+
if (link) {
|
|
1259
|
+
link.remove();
|
|
1260
|
+
}
|
|
1261
|
+
continue;
|
|
1262
|
+
}
|
|
1263
|
+
if (typeof this._config[key] === 'object' &&
|
|
1264
|
+
this._config[key] !== null &&
|
|
1265
|
+
!(this._config[key] instanceof Observable)) {
|
|
1266
|
+
for (const subKey in this._config[key]) {
|
|
1267
|
+
const parentValue = (_c = (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b[key]) === null || _c === void 0 ? void 0 : _c[subKey];
|
|
1268
|
+
if (parentValue === undefined) {
|
|
1269
|
+
this._update(`${key}:${subKey}`, undefined);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
else {
|
|
1274
|
+
const parentValue = (_e = (_d = this.parent) === null || _d === void 0 ? void 0 : _d.config) === null || _e === void 0 ? void 0 : _e[key];
|
|
1275
|
+
if (parentValue === undefined) {
|
|
1276
|
+
this._update(key, null);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
SeoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: SeoDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1283
|
+
SeoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: SeoDirective, isStandalone: true, providers: [{ provide: SEO_DIRECTIVE_TOKEN, useExisting: SeoDirective }], ngImport: i0 });
|
|
1284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: SeoDirective, decorators: [{
|
|
1285
|
+
type: Directive,
|
|
1286
|
+
args: [{
|
|
1287
|
+
standalone: true,
|
|
1288
|
+
providers: [{ provide: SEO_DIRECTIVE_TOKEN, useExisting: SeoDirective }],
|
|
1289
|
+
}]
|
|
1290
|
+
}] });
|
|
1291
|
+
|
|
1292
|
+
// TODO(TRB): Add correct type once provided by API
|
|
1293
|
+
const normalizeGameResultType = (type) => {
|
|
1294
|
+
if (!type) {
|
|
1295
|
+
return null;
|
|
1296
|
+
}
|
|
1297
|
+
switch (type) {
|
|
1298
|
+
case 'extra_time':
|
|
1299
|
+
return {
|
|
1300
|
+
i18n: 'game-result-type.extra-time',
|
|
1301
|
+
shortCode: 'AET',
|
|
1302
|
+
text: 'After Extra Time',
|
|
1303
|
+
};
|
|
1304
|
+
case 'penalty':
|
|
1305
|
+
return {
|
|
1306
|
+
i18n: 'game-result-type.penalty',
|
|
1307
|
+
shortCode: 'PSO',
|
|
1308
|
+
text: 'Penalty shootout',
|
|
1309
|
+
};
|
|
1310
|
+
case 'golden_goal':
|
|
1311
|
+
return {
|
|
1312
|
+
i18n: 'game-result-type.golden-goal',
|
|
1313
|
+
shortCode: 'GG',
|
|
1314
|
+
text: 'Golden Goal',
|
|
1315
|
+
};
|
|
1316
|
+
case 'default':
|
|
1317
|
+
default:
|
|
1318
|
+
return {
|
|
1319
|
+
i18n: 'game-result-type.full-time',
|
|
1320
|
+
shortCode: 'FT',
|
|
1321
|
+
text: 'Full Time',
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
class NormalizeGameResultTypePipe {
|
|
1327
|
+
constructor() {
|
|
1328
|
+
this.transform = normalizeGameResultType;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
NormalizeGameResultTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeGameResultTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1332
|
+
NormalizeGameResultTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: NormalizeGameResultTypePipe, isStandalone: true, name: "etNormalizeGameResultType" });
|
|
1333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeGameResultTypePipe, decorators: [{
|
|
1334
|
+
type: Pipe,
|
|
1335
|
+
args: [{ name: 'etNormalizeGameResultType', standalone: true }]
|
|
1336
|
+
}] });
|
|
1337
|
+
|
|
1338
|
+
const normalizeMatchState = (match) => {
|
|
1339
|
+
if (match === null || match === void 0 ? void 0 : match.isCompletedByReferee) {
|
|
1340
|
+
return "autoWin" /* MatchStateType.AUTO_WIN */;
|
|
1341
|
+
}
|
|
1342
|
+
else if ((match === null || match === void 0 ? void 0 : match.status) === 'preparing') {
|
|
1343
|
+
return "preMatch" /* MatchStateType.PRE_MATCH */;
|
|
1344
|
+
}
|
|
1345
|
+
else if ((match === null || match === void 0 ? void 0 : match.status) === 'started') {
|
|
1346
|
+
return "live" /* MatchStateType.LIVE */;
|
|
1347
|
+
}
|
|
1348
|
+
else if ((match === null || match === void 0 ? void 0 : match.status) === 'published' || (match === null || match === void 0 ? void 0 : match.status) === 'finished') {
|
|
1349
|
+
return "postMatch" /* MatchStateType.POST_MATCH */;
|
|
1350
|
+
}
|
|
1351
|
+
else if ((match === null || match === void 0 ? void 0 : match.round.state) !== 'preparing') {
|
|
1352
|
+
return "preparingRound" /* MatchStateType.PREPARING_ROUND */;
|
|
1353
|
+
}
|
|
1354
|
+
return null;
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
class NormalizeMatchStatePipe {
|
|
1358
|
+
constructor() {
|
|
1359
|
+
this.transform = normalizeMatchState;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
NormalizeMatchStatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchStatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1363
|
+
NormalizeMatchStatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchStatePipe, isStandalone: true, name: "etNormalizeMatchState" });
|
|
1364
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchStatePipe, decorators: [{
|
|
1365
|
+
type: Pipe,
|
|
1366
|
+
args: [{ name: 'etNormalizeMatchState', standalone: true }]
|
|
1367
|
+
}] });
|
|
1368
|
+
|
|
1369
|
+
const normalizeMatchParticipants = (match) => {
|
|
1370
|
+
const matchState = normalizeMatchState(match);
|
|
1371
|
+
if (!match || !matchState) {
|
|
1372
|
+
return null;
|
|
1373
|
+
}
|
|
1374
|
+
return {
|
|
1375
|
+
home: normalizeMatchParticipant(match, 'home'),
|
|
1376
|
+
away: normalizeMatchParticipant(match, 'away'),
|
|
1377
|
+
};
|
|
1378
|
+
};
|
|
1379
|
+
const normalizeMatchParticipant = (match, side) => {
|
|
1380
|
+
var _a, _b, _c, _d;
|
|
1381
|
+
const matchState = normalizeMatchState(match);
|
|
1382
|
+
if (!match || !matchState) {
|
|
1383
|
+
return null;
|
|
1384
|
+
}
|
|
1385
|
+
const participant = match[side];
|
|
1386
|
+
const participantType = (_d = (_b = (_a = match.home) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : (_c = match.away) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : 'unknown';
|
|
1387
|
+
if (!participant) {
|
|
1388
|
+
if (matchState === "postMatch" /* MatchStateType.POST_MATCH */ || matchState === "autoWin" /* MatchStateType.AUTO_WIN */) {
|
|
1389
|
+
return {
|
|
1390
|
+
participantType,
|
|
1391
|
+
type: 'none',
|
|
1392
|
+
i18n: 'match-participant.none',
|
|
1393
|
+
text: 'No opponent',
|
|
1394
|
+
data: participant,
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
else {
|
|
1398
|
+
return {
|
|
1399
|
+
participantType,
|
|
1400
|
+
type: 'tbd',
|
|
1401
|
+
i18n: 'match-participant.tbd',
|
|
1402
|
+
text: 'TBD',
|
|
1403
|
+
data: participant,
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
else {
|
|
1408
|
+
return {
|
|
1409
|
+
participantType,
|
|
1410
|
+
type: 'participant',
|
|
1411
|
+
data: participant,
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
class NormalizeMatchParticipantsPipe {
|
|
1417
|
+
constructor() {
|
|
1418
|
+
this.transform = normalizeMatchParticipants;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
NormalizeMatchParticipantsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchParticipantsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1422
|
+
NormalizeMatchParticipantsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchParticipantsPipe, isStandalone: true, name: "etNormalizeMatchParticipants" });
|
|
1423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchParticipantsPipe, decorators: [{
|
|
1424
|
+
type: Pipe,
|
|
1425
|
+
args: [{ name: 'etNormalizeMatchParticipants', standalone: true }]
|
|
1426
|
+
}] });
|
|
1427
|
+
|
|
1428
|
+
const EMPTY_SCORE = {
|
|
1429
|
+
home: { score: 'match-score.placeholder', isWinner: false },
|
|
1430
|
+
away: { score: 'match-score.placeholder', isWinner: false },
|
|
1431
|
+
isNumeric: false,
|
|
1432
|
+
subLine: null,
|
|
1433
|
+
};
|
|
1434
|
+
const normalizeMatchScore = (match) => {
|
|
1435
|
+
var _a, _b;
|
|
1436
|
+
if (!match) {
|
|
1437
|
+
return null;
|
|
1438
|
+
}
|
|
1439
|
+
const matchState = normalizeMatchState(match);
|
|
1440
|
+
const subLine = getMatchScoreSubLine(match);
|
|
1441
|
+
if (!match.homeScore && !match.awayScore) {
|
|
1442
|
+
return Object.assign(Object.assign({}, EMPTY_SCORE), { subLine, isNumeric: false });
|
|
1443
|
+
}
|
|
1444
|
+
if (isKnockoutMatch(match)) {
|
|
1445
|
+
if (matchState === "preMatch" /* MatchStateType.PRE_MATCH */ || matchState === "live" /* MatchStateType.LIVE */) {
|
|
1446
|
+
return Object.assign(Object.assign({}, EMPTY_SCORE), { subLine, isNumeric: false });
|
|
1447
|
+
}
|
|
1448
|
+
return {
|
|
1449
|
+
home: {
|
|
1450
|
+
score: getKnockoutMatchScore(match.homeScore),
|
|
1451
|
+
isWinner: ((_a = match.homeScore) === null || _a === void 0 ? void 0 : _a.status) === 'won',
|
|
1452
|
+
},
|
|
1453
|
+
away: {
|
|
1454
|
+
score: getKnockoutMatchScore(match.awayScore),
|
|
1455
|
+
isWinner: ((_b = match.awayScore) === null || _b === void 0 ? void 0 : _b.status) === 'won',
|
|
1456
|
+
},
|
|
1457
|
+
subLine,
|
|
1458
|
+
isNumeric: false,
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
else if (isGroupMatch(match)) {
|
|
1462
|
+
if (match.games.length === 1) {
|
|
1463
|
+
// Return the score if only one game has been played
|
|
1464
|
+
return Object.assign(Object.assign({}, getGroupMatchScore(match)), { subLine, isNumeric: true });
|
|
1465
|
+
}
|
|
1466
|
+
else {
|
|
1467
|
+
return Object.assign(Object.assign({}, getGroupMatchPoints(match)), { subLine, isNumeric: true });
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
else {
|
|
1471
|
+
return Object.assign(Object.assign({}, getGroupMatchScore(match)), { subLine, isNumeric: true });
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
const isKnockoutMatch = (match) => {
|
|
1475
|
+
if (!match) {
|
|
1476
|
+
return false;
|
|
1477
|
+
}
|
|
1478
|
+
return (match.matchType === 'single_elimination' ||
|
|
1479
|
+
match.matchType === 'double_elimination' ||
|
|
1480
|
+
match.matchType === 'fifa_swiss');
|
|
1481
|
+
};
|
|
1482
|
+
const isGroupMatch = (match) => {
|
|
1483
|
+
if (!match) {
|
|
1484
|
+
return false;
|
|
1485
|
+
}
|
|
1486
|
+
return match.matchType === 'groups' || match.matchType === 'league';
|
|
1487
|
+
};
|
|
1488
|
+
const getKnockoutMatchScore = (score) => {
|
|
1489
|
+
if ((score === null || score === void 0 ? void 0 : score.status) === 'won') {
|
|
1490
|
+
return 'match-score.knockout.won';
|
|
1491
|
+
}
|
|
1492
|
+
else if ((score === null || score === void 0 ? void 0 : score.status) === 'lost') {
|
|
1493
|
+
return 'match-score.knockout.lost';
|
|
1494
|
+
}
|
|
1495
|
+
else if ((score === null || score === void 0 ? void 0 : score.status) === 'tie') {
|
|
1496
|
+
return 'match-score.knockout.tie';
|
|
1497
|
+
}
|
|
1498
|
+
return null;
|
|
1499
|
+
};
|
|
1500
|
+
const getMatchScoreSubLine = (match) => {
|
|
1501
|
+
if (isKnockoutMatch(match)) {
|
|
1502
|
+
return null;
|
|
1503
|
+
}
|
|
1504
|
+
else if (isGroupMatch(match)) {
|
|
1505
|
+
return 'match-score.groups.sub-line';
|
|
1506
|
+
}
|
|
1507
|
+
else {
|
|
1508
|
+
return null;
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
const getGroupMatchScore = (match) => {
|
|
1512
|
+
var _a, _b, _c, _d;
|
|
1513
|
+
if (!match) {
|
|
1514
|
+
return null;
|
|
1515
|
+
}
|
|
1516
|
+
return {
|
|
1517
|
+
home: {
|
|
1518
|
+
score: ((_a = match.homeScore) === null || _a === void 0 ? void 0 : _a.ownPoints) || 0,
|
|
1519
|
+
isWinner: ((_b = match.homeScore) === null || _b === void 0 ? void 0 : _b.status) === 'won',
|
|
1520
|
+
},
|
|
1521
|
+
away: {
|
|
1522
|
+
score: ((_c = match.awayScore) === null || _c === void 0 ? void 0 : _c.ownPoints) || 0,
|
|
1523
|
+
isWinner: ((_d = match.awayScore) === null || _d === void 0 ? void 0 : _d.status) === 'won',
|
|
1524
|
+
},
|
|
1525
|
+
};
|
|
1526
|
+
};
|
|
1527
|
+
const getGroupMatchPoints = (match) => {
|
|
1528
|
+
var _a, _b, _c, _d;
|
|
1529
|
+
if (!match) {
|
|
1530
|
+
return null;
|
|
1531
|
+
}
|
|
1532
|
+
return {
|
|
1533
|
+
home: {
|
|
1534
|
+
score: ((_a = match.homeScore) === null || _a === void 0 ? void 0 : _a.score) || 0,
|
|
1535
|
+
isWinner: ((_b = match.homeScore) === null || _b === void 0 ? void 0 : _b.status) === 'won',
|
|
1536
|
+
},
|
|
1537
|
+
away: {
|
|
1538
|
+
score: ((_c = match.awayScore) === null || _c === void 0 ? void 0 : _c.score) || 0,
|
|
1539
|
+
isWinner: ((_d = match.awayScore) === null || _d === void 0 ? void 0 : _d.status) === 'won',
|
|
1540
|
+
},
|
|
1541
|
+
};
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
class NormalizeMatchScorePipe {
|
|
1545
|
+
constructor() {
|
|
1546
|
+
this.transform = normalizeMatchScore;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
NormalizeMatchScorePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchScorePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1550
|
+
NormalizeMatchScorePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchScorePipe, isStandalone: true, name: "etNormalizeMatchScore" });
|
|
1551
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchScorePipe, decorators: [{
|
|
1552
|
+
type: Pipe,
|
|
1553
|
+
args: [{ name: 'etNormalizeMatchScore', standalone: true }]
|
|
1554
|
+
}] });
|
|
1555
|
+
|
|
1556
|
+
const normalizeMatchType = (matchType) => {
|
|
1557
|
+
if (!matchType) {
|
|
1558
|
+
return null;
|
|
1559
|
+
}
|
|
1560
|
+
switch (matchType) {
|
|
1561
|
+
case 'double_elimination':
|
|
1562
|
+
return {
|
|
1563
|
+
i18n: 'match-type.double-elimination',
|
|
1564
|
+
text: 'Double Elimination',
|
|
1565
|
+
};
|
|
1566
|
+
case 'single_elimination':
|
|
1567
|
+
return {
|
|
1568
|
+
i18n: 'match-type.single-elimination',
|
|
1569
|
+
text: 'Single Elimination',
|
|
1570
|
+
};
|
|
1571
|
+
case 'fifa_swiss':
|
|
1572
|
+
return {
|
|
1573
|
+
i18n: 'match-type.fifa-swiss',
|
|
1574
|
+
text: 'FIFA Swiss',
|
|
1575
|
+
};
|
|
1576
|
+
case 'groups':
|
|
1577
|
+
return {
|
|
1578
|
+
i18n: 'match-type.groups',
|
|
1579
|
+
text: 'Groups',
|
|
1580
|
+
};
|
|
1581
|
+
case 'league':
|
|
1582
|
+
return {
|
|
1583
|
+
i18n: 'match-type.league',
|
|
1584
|
+
text: 'League',
|
|
1585
|
+
};
|
|
1586
|
+
case 'pools':
|
|
1587
|
+
return {
|
|
1588
|
+
i18n: 'match-type.pools',
|
|
1589
|
+
text: 'Pools',
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
class NormalizeMatchTypePipe {
|
|
1595
|
+
constructor() {
|
|
1596
|
+
this.transform = normalizeMatchType;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
NormalizeMatchTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1600
|
+
NormalizeMatchTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchTypePipe, isStandalone: true, name: "etNormalizeMatchType" });
|
|
1601
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NormalizeMatchTypePipe, decorators: [{
|
|
1602
|
+
type: Pipe,
|
|
1603
|
+
args: [{ name: 'etNormalizeMatchType', standalone: true }]
|
|
1604
|
+
}] });
|
|
1605
|
+
|
|
1606
|
+
const toArray = (value) => {
|
|
1607
|
+
return Array.from({ length: value }, (_, i) => i);
|
|
1608
|
+
};
|
|
1609
|
+
const toArrayTrackByFn = (_, item) => item;
|
|
1610
|
+
|
|
1611
|
+
class ToArrayPipe {
|
|
1612
|
+
constructor() {
|
|
1613
|
+
this.transform = toArray;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
ToArrayPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ToArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1617
|
+
ToArrayPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: ToArrayPipe, isStandalone: true, name: "toArray" });
|
|
1618
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ToArrayPipe, decorators: [{
|
|
1619
|
+
type: Pipe,
|
|
1620
|
+
args: [{ name: 'toArray', standalone: true }]
|
|
1621
|
+
}] });
|
|
1622
|
+
|
|
326
1623
|
/**
|
|
327
1624
|
* Generated bundle index. Do not edit.
|
|
328
1625
|
*/
|
|
329
1626
|
|
|
330
|
-
export { DEFAULT_VIEWPORT_CONFIG, FocusVisibleService, LetContext, LetDirective, Memo, RepeatDirective, ToArrayPipe, VIEWPORT_CONFIG, ViewportService, clamp, provideViewportConfig, toArray, toArrayTrackByFn };
|
|
1627
|
+
export { ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DestroyService, FocusVisibleService, LetContext, LetDirective, Memo, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SeoDirective, ToArrayPipe, VIEWPORT_CONFIG, ViewportService, clamp, elementCanScroll, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, isGroupMatch, isKnockoutMatch, mergeSeoConfig, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, toArray, toArrayTrackByFn };
|
|
331
1628
|
//# sourceMappingURL=ethlete-core.mjs.map
|