@skyux/core 15.0.0-alpha.2 → 15.0.0-alpha.4
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/fesm2022/skyux-core.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { NgModule, Injectable, inject, RendererFactory2, NgZone, DOCUMENT, EventEmitter, ElementRef, Output, Input, Directive, effect, untracked, input, booleanAttribute, output, DestroyRef, signal, computed, ChangeDetectionStrategy, Component, provideEnvironmentInitializer, EnvironmentInjector, createEnvironmentInjector, createComponent, ChangeDetectorRef, ViewContainerRef, ViewChild, InjectionToken, Renderer2, Optional, Inject, ApplicationRef, afterNextRender, Injector, Pipe, HostBinding, HostListener } from '@angular/core';
|
|
3
|
-
import { Subject, Subscription, ReplaySubject, fromEvent, of, Observable, filter, map, distinctUntilChanged, shareReplay, observeOn, animationFrameScheduler, takeUntil as takeUntil$1, BehaviorSubject, combineLatestWith, switchMap, merge, debounceTime as debounceTime$1 } from 'rxjs';
|
|
3
|
+
import { Subject, Subscription, ReplaySubject, fromEvent, of, Observable, filter, map, distinctUntilChanged, shareReplay, observeOn, animationFrameScheduler, takeUntil as takeUntil$1, BehaviorSubject, isObservable, combineLatest, combineLatestWith, switchMap, merge, debounceTime as debounceTime$1 } from 'rxjs';
|
|
4
4
|
import { takeUntil, debounceTime, take } from 'rxjs/operators';
|
|
5
5
|
import { ViewportRuler } from '@angular/cdk/overlay';
|
|
6
6
|
import * as i1$1 from '@angular/common';
|
|
@@ -4159,6 +4159,19 @@ function notifySubscribers(subscribers, item) {
|
|
|
4159
4159
|
subscriber.next(item);
|
|
4160
4160
|
}
|
|
4161
4161
|
}
|
|
4162
|
+
/**
|
|
4163
|
+
* Reduces `current` against the given `containerEdge` of each container's bounding rect,
|
|
4164
|
+
* skipping containers with no size in the given `dimension`.
|
|
4165
|
+
*/
|
|
4166
|
+
function maskEdge(current, containers, dimension, containerEdge, combine) {
|
|
4167
|
+
let result = current;
|
|
4168
|
+
for (const container of containers) {
|
|
4169
|
+
if (container.nativeElement?.[dimension]) {
|
|
4170
|
+
result = combine(result, container.nativeElement.getBoundingClientRect()[containerEdge]);
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
return result;
|
|
4174
|
+
}
|
|
4162
4175
|
class SkyScrollableHostService {
|
|
4163
4176
|
#mutationObserverSvc;
|
|
4164
4177
|
#windowRef;
|
|
@@ -4283,15 +4296,27 @@ class SkyScrollableHostService {
|
|
|
4283
4296
|
});
|
|
4284
4297
|
});
|
|
4285
4298
|
}
|
|
4286
|
-
watchScrollableHostClipPathChanges(elementRef,
|
|
4299
|
+
watchScrollableHostClipPathChanges(elementRef, options = of([])) {
|
|
4287
4300
|
if (!this.#resizeObserverSvc) {
|
|
4288
4301
|
return of('none');
|
|
4289
4302
|
}
|
|
4290
|
-
const
|
|
4303
|
+
const normalizedOptions = isObservable(options)
|
|
4304
|
+
? { additionalContainers: options }
|
|
4305
|
+
: options;
|
|
4306
|
+
const additionalContainers = normalizedOptions.additionalContainers ?? of([]);
|
|
4307
|
+
const additionalMaskingObj = normalizedOptions.additionalMasking ?? {};
|
|
4308
|
+
const hasAdditionalMasking = Object.keys(additionalMaskingObj).length > 0;
|
|
4309
|
+
// `combineLatestWith` never emits if any source completes without emitting,
|
|
4310
|
+
// so fall back to a single empty emission instead of `EMPTY` when there's nothing to mask.
|
|
4311
|
+
const additionalMasking = hasAdditionalMasking
|
|
4312
|
+
? combineLatest(additionalMaskingObj)
|
|
4313
|
+
: of({});
|
|
4314
|
+
const watch = () => this.watchScrollableHost(elementRef).pipe(combineLatestWith(additionalContainers, additionalMasking), switchMap(([scrollableHost, additionalHosts, additionalMasks]) => {
|
|
4291
4315
|
const resizeObserverSvc = this.#resizeObserverSvc;
|
|
4292
4316
|
if (!resizeObserverSvc ||
|
|
4293
4317
|
((!scrollableHost ||
|
|
4294
4318
|
scrollableHost === this.#windowRef.nativeWindow) &&
|
|
4319
|
+
Object.values(additionalMasks).flat().length === 0 &&
|
|
4295
4320
|
additionalHosts.length === 0)) {
|
|
4296
4321
|
return of('none');
|
|
4297
4322
|
}
|
|
@@ -4303,6 +4328,9 @@ class SkyScrollableHostService {
|
|
|
4303
4328
|
fromEvent(this.#windowRef.nativeWindow, 'resize'),
|
|
4304
4329
|
fromEvent(this.#windowRef.nativeWindow, 'scroll'),
|
|
4305
4330
|
...additionalHosts.map((container) => resizeObserverSvc.observe(container)),
|
|
4331
|
+
...Object.values(additionalMasks)
|
|
4332
|
+
.flat()
|
|
4333
|
+
.map((container) => resizeObserverSvc.observe(container)),
|
|
4306
4334
|
fromEvent(hostsParents, 'scroll'),
|
|
4307
4335
|
...hostsParents.map((hostsParent) => resizeObserverSvc.observe({
|
|
4308
4336
|
nativeElement: hostsParent,
|
|
@@ -4334,11 +4362,15 @@ class SkyScrollableHostService {
|
|
|
4334
4362
|
bottom = Math.min(bottom, containerRect.bottom);
|
|
4335
4363
|
}
|
|
4336
4364
|
}
|
|
4365
|
+
top = maskEdge(top, additionalMasks.top ?? [], 'offsetHeight', 'bottom', Math.max);
|
|
4366
|
+
left = maskEdge(left, additionalMasks.left ?? [], 'offsetWidth', 'right', Math.max);
|
|
4367
|
+
right = maskEdge(right, additionalMasks.right ?? [], 'offsetWidth', 'left', Math.min);
|
|
4368
|
+
bottom = maskEdge(bottom, additionalMasks.bottom ?? [], 'offsetHeight', 'top', Math.min);
|
|
4337
4369
|
top = Math.max(0, top);
|
|
4338
4370
|
left = Math.max(0, left);
|
|
4339
4371
|
return `inset(${top}px ${viewportSize.width - right}px ${viewportSize.height - bottom}px ${left}px)`;
|
|
4340
4372
|
}));
|
|
4341
|
-
}));
|
|
4373
|
+
}), distinctUntilChanged());
|
|
4342
4374
|
/* istanbul ignore else */
|
|
4343
4375
|
if (this.#zone) {
|
|
4344
4376
|
return this.#zone.runOutsideAngular(watch);
|
|
@@ -5055,7 +5087,7 @@ class Version {
|
|
|
5055
5087
|
/**
|
|
5056
5088
|
* Represents the version of @skyux/core.
|
|
5057
5089
|
*/
|
|
5058
|
-
const VERSION = new Version('15.0.0-alpha.
|
|
5090
|
+
const VERSION = new Version('15.0.0-alpha.4');
|
|
5059
5091
|
|
|
5060
5092
|
/**
|
|
5061
5093
|
* Generated bundle index. Do not edit.
|