@ethlete/core 0.2.0-next.3 → 0.2.0-next.5

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.
Files changed (52) hide show
  1. package/esm2020/lib/directives/click-outside/click-outside.directive.mjs +37 -0
  2. package/esm2020/lib/directives/click-outside/public-api.mjs +2 -0
  3. package/esm2020/lib/directives/cursor-drag-scroll/cursor-drag-scroll.constants.mjs +3 -0
  4. package/esm2020/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.mjs +123 -0
  5. package/esm2020/lib/directives/cursor-drag-scroll/public-api.mjs +2 -0
  6. package/esm2020/lib/directives/let/let.directive.mjs +3 -3
  7. package/esm2020/lib/directives/observe-content/observe-content.directive.mjs +3 -3
  8. package/esm2020/lib/directives/observe-resize/observe-resize.directive.mjs +3 -3
  9. package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.constants.mjs +3 -0
  10. package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.directive.mjs +156 -0
  11. package/esm2020/lib/directives/observe-scroll-state/observe-scroll-state.types.mjs +2 -0
  12. package/esm2020/lib/directives/observe-scroll-state/public-api.mjs +3 -0
  13. package/esm2020/lib/directives/public-api.mjs +5 -1
  14. package/esm2020/lib/directives/repeat/repeat.directive.mjs +3 -3
  15. package/esm2020/lib/directives/scroll-observer-ignore-target/index.mjs +2 -0
  16. package/esm2020/lib/directives/scroll-observer-ignore-target/public-api.mjs +2 -0
  17. package/esm2020/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.mjs +18 -0
  18. package/esm2020/lib/pipes/to-array/to-array.pipe.mjs +3 -3
  19. package/esm2020/lib/services/click-observer.service.mjs +73 -0
  20. package/esm2020/lib/services/content-observer.service.mjs +6 -6
  21. package/esm2020/lib/services/destroy.service.mjs +24 -0
  22. package/esm2020/lib/services/focus-visible.service.mjs +3 -3
  23. package/esm2020/lib/services/public-api.mjs +3 -1
  24. package/esm2020/lib/services/resize-observer.service.mjs +6 -6
  25. package/esm2020/lib/services/viewport.service.mjs +3 -3
  26. package/esm2020/lib/utils/index.mjs +2 -0
  27. package/esm2020/lib/utils/public-api.mjs +2 -1
  28. package/esm2020/lib/utils/scrollable.utils.mjs +5 -0
  29. package/fesm2015/ethlete-core.mjs +466 -43
  30. package/fesm2015/ethlete-core.mjs.map +1 -1
  31. package/fesm2020/ethlete-core.mjs +458 -43
  32. package/fesm2020/ethlete-core.mjs.map +1 -1
  33. package/lib/directives/click-outside/click-outside.directive.d.ts +12 -0
  34. package/lib/directives/click-outside/public-api.d.ts +1 -0
  35. package/lib/directives/cursor-drag-scroll/cursor-drag-scroll.constants.d.ts +2 -0
  36. package/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.d.ts +21 -0
  37. package/lib/directives/cursor-drag-scroll/public-api.d.ts +1 -0
  38. package/lib/directives/observe-scroll-state/observe-scroll-state.constants.d.ts +3 -0
  39. package/lib/directives/observe-scroll-state/observe-scroll-state.directive.d.ts +31 -0
  40. package/lib/directives/observe-scroll-state/observe-scroll-state.types.d.ts +6 -0
  41. package/lib/directives/observe-scroll-state/public-api.d.ts +3 -0
  42. package/lib/directives/public-api.d.ts +4 -0
  43. package/lib/directives/scroll-observer-ignore-target/index.d.ts +1 -0
  44. package/lib/directives/scroll-observer-ignore-target/public-api.d.ts +1 -0
  45. package/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.d.ts +6 -0
  46. package/lib/services/click-observer.service.d.ts +21 -0
  47. package/lib/services/destroy.service.d.ts +9 -0
  48. package/lib/services/public-api.d.ts +2 -0
  49. package/lib/utils/index.d.ts +1 -0
  50. package/lib/utils/public-api.d.ts +1 -0
  51. package/lib/utils/scrollable.utils.d.ts +1 -0
  52. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Directive, Input, Injectable, Inject, Optional, inject, ElementRef, NgZone, EventEmitter, Output, Pipe } from '@angular/core';
3
3
  import { coerceNumberProperty, coerceElement, coerceBooleanProperty } from '@angular/cdk/coercion';
4
- import { BehaviorSubject, combineLatest, map, shareReplay, Observable, Subject, debounceTime } from 'rxjs';
4
+ import { BehaviorSubject, combineLatest, map, shareReplay, Observable, Subject, fromEvent, debounceTime, tap, takeUntil, take } from 'rxjs';
5
5
  import { __decorate, __metadata } from 'tslib';
6
6
  import * as i1 from '@angular/cdk/layout';
7
7
  import { DOCUMENT } from '@angular/common';
@@ -84,9 +84,9 @@ class LetDirective {
84
84
  }
85
85
  }
86
86
  }
87
- LetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: LetDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
88
- LetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: LetDirective, isStandalone: true, selector: "[etLet]", inputs: { etLet: "etLet" }, ngImport: i0 });
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: LetDirective, decorators: [{
87
+ LetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: LetDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
88
+ LetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: LetDirective, isStandalone: true, selector: "[etLet]", inputs: { etLet: "etLet" }, ngImport: i0 });
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: LetDirective, decorators: [{
90
90
  type: Directive,
91
91
  args: [{
92
92
  selector: '[etLet]',
@@ -117,9 +117,9 @@ class RepeatDirective {
117
117
  }
118
118
  }
119
119
  }
120
- RepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: RepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
121
- RepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: RepeatDirective, isStandalone: true, selector: "[etRepeat]", inputs: { repeatCount: ["etRepeat", "repeatCount"] }, ngImport: i0 });
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: RepeatDirective, decorators: [{
120
+ RepeatDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: RepeatDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
121
+ RepeatDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: RepeatDirective, isStandalone: true, selector: "[etRepeat]", inputs: { repeatCount: ["etRepeat", "repeatCount"] }, ngImport: i0 });
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: RepeatDirective, decorators: [{
123
123
  type: Directive,
124
124
  args: [{
125
125
  selector: '[etRepeat]',
@@ -260,8 +260,8 @@ class ViewportService {
260
260
  return 'xs';
261
261
  }
262
262
  }
263
- ViewportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ViewportService, deps: [{ token: VIEWPORT_CONFIG, optional: true }, { token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
264
- ViewportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ViewportService, providedIn: 'root' });
263
+ ViewportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ViewportService, deps: [{ token: VIEWPORT_CONFIG, optional: true }, { token: i1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
264
+ ViewportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ViewportService, providedIn: 'root' });
265
265
  __decorate([
266
266
  Memo(),
267
267
  __metadata("design:type", Function),
@@ -279,7 +279,7 @@ __decorate([
279
279
  __metadata("design:paramtypes", [Object]),
280
280
  __metadata("design:returntype", void 0)
281
281
  ], ViewportService.prototype, "_buildMediaQuery", null);
282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ViewportService, decorators: [{
282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ViewportService, decorators: [{
283
283
  type: Injectable,
284
284
  args: [{
285
285
  providedIn: 'root',
@@ -315,9 +315,9 @@ class FocusVisibleService {
315
315
  this._hadKeyboardEvent = false;
316
316
  }
317
317
  }
318
- FocusVisibleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: FocusVisibleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
319
- FocusVisibleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: FocusVisibleService, providedIn: 'root' });
320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: FocusVisibleService, decorators: [{
318
+ FocusVisibleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FocusVisibleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
319
+ FocusVisibleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FocusVisibleService, providedIn: 'root' });
320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FocusVisibleService, decorators: [{
321
321
  type: Injectable,
322
322
  args: [{
323
323
  providedIn: 'root',
@@ -330,9 +330,9 @@ class ResizeObserverFactory {
330
330
  return typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(callback);
331
331
  }
332
332
  }
333
- ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
334
- ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverFactory, decorators: [{
333
+ ResizeObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ResizeObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
334
+ ResizeObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ResizeObserverFactory, providedIn: 'root' });
335
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ResizeObserverFactory, decorators: [{
336
336
  type: Injectable,
337
337
  args: [{ providedIn: 'root' }]
338
338
  }] });
@@ -388,9 +388,9 @@ class ResizeObserverService {
388
388
  }
389
389
  }
390
390
  }
391
- ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
392
- ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ResizeObserverService, decorators: [{
391
+ ResizeObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ResizeObserverService, deps: [{ token: ResizeObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
392
+ ResizeObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ResizeObserverService, providedIn: 'root' });
393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ResizeObserverService, decorators: [{
394
394
  type: Injectable,
395
395
  args: [{ providedIn: 'root' }]
396
396
  }], ctorParameters: function () { return [{ type: ResizeObserverFactory }]; } });
@@ -401,9 +401,9 @@ class MutationObserverFactory {
401
401
  return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);
402
402
  }
403
403
  }
404
- MutationObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MutationObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
405
- MutationObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MutationObserverFactory, providedIn: 'root' });
406
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: MutationObserverFactory, decorators: [{
404
+ MutationObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MutationObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
405
+ MutationObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MutationObserverFactory, providedIn: 'root' });
406
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: MutationObserverFactory, decorators: [{
407
407
  type: Injectable,
408
408
  args: [{ providedIn: 'root' }]
409
409
  }] });
@@ -463,13 +463,103 @@ class ContentObserverService {
463
463
  }
464
464
  }
465
465
  }
466
- ContentObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ContentObserverService, deps: [{ token: MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
467
- ContentObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ContentObserverService, providedIn: 'root' });
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ContentObserverService, decorators: [{
466
+ ContentObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ContentObserverService, deps: [{ token: MutationObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
467
+ ContentObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ContentObserverService, providedIn: 'root' });
468
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ContentObserverService, decorators: [{
469
469
  type: Injectable,
470
470
  args: [{ providedIn: 'root' }]
471
471
  }], ctorParameters: function () { return [{ type: MutationObserverFactory }]; } });
472
472
 
473
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
474
+ class ClickObserverFactory {
475
+ create() {
476
+ return fromEvent(document, 'click');
477
+ }
478
+ }
479
+ ClickObserverFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickObserverFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
480
+ ClickObserverFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickObserverFactory, providedIn: 'root' });
481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickObserverFactory, decorators: [{
482
+ type: Injectable,
483
+ args: [{ providedIn: 'root' }]
484
+ }] });
485
+ class ClickObserverService {
486
+ constructor(_clickObserverFactory) {
487
+ this._clickObserverFactory = _clickObserverFactory;
488
+ this._observedElements = new Map();
489
+ }
490
+ ngOnDestroy() {
491
+ this._observedElements.forEach((_, element) => this._cleanupObserver(element));
492
+ }
493
+ observe(elementOrRef) {
494
+ const element = coerceElement(elementOrRef);
495
+ return new Observable((observer) => {
496
+ const stream = this._observeElement(element);
497
+ const subscription = stream.subscribe(observer);
498
+ return () => {
499
+ subscription.unsubscribe();
500
+ this._unobserveElement(element);
501
+ };
502
+ });
503
+ }
504
+ _observeElement(element) {
505
+ if (!this._observedElements.has(element)) {
506
+ const stream = new Subject();
507
+ const observer = this._clickObserverFactory.create();
508
+ const sub = observer.subscribe((event) => stream.next(event));
509
+ this._observedElements.set(element, { observer: sub, stream, count: 1 });
510
+ }
511
+ else {
512
+ this._observedElements.get(element).count++;
513
+ }
514
+ return this._observedElements.get(element).stream;
515
+ }
516
+ _unobserveElement(element) {
517
+ if (this._observedElements.has(element)) {
518
+ this._observedElements.get(element).count--;
519
+ if (!this._observedElements.get(element).count) {
520
+ this._cleanupObserver(element);
521
+ }
522
+ }
523
+ }
524
+ _cleanupObserver(element) {
525
+ if (this._observedElements.has(element)) {
526
+ const { observer, stream } = this._observedElements.get(element);
527
+ if (observer) {
528
+ observer.unsubscribe();
529
+ }
530
+ stream.complete();
531
+ this._observedElements.delete(element);
532
+ }
533
+ }
534
+ }
535
+ ClickObserverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickObserverService, deps: [{ token: ClickObserverFactory }], target: i0.ɵɵFactoryTarget.Injectable });
536
+ ClickObserverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickObserverService, providedIn: 'root' });
537
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickObserverService, decorators: [{
538
+ type: Injectable,
539
+ args: [{ providedIn: 'root' }]
540
+ }], ctorParameters: function () { return [{ type: ClickObserverFactory }]; } });
541
+
542
+ class DestroyService {
543
+ constructor() {
544
+ this._destroy$ = new Subject();
545
+ }
546
+ get destroy$() {
547
+ return this._destroy$.asObservable();
548
+ }
549
+ ngOnDestroy() {
550
+ this._destroy$.next(true);
551
+ this._destroy$.unsubscribe();
552
+ }
553
+ }
554
+ DestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DestroyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
555
+ DestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DestroyService, providedIn: 'any' });
556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: DestroyService, decorators: [{
557
+ type: Injectable,
558
+ args: [{
559
+ providedIn: 'any',
560
+ }]
561
+ }] });
562
+
473
563
  class ObserveResizeDirective {
474
564
  constructor() {
475
565
  this._resizeObserver = inject(ResizeObserverService);
@@ -514,9 +604,9 @@ class ObserveResizeDirective {
514
604
  (_a = this._currentSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
515
605
  }
516
606
  }
517
- ObserveResizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveResizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
518
- ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: { event: "etObserveResize" }, exportAs: ["etObserveResize"], ngImport: i0 });
519
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveResizeDirective, decorators: [{
607
+ ObserveResizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ObserveResizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
608
+ ObserveResizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: ObserveResizeDirective, isStandalone: true, selector: "[etObserveResize]", inputs: { disabled: ["etObserveResizeDisabled", "disabled"], debounce: ["etObserveResizeDebounce", "debounce"] }, outputs: { event: "etObserveResize" }, exportAs: ["etObserveResize"], ngImport: i0 });
609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ObserveResizeDirective, decorators: [{
520
610
  type: Directive,
521
611
  args: [{
522
612
  selector: '[etObserveResize]',
@@ -578,9 +668,9 @@ class ObserveContentDirective {
578
668
  (_a = this._currentSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
579
669
  }
580
670
  }
581
- ObserveContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
582
- ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: ObserveContentDirective, isStandalone: true, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: { event: "etObserveContent" }, exportAs: ["etObserveContent"], ngImport: i0 });
583
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ObserveContentDirective, decorators: [{
671
+ ObserveContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ObserveContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
672
+ ObserveContentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: ObserveContentDirective, isStandalone: true, selector: "[etObserveContent]", inputs: { disabled: ["etObserveContentDisabled", "disabled"], debounce: ["etObserveContentDebounce", "debounce"] }, outputs: { event: "etObserveContent" }, exportAs: ["etObserveContent"], ngImport: i0 });
673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ObserveContentDirective, decorators: [{
584
674
  type: Directive,
585
675
  args: [{
586
676
  selector: '[etObserveContent]',
@@ -598,6 +688,347 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImpor
598
688
  args: ['etObserveContentDebounce']
599
689
  }] } });
600
690
 
691
+ class ClickOutsideDirective {
692
+ constructor() {
693
+ this._elementRef = inject(ElementRef);
694
+ this._clickObserverService = inject(ClickObserverService);
695
+ this._subscription = null;
696
+ this.etClickOutside = new EventEmitter();
697
+ }
698
+ ngOnInit() {
699
+ setTimeout(() => {
700
+ this._subscription = this._clickObserverService.observe(this._elementRef.nativeElement).subscribe((event) => {
701
+ const activeElement = event.target;
702
+ const isInside = this._elementRef.nativeElement.contains(activeElement);
703
+ if (!isInside) {
704
+ this.etClickOutside.emit(event);
705
+ }
706
+ });
707
+ });
708
+ }
709
+ ngOnDestroy() {
710
+ var _a;
711
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
712
+ }
713
+ }
714
+ ClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
715
+ ClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: ClickOutsideDirective, isStandalone: true, selector: "[etClickOutside]", outputs: { etClickOutside: "etClickOutside" }, ngImport: i0 });
716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ClickOutsideDirective, decorators: [{
717
+ type: Directive,
718
+ args: [{
719
+ selector: '[etClickOutside]',
720
+ standalone: true,
721
+ }]
722
+ }], propDecorators: { etClickOutside: [{
723
+ type: Output
724
+ }] } });
725
+
726
+ const OBSERVE_SCROLL_STATE = new InjectionToken('OBSERVE_SCROLL_STATE');
727
+
728
+ const SCROLL_OBSERVER_IGNORE_TARGET_CLASS = 'et-scroll-observer-ignore-target';
729
+ class ScrollObserverIgnoreTargetDirective {
730
+ }
731
+ ScrollObserverIgnoreTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ScrollObserverIgnoreTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
732
+ ScrollObserverIgnoreTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: ScrollObserverIgnoreTargetDirective, isStandalone: true, selector: "[etScrollObserverIgnoreTarget]", host: { classAttribute: "et-scroll-observer-ignore-target" }, ngImport: i0 });
733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ScrollObserverIgnoreTargetDirective, decorators: [{
734
+ type: Directive,
735
+ args: [{
736
+ selector: '[etScrollObserverIgnoreTarget]',
737
+ standalone: true,
738
+ host: {
739
+ class: SCROLL_OBSERVER_IGNORE_TARGET_CLASS,
740
+ },
741
+ }]
742
+ }] });
743
+
744
+ const provideViewportConfig = (viewportConfig) => {
745
+ return { provide: VIEWPORT_CONFIG, useValue: viewportConfig };
746
+ };
747
+
748
+ const clamp = (value, min = 0, max = 100) => {
749
+ return Math.max(min, Math.min(max, value));
750
+ };
751
+
752
+ const elementCanScroll = (element) => {
753
+ const { scrollHeight, clientHeight, scrollWidth, clientWidth } = element;
754
+ return scrollHeight > clientHeight || scrollWidth > clientWidth;
755
+ };
756
+
757
+ class ObserveScrollStateDirective {
758
+ constructor() {
759
+ this._destroy$ = inject(DestroyService).destroy$;
760
+ this._elementRef = inject(ElementRef);
761
+ this._contentObserverService = inject(ContentObserverService);
762
+ this._resizeObserverService = inject(ResizeObserverService);
763
+ this._observedChildren = {
764
+ first: this._firstCurrentChild,
765
+ last: this._lastCurrentChild,
766
+ };
767
+ this._rootMargin = 0;
768
+ this._threshold = 1;
769
+ this._intersectionObserver = null;
770
+ this.etObserveScrollState = new EventEmitter();
771
+ }
772
+ get _firstCurrentChild() {
773
+ const element = this._elementRef.nativeElement.querySelector(`:first-child`);
774
+ return this._getNonIgnoredChild(element, 'next');
775
+ }
776
+ get _lastCurrentChild() {
777
+ const element = this._elementRef.nativeElement.querySelector(`:last-child`);
778
+ return this._getNonIgnoredChild(element, 'previous');
779
+ }
780
+ get observerRootMargin() {
781
+ return this._rootMargin;
782
+ }
783
+ set observerRootMargin(value) {
784
+ this._rootMargin = coerceNumberProperty(value);
785
+ }
786
+ get observerThreshold() {
787
+ return this._threshold;
788
+ }
789
+ set observerThreshold(value) {
790
+ this._threshold = coerceNumberProperty(value);
791
+ }
792
+ ngOnInit() {
793
+ this._contentObserverService
794
+ .observe(this._elementRef.nativeElement)
795
+ .pipe(tap(() => this._checkChildren()), takeUntil(this._destroy$))
796
+ .subscribe();
797
+ this._resizeObserverService
798
+ .observe(this._elementRef.nativeElement)
799
+ .pipe(debounceTime(25), tap(() => {
800
+ if (!this._intersectionObserver && elementCanScroll(this._elementRef.nativeElement)) {
801
+ this._checkChildren();
802
+ }
803
+ }), takeUntil(this._destroy$))
804
+ .subscribe();
805
+ this._checkChildren();
806
+ }
807
+ ngOnDestroy() {
808
+ this._clearIntersectionObserver();
809
+ }
810
+ _checkChildren() {
811
+ this._clearIntersectionObserver();
812
+ if (this._firstCurrentChild === this._lastCurrentChild ||
813
+ !this._firstCurrentChild ||
814
+ !this._lastCurrentChild ||
815
+ !elementCanScroll(this._elementRef.nativeElement)) {
816
+ this._unobserveChild('first');
817
+ this._unobserveChild('last');
818
+ this.etObserveScrollState.emit({
819
+ isAtStart: true,
820
+ isAtEnd: true,
821
+ canScroll: false,
822
+ });
823
+ }
824
+ else {
825
+ this._intersectionObserver = this._initiateIntersectionObserver();
826
+ this._observeChild('first', this._firstCurrentChild);
827
+ this._observeChild('last', this._lastCurrentChild);
828
+ }
829
+ }
830
+ _initiateIntersectionObserver() {
831
+ const observer = new IntersectionObserver((entries) => {
832
+ var _a, _b, _c, _d;
833
+ const { first, last } = this._observedChildren;
834
+ const isAtStart = (_b = (_a = entries.find((entry) => entry.target === first)) === null || _a === void 0 ? void 0 : _a.isIntersecting) !== null && _b !== void 0 ? _b : false;
835
+ const isAtEnd = (_d = (_c = entries.find((entry) => entry.target === last)) === null || _c === void 0 ? void 0 : _c.isIntersecting) !== null && _d !== void 0 ? _d : false;
836
+ this.etObserveScrollState.emit({
837
+ isAtStart,
838
+ isAtEnd,
839
+ canScroll: !isAtStart || !isAtEnd,
840
+ });
841
+ }, {
842
+ root: this._elementRef.nativeElement,
843
+ rootMargin: `${this._rootMargin}px`,
844
+ threshold: this._threshold,
845
+ });
846
+ return observer;
847
+ }
848
+ _observeChild(child, element) {
849
+ var _a;
850
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.observe(element);
851
+ this._observedChildren[child] = element;
852
+ }
853
+ _unobserveChild(child) {
854
+ var _a;
855
+ const observedChild = this._observedChildren[child];
856
+ if (!observedChild) {
857
+ return;
858
+ }
859
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.unobserve(observedChild);
860
+ this._observedChildren[child] = null;
861
+ }
862
+ _clearIntersectionObserver() {
863
+ var _a;
864
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
865
+ this._intersectionObserver = null;
866
+ }
867
+ _getNonIgnoredChild(element, direction) {
868
+ if (!element) {
869
+ return null;
870
+ }
871
+ if (element === null || element === void 0 ? void 0 : element.classList.contains(SCROLL_OBSERVER_IGNORE_TARGET_CLASS)) {
872
+ const nextElement = element[`${direction}ElementSibling`];
873
+ if (!nextElement) {
874
+ return null;
875
+ }
876
+ return this._getNonIgnoredChild(nextElement, direction);
877
+ }
878
+ return element;
879
+ }
880
+ }
881
+ ObserveScrollStateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ObserveScrollStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
882
+ ObserveScrollStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: ObserveScrollStateDirective, isStandalone: true, selector: "[etObserveScrollState]", inputs: { observerRootMargin: "observerRootMargin", observerThreshold: "observerThreshold" }, outputs: { etObserveScrollState: "etObserveScrollState" }, providers: [
883
+ {
884
+ provide: OBSERVE_SCROLL_STATE,
885
+ useExisting: ObserveScrollStateDirective,
886
+ },
887
+ ], exportAs: ["etObserveScrollState"], ngImport: i0 });
888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ObserveScrollStateDirective, decorators: [{
889
+ type: Directive,
890
+ args: [{
891
+ selector: '[etObserveScrollState]',
892
+ exportAs: 'etObserveScrollState',
893
+ standalone: true,
894
+ providers: [
895
+ {
896
+ provide: OBSERVE_SCROLL_STATE,
897
+ useExisting: ObserveScrollStateDirective,
898
+ },
899
+ ],
900
+ }]
901
+ }], propDecorators: { observerRootMargin: [{
902
+ type: Input
903
+ }], observerThreshold: [{
904
+ type: Input
905
+ }], etObserveScrollState: [{
906
+ type: Output
907
+ }] } });
908
+
909
+ const CURSOR_DRAG_SCROLLING_CLASS = 'et-cursor-drag-scroll--scrolling';
910
+ const CURSOR_DRAG_SCROLLING_PREPARED_CLASS = 'et-cursor-drag-scroll--prepared';
911
+
912
+ class CursorDragScrollDirective {
913
+ constructor() {
914
+ this._destroy$ = inject(DestroyService).destroy$;
915
+ this._elementRef = inject(ElementRef);
916
+ this._contentObserverService = inject(ContentObserverService);
917
+ this._resizeObserverService = inject(ResizeObserverService);
918
+ this._bufferUntilScroll = 5;
919
+ this._mouseUp$ = new Subject();
920
+ this._isScrolling = false;
921
+ this._canScroll = false;
922
+ this._currentScrollState = {
923
+ top: 0,
924
+ left: 0,
925
+ x: 0,
926
+ y: 0,
927
+ };
928
+ }
929
+ ngAfterViewInit() {
930
+ combineLatest([
931
+ this._contentObserverService.observe(this._elementRef.nativeElement),
932
+ this._resizeObserverService.observe(this._elementRef.nativeElement),
933
+ ])
934
+ .pipe(tap(() => this._updateCanScrollState()), takeUntil(this._destroy$))
935
+ .subscribe();
936
+ fromEvent(this._elementRef.nativeElement, 'mousedown')
937
+ .pipe(tap((e) => this._onMouseDown(e)), takeUntil(this._destroy$))
938
+ .subscribe();
939
+ this._updateCanScrollState();
940
+ }
941
+ _onMouseDown(e) {
942
+ var _a;
943
+ if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement) || !this._canScroll) {
944
+ return;
945
+ }
946
+ const element = this._elementRef.nativeElement;
947
+ element.classList.add(CURSOR_DRAG_SCROLLING_PREPARED_CLASS);
948
+ this._elementRef.nativeElement.style.scrollSnapType = 'none';
949
+ this._elementRef.nativeElement.style.scrollBehavior = 'unset';
950
+ this._currentScrollState = {
951
+ left: this._elementRef.nativeElement.scrollLeft,
952
+ top: this._elementRef.nativeElement.scrollTop,
953
+ x: e.clientX,
954
+ y: e.clientY,
955
+ };
956
+ fromEvent(document, 'mousemove')
957
+ .pipe(tap((e) => this._mouseMoveHandler(e)), takeUntil(this._mouseUp$), takeUntil(this._destroy$))
958
+ .subscribe();
959
+ fromEvent(document, 'mouseup')
960
+ .pipe(tap(() => this._mouseUpHandler()), take(1), takeUntil(this._destroy$))
961
+ .subscribe();
962
+ }
963
+ _mouseMoveHandler(e) {
964
+ var _a;
965
+ e.preventDefault();
966
+ if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
967
+ return;
968
+ }
969
+ const dx = e.clientX - this._currentScrollState.x;
970
+ const dy = e.clientY - this._currentScrollState.y;
971
+ if (Math.abs(dx) > this._bufferUntilScroll || Math.abs(dy) > this._bufferUntilScroll) {
972
+ const element = this._elementRef.nativeElement;
973
+ if (!this._isScrolling) {
974
+ this._isScrolling = true;
975
+ element.style.cursor = 'grabbing';
976
+ element.classList.add(CURSOR_DRAG_SCROLLING_CLASS);
977
+ element.scroll({
978
+ top: this._currentScrollState.top - dy,
979
+ left: this._currentScrollState.left - dx,
980
+ behavior: 'smooth',
981
+ });
982
+ }
983
+ else {
984
+ element.scrollTop = this._currentScrollState.top - dy;
985
+ element.scrollLeft = this._currentScrollState.left - dx;
986
+ }
987
+ }
988
+ }
989
+ _mouseUpHandler() {
990
+ var _a;
991
+ this._mouseUp$.next(true);
992
+ this._isScrolling = false;
993
+ if (!((_a = this._elementRef) === null || _a === void 0 ? void 0 : _a.nativeElement)) {
994
+ return;
995
+ }
996
+ this._elementRef.nativeElement.style.scrollSnapType = '';
997
+ this._elementRef.nativeElement.style.scrollBehavior = '';
998
+ this._elementRef.nativeElement.style.cursor = 'grab';
999
+ this._elementRef.nativeElement.classList.remove(CURSOR_DRAG_SCROLLING_CLASS);
1000
+ this._elementRef.nativeElement.classList.remove(CURSOR_DRAG_SCROLLING_PREPARED_CLASS);
1001
+ }
1002
+ _updateCanScrollState() {
1003
+ this._canScroll = elementCanScroll(this._elementRef.nativeElement);
1004
+ if (this._canScroll) {
1005
+ this._elementRef.nativeElement.style.cursor = 'grab';
1006
+ }
1007
+ else {
1008
+ this._elementRef.nativeElement.style.cursor = 'default';
1009
+ }
1010
+ }
1011
+ _checkCanScroll() {
1012
+ if (this._elementRef.nativeElement.scrollWidth > this._elementRef.nativeElement.clientWidth) {
1013
+ return true;
1014
+ }
1015
+ if (this._elementRef.nativeElement.scrollHeight > this._elementRef.nativeElement.clientHeight) {
1016
+ return true;
1017
+ }
1018
+ return false;
1019
+ }
1020
+ }
1021
+ CursorDragScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: CursorDragScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1022
+ CursorDragScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: CursorDragScrollDirective, isStandalone: true, selector: "[etCursorDragScroll]", exportAs: ["etCursorDragScroll"], ngImport: i0 });
1023
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: CursorDragScrollDirective, decorators: [{
1024
+ type: Directive,
1025
+ args: [{
1026
+ selector: '[etCursorDragScroll]',
1027
+ exportAs: 'etCursorDragScroll',
1028
+ standalone: true,
1029
+ }]
1030
+ }] });
1031
+
601
1032
  const toArray = (value) => {
602
1033
  return Array.from({ length: value }, (_, i) => i);
603
1034
  };
@@ -608,24 +1039,16 @@ class ToArrayPipe {
608
1039
  this.transform = toArray;
609
1040
  }
610
1041
  }
611
- ToArrayPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ToArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
612
- ToArrayPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.7", ngImport: i0, type: ToArrayPipe, isStandalone: true, name: "toArray" });
613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: ToArrayPipe, decorators: [{
1042
+ ToArrayPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ToArrayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1043
+ ToArrayPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: ToArrayPipe, isStandalone: true, name: "toArray" });
1044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ToArrayPipe, decorators: [{
614
1045
  type: Pipe,
615
1046
  args: [{ name: 'toArray', standalone: true }]
616
1047
  }] });
617
1048
 
618
- const provideViewportConfig = (viewportConfig) => {
619
- return { provide: VIEWPORT_CONFIG, useValue: viewportConfig };
620
- };
621
-
622
- const clamp = (value, min = 0, max = 100) => {
623
- return Math.max(min, Math.min(max, value));
624
- };
625
-
626
1049
  /**
627
1050
  * Generated bundle index. Do not edit.
628
1051
  */
629
1052
 
630
- export { ContentObserverService, DEFAULT_VIEWPORT_CONFIG, FocusVisibleService, LetContext, LetDirective, Memo, MutationObserverFactory, ObserveContentDirective, ObserveResizeDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, ToArrayPipe, VIEWPORT_CONFIG, ViewportService, clamp, provideViewportConfig, toArray, toArrayTrackByFn };
1053
+ export { ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEFAULT_VIEWPORT_CONFIG, DestroyService, FocusVisibleService, LetContext, LetDirective, Memo, MutationObserverFactory, OBSERVE_SCROLL_STATE, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, RepeatDirective, ResizeObserverFactory, ResizeObserverService, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, ScrollObserverIgnoreTargetDirective, ToArrayPipe, VIEWPORT_CONFIG, ViewportService, clamp, elementCanScroll, provideViewportConfig, toArray, toArrayTrackByFn };
631
1054
  //# sourceMappingURL=ethlete-core.mjs.map