@ethlete/core 0.2.0-next.21 → 0.2.0-next.23
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/directives/observe-content/observe-content.directive.mjs +5 -5
- package/esm2020/lib/directives/observe-resize/observe-resize.directive.mjs +5 -5
- package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.directive.mjs +8 -7
- package/esm2020/lib/utils/media-query-observable.util.mjs +18 -0
- package/esm2020/lib/utils/public-api.mjs +2 -1
- package/fesm2015/ethlete-core.mjs +34 -16
- package/fesm2015/ethlete-core.mjs.map +1 -1
- package/fesm2020/ethlete-core.mjs +34 -16
- package/fesm2020/ethlete-core.mjs.map +1 -1
- package/lib/directives/observe-content/observe-content.directive.d.ts +2 -2
- package/lib/directives/observe-resize/observe-resize.directive.d.ts +2 -2
- package/lib/directives/observe-scroll-state/observe-scroll-state.directive.d.ts +2 -2
- package/lib/utils/media-query-observable.util.d.ts +5 -0
- package/lib/utils/public-api.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding, InjectionToken, Injectable, ElementRef, Inject, Optional, EventEmitter, Directive, Output, NgZone, Pipe, QueryList } from '@angular/core';
|
|
3
3
|
import { DomSanitizer, Meta, Title } from '@angular/platform-browser';
|
|
4
4
|
import { coerceElement, coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
|
|
5
|
-
import { fromEvent, Observable, Subject, takeUntil, distinctUntilChanged, BehaviorSubject, filter,
|
|
5
|
+
import { fromEvent, Observable, Subject, startWith, map, takeUntil, distinctUntilChanged, BehaviorSubject, filter, combineLatest, pairwise, debounceTime, shareReplay, tap, take } from 'rxjs';
|
|
6
6
|
import { DOCUMENT } from '@angular/common';
|
|
7
7
|
import { Router, NavigationEnd } from '@angular/router';
|
|
8
8
|
import { __decorate, __metadata } from 'tslib';
|
|
@@ -594,6 +594,23 @@ const equal = (foo, bar) => {
|
|
|
594
594
|
return foo !== foo && bar !== bar;
|
|
595
595
|
};
|
|
596
596
|
|
|
597
|
+
const createMediaQueryObservable = (query) => {
|
|
598
|
+
const mq = window.matchMedia(query);
|
|
599
|
+
const observable = new Observable((observer) => {
|
|
600
|
+
const eventHandler = (event) => {
|
|
601
|
+
observer.next(event);
|
|
602
|
+
};
|
|
603
|
+
mq.addEventListener('change', eventHandler);
|
|
604
|
+
return () => {
|
|
605
|
+
mq.removeEventListener('change', eventHandler);
|
|
606
|
+
};
|
|
607
|
+
}).pipe(startWith(mq), map(({ matches }) => ({
|
|
608
|
+
matches,
|
|
609
|
+
query,
|
|
610
|
+
})));
|
|
611
|
+
return observable;
|
|
612
|
+
};
|
|
613
|
+
|
|
597
614
|
const isAttributeRenderBinding = (value) => typeof value === 'boolean';
|
|
598
615
|
const isAttributeValueBinding = (value) => typeof value === 'object';
|
|
599
616
|
const createReactiveBindings = (...values) => {
|
|
@@ -1209,7 +1226,7 @@ class ObserveContentDirective {
|
|
|
1209
1226
|
this._contentObserver = inject(ContentObserverService);
|
|
1210
1227
|
this._elementRef = inject(ElementRef);
|
|
1211
1228
|
this._ngZone = inject(NgZone);
|
|
1212
|
-
this.
|
|
1229
|
+
this.valueChange = new EventEmitter();
|
|
1213
1230
|
this._disabled = false;
|
|
1214
1231
|
this._debounce = null;
|
|
1215
1232
|
this._currentSubscription = null;
|
|
@@ -1240,7 +1257,7 @@ class ObserveContentDirective {
|
|
|
1240
1257
|
this._unsubscribe();
|
|
1241
1258
|
const stream = this._contentObserver.observe(this._elementRef);
|
|
1242
1259
|
this._ngZone.runOutsideAngular(() => {
|
|
1243
|
-
this._currentSubscription = (this.debounce ? stream.pipe(debounceTime$1(this.debounce)) : stream).subscribe(this.
|
|
1260
|
+
this._currentSubscription = (this.debounce ? stream.pipe(debounceTime$1(this.debounce)) : stream).subscribe(this.valueChange);
|
|
1244
1261
|
});
|
|
1245
1262
|
}
|
|
1246
1263
|
_unsubscribe() {
|
|
@@ -1248,7 +1265,7 @@ class ObserveContentDirective {
|
|
|
1248
1265
|
}
|
|
1249
1266
|
}
|
|
1250
1267
|
ObserveContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1251
|
-
ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveContentDirective, isStandalone: true, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: {
|
|
1268
|
+
ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveContentDirective, isStandalone: true, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: { valueChange: "etObserveContent" }, exportAs: ["etObserveContent"], ngImport: i0 });
|
|
1252
1269
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveContentDirective, decorators: [{
|
|
1253
1270
|
type: Directive,
|
|
1254
1271
|
args: [{
|
|
@@ -1256,7 +1273,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
1256
1273
|
exportAs: 'etObserveContent',
|
|
1257
1274
|
standalone: true,
|
|
1258
1275
|
}]
|
|
1259
|
-
}], propDecorators: {
|
|
1276
|
+
}], propDecorators: { valueChange: [{
|
|
1260
1277
|
type: Output,
|
|
1261
1278
|
args: ['etObserveContent']
|
|
1262
1279
|
}], disabled: [{
|
|
@@ -1272,7 +1289,7 @@ class ObserveResizeDirective {
|
|
|
1272
1289
|
this._resizeObserver = inject(ResizeObserverService);
|
|
1273
1290
|
this._elementRef = inject(ElementRef);
|
|
1274
1291
|
this._ngZone = inject(NgZone);
|
|
1275
|
-
this.
|
|
1292
|
+
this.valueChange = new EventEmitter();
|
|
1276
1293
|
this._disabled = false;
|
|
1277
1294
|
this._debounce = null;
|
|
1278
1295
|
this._currentSubscription = null;
|
|
@@ -1303,7 +1320,7 @@ class ObserveResizeDirective {
|
|
|
1303
1320
|
this._unsubscribe();
|
|
1304
1321
|
const stream = this._resizeObserver.observe(this._elementRef);
|
|
1305
1322
|
this._ngZone.runOutsideAngular(() => {
|
|
1306
|
-
this._currentSubscription = (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.
|
|
1323
|
+
this._currentSubscription = (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.valueChange);
|
|
1307
1324
|
});
|
|
1308
1325
|
}
|
|
1309
1326
|
_unsubscribe() {
|
|
@@ -1311,7 +1328,7 @@ class ObserveResizeDirective {
|
|
|
1311
1328
|
}
|
|
1312
1329
|
}
|
|
1313
1330
|
ObserveResizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveResizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1314
|
-
ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: {
|
|
1331
|
+
ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: { valueChange: "etObserveResize" }, exportAs: ["etObserveResize"], ngImport: i0 });
|
|
1315
1332
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveResizeDirective, decorators: [{
|
|
1316
1333
|
type: Directive,
|
|
1317
1334
|
args: [{
|
|
@@ -1319,7 +1336,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
1319
1336
|
exportAs: 'etObserveResize',
|
|
1320
1337
|
standalone: true,
|
|
1321
1338
|
}]
|
|
1322
|
-
}], propDecorators: {
|
|
1339
|
+
}], propDecorators: { valueChange: [{
|
|
1323
1340
|
type: Output,
|
|
1324
1341
|
args: ['etObserveResize']
|
|
1325
1342
|
}], disabled: [{
|
|
@@ -1420,7 +1437,7 @@ class ObserveScrollStateDirective {
|
|
|
1420
1437
|
this._rootMargin = 0;
|
|
1421
1438
|
this._threshold = 1;
|
|
1422
1439
|
this._intersectionObserver = null;
|
|
1423
|
-
this.
|
|
1440
|
+
this.valueChange = new EventEmitter();
|
|
1424
1441
|
}
|
|
1425
1442
|
get _firstCurrentChild() {
|
|
1426
1443
|
const explicitFirstElement = this._elementRef.nativeElement.querySelector(`.${SCROLL_OBSERVER_FIRST_ELEMENT_CLASS}`);
|
|
@@ -1477,7 +1494,7 @@ class ObserveScrollStateDirective {
|
|
|
1477
1494
|
!elementCanScroll(this._elementRef.nativeElement)) {
|
|
1478
1495
|
this._unobserveChild('first');
|
|
1479
1496
|
this._unobserveChild('last');
|
|
1480
|
-
this.
|
|
1497
|
+
this.valueChange.emit({
|
|
1481
1498
|
isAtStart: true,
|
|
1482
1499
|
isAtEnd: true,
|
|
1483
1500
|
canScroll: false,
|
|
@@ -1494,7 +1511,7 @@ class ObserveScrollStateDirective {
|
|
|
1494
1511
|
const { first, last } = this._observedChildren;
|
|
1495
1512
|
const isAtStart = entries.find((entry) => entry.target === first)?.isIntersecting ?? false;
|
|
1496
1513
|
const isAtEnd = entries.find((entry) => entry.target === last)?.isIntersecting ?? false;
|
|
1497
|
-
this.
|
|
1514
|
+
this.valueChange.emit({
|
|
1498
1515
|
isAtStart,
|
|
1499
1516
|
isAtEnd,
|
|
1500
1517
|
canScroll: !isAtStart || !isAtEnd,
|
|
@@ -1539,7 +1556,7 @@ class ObserveScrollStateDirective {
|
|
|
1539
1556
|
}
|
|
1540
1557
|
}
|
|
1541
1558
|
ObserveScrollStateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ObserveScrollStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1542
|
-
ObserveScrollStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveScrollStateDirective, isStandalone: true, selector: "[etObserveScrollState]", inputs: { observerRootMargin: "observerRootMargin", observerThreshold: "observerThreshold" }, outputs: {
|
|
1559
|
+
ObserveScrollStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.4", type: ObserveScrollStateDirective, isStandalone: true, selector: "[etObserveScrollState]", inputs: { observerRootMargin: "observerRootMargin", observerThreshold: "observerThreshold" }, outputs: { valueChange: "etObserveScrollState" }, providers: [
|
|
1543
1560
|
{
|
|
1544
1561
|
provide: OBSERVE_SCROLL_STATE,
|
|
1545
1562
|
useExisting: ObserveScrollStateDirective,
|
|
@@ -1564,8 +1581,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
1564
1581
|
type: Input
|
|
1565
1582
|
}], observerThreshold: [{
|
|
1566
1583
|
type: Input
|
|
1567
|
-
}],
|
|
1568
|
-
type: Output
|
|
1584
|
+
}], valueChange: [{
|
|
1585
|
+
type: Output,
|
|
1586
|
+
args: ['etObserveScrollState']
|
|
1569
1587
|
}] } });
|
|
1570
1588
|
|
|
1571
1589
|
class RepeatDirective {
|
|
@@ -2148,5 +2166,5 @@ _a = Symbol.iterator;
|
|
|
2148
2166
|
* Generated bundle index. Do not edit.
|
|
2149
2167
|
*/
|
|
2150
2168
|
|
|
2151
|
-
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, RouterStateService, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SeoDirective, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, ViewportService, clamp, clone, createReactiveBindings, deleteCookie, elementCanScroll, equal, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isGroupMatch, isKnockoutMatch, mergeSeoConfig, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, setCookie, toArray, toArrayTrackByFn };
|
|
2169
|
+
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, RouterStateService, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SeoDirective, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, ViewportService, clamp, clone, createMediaQueryObservable, createReactiveBindings, deleteCookie, elementCanScroll, equal, getCookie, getDomain, getGroupMatchPoints, getGroupMatchScore, getKnockoutMatchScore, getMatchScoreSubLine, hasCookie, isGroupMatch, isKnockoutMatch, mergeSeoConfig, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, provideViewportConfig, routerDisableScrollTop, setCookie, toArray, toArrayTrackByFn };
|
|
2152
2170
|
//# sourceMappingURL=ethlete-core.mjs.map
|