@skyux/core 12.5.0 → 12.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/fesm2022/skyux-core.mjs
CHANGED
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
2
2
|
import { NgModule, Injectable, inject, RendererFactory2, NgZone, EventEmitter, Output, Input, Directive, EnvironmentInjector, createEnvironmentInjector, createComponent, ChangeDetectorRef, ElementRef, ViewContainerRef, ViewChild, ChangeDetectionStrategy, Component, InjectionToken, input, effect, Optional, Inject, ApplicationRef, afterNextRender, Injector, Pipe, HostBinding, Renderer2, HostListener } from '@angular/core';
|
3
3
|
import * as i1$1 from '@angular/common';
|
4
4
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
5
|
-
import { Subject, Subscription, ReplaySubject, fromEvent, of, Observable, filter, map, distinctUntilChanged, shareReplay, observeOn, animationFrameScheduler, takeUntil as takeUntil$1, BehaviorSubject, concat } from 'rxjs';
|
5
|
+
import { Subject, Subscription, ReplaySubject, fromEvent, of, Observable, filter, map, distinctUntilChanged, shareReplay, observeOn, animationFrameScheduler, takeUntil as takeUntil$1, BehaviorSubject, combineLatestWith, concat } from 'rxjs';
|
6
6
|
import { takeUntil, debounceTime, switchMap, map as map$1 } from 'rxjs/operators';
|
7
7
|
import { ViewportRuler } from '@angular/cdk/overlay';
|
8
8
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
@@ -3690,6 +3690,7 @@ class SkyScrollShadowDirective {
|
|
3690
3690
|
return this.#_enabled;
|
3691
3691
|
}
|
3692
3692
|
#currentShadow;
|
3693
|
+
#boxShadows;
|
3693
3694
|
#mutationObserver;
|
3694
3695
|
#ngUnsubscribe;
|
3695
3696
|
#elRef;
|
@@ -3743,11 +3744,83 @@ class SkyScrollShadowDirective {
|
|
3743
3744
|
});
|
3744
3745
|
}
|
3745
3746
|
}
|
3747
|
+
#splitBoxShadowDetails(boxShadow) {
|
3748
|
+
const colorRegex = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/;
|
3749
|
+
const match = boxShadow.match(colorRegex);
|
3750
|
+
if (match) {
|
3751
|
+
const colorParts = `${match[1]}, ${match[2]}, ${match[3]}`; // Extract RGB values as a comma-separated string
|
3752
|
+
const opacity = match[4] ? parseFloat(match[4]) : 1; // Use the captured opacity or default to 1
|
3753
|
+
const lengths = boxShadow.replace(match[0], '').trim(); // Remove the color from the rest
|
3754
|
+
return { colorParts, opacity, lengths };
|
3755
|
+
}
|
3756
|
+
/* istanbul ignore next */
|
3757
|
+
return;
|
3758
|
+
}
|
3759
|
+
#formatBoxShadows(boxShadowString) {
|
3760
|
+
const boxShadows = [];
|
3761
|
+
let currentShadow = '';
|
3762
|
+
let openParentheses = 0;
|
3763
|
+
for (const char of boxShadowString) {
|
3764
|
+
if (char === ',' && openParentheses === 0) {
|
3765
|
+
const details = this.#splitBoxShadowDetails(currentShadow.trim());
|
3766
|
+
if (details) {
|
3767
|
+
boxShadows.push(details);
|
3768
|
+
}
|
3769
|
+
currentShadow = '';
|
3770
|
+
}
|
3771
|
+
else {
|
3772
|
+
currentShadow += char;
|
3773
|
+
if (char === '(') {
|
3774
|
+
openParentheses++;
|
3775
|
+
}
|
3776
|
+
else if (char === ')') {
|
3777
|
+
openParentheses--;
|
3778
|
+
}
|
3779
|
+
}
|
3780
|
+
}
|
3781
|
+
if (currentShadow.trim()) {
|
3782
|
+
const details = this.#splitBoxShadowDetails(currentShadow.trim());
|
3783
|
+
if (details) {
|
3784
|
+
boxShadows.push(details);
|
3785
|
+
}
|
3786
|
+
}
|
3787
|
+
return boxShadows;
|
3788
|
+
}
|
3789
|
+
#getBoxShadowInfo() {
|
3790
|
+
const elStyles = window.getComputedStyle(this.#elRef.nativeElement);
|
3791
|
+
const boxShadowStyle = elStyles.getPropertyValue('--sky-elevation-overflow');
|
3792
|
+
// Creating a temporary element and setting box shadow converts the color in the box shadows to rgba or rgb
|
3793
|
+
const tempEl = document.createElement('div');
|
3794
|
+
tempEl.style.setProperty('box-shadow', boxShadowStyle);
|
3795
|
+
const convertedBoxShadows = tempEl.style.getPropertyValue('box-shadow');
|
3796
|
+
const boxShadows = this.#formatBoxShadows(convertedBoxShadows);
|
3797
|
+
return boxShadows;
|
3798
|
+
}
|
3746
3799
|
#buildShadowStyle(pixelsFromEnd) {
|
3747
|
-
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3800
|
+
if (!this.#boxShadows) {
|
3801
|
+
const boxShadowInfo = this.#getBoxShadowInfo();
|
3802
|
+
if (boxShadowInfo.length > 0) {
|
3803
|
+
this.#boxShadows = boxShadowInfo;
|
3804
|
+
}
|
3805
|
+
else {
|
3806
|
+
this.#boxShadows = 'none';
|
3807
|
+
}
|
3808
|
+
}
|
3809
|
+
const boxShadowStyles = [];
|
3810
|
+
if (this.#boxShadows === 'none' || pixelsFromEnd === 0) {
|
3811
|
+
return 'none';
|
3812
|
+
}
|
3813
|
+
else {
|
3814
|
+
for (const shadow of this.#boxShadows) {
|
3815
|
+
const { colorParts, lengths, opacity } = shadow;
|
3816
|
+
// Progressively darken the shadow until the user scrolls 30 pixels from the top or bottom
|
3817
|
+
// of the scrollable element, with a max opacity of 0.3.
|
3818
|
+
const adjustedOpacity = Math.min(pixelsFromEnd / 30, 1) * opacity;
|
3819
|
+
const adjustedShadow = `${lengths} rgba(${colorParts}, ${adjustedOpacity})`;
|
3820
|
+
boxShadowStyles.push(adjustedShadow);
|
3821
|
+
}
|
3822
|
+
return boxShadowStyles.join(', ');
|
3823
|
+
}
|
3751
3824
|
}
|
3752
3825
|
#emitShadow(shadow) {
|
3753
3826
|
if (!this.#currentShadow ||
|
@@ -3903,25 +3976,40 @@ class SkyScrollableHostService {
|
|
3903
3976
|
});
|
3904
3977
|
});
|
3905
3978
|
}
|
3906
|
-
watchScrollableHostClipPathChanges(elementRef) {
|
3979
|
+
watchScrollableHostClipPathChanges(elementRef, additionalContainers = of([])) {
|
3907
3980
|
if (!this.#resizeObserverSvc) {
|
3908
3981
|
return of('none');
|
3909
3982
|
}
|
3910
|
-
return this.watchScrollableHost(elementRef).pipe(switchMap((scrollableHost) => {
|
3911
|
-
|
3912
|
-
|
3913
|
-
scrollableHost
|
3983
|
+
return this.watchScrollableHost(elementRef).pipe(combineLatestWith(additionalContainers), switchMap(([scrollableHost, additionalHosts]) => {
|
3984
|
+
const resizeObserverSvc = this.#resizeObserverSvc;
|
3985
|
+
if (!resizeObserverSvc ||
|
3986
|
+
((!scrollableHost ||
|
3987
|
+
scrollableHost === this.#windowRef.nativeWindow) &&
|
3988
|
+
additionalHosts.length === 0)) {
|
3914
3989
|
return of('none');
|
3915
3990
|
}
|
3916
|
-
|
3991
|
+
const inputs = [
|
3917
3992
|
of(undefined),
|
3918
|
-
|
3919
|
-
]
|
3993
|
+
...additionalHosts.map((container) => resizeObserverSvc.observe(container)),
|
3994
|
+
];
|
3995
|
+
if (scrollableHost && scrollableHost !== this.#windowRef.nativeWindow) {
|
3996
|
+
inputs.push(resizeObserverSvc.observe({ nativeElement: scrollableHost }));
|
3997
|
+
}
|
3998
|
+
return concat(inputs).pipe(debounceTime(0, animationFrameScheduler), map$1(() => {
|
3920
3999
|
const viewportSize = this.#getViewportSize();
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
4000
|
+
let { top, left, right, bottom } = scrollableHost.getBoundingClientRect();
|
4001
|
+
for (const container of additionalHosts) {
|
4002
|
+
if (container.nativeElement?.parentNode) {
|
4003
|
+
const containerRect = container.nativeElement.getBoundingClientRect();
|
4004
|
+
top = Math.max(top, containerRect.top);
|
4005
|
+
left = Math.max(left, containerRect.left);
|
4006
|
+
right = Math.min(right, containerRect.right);
|
4007
|
+
bottom = Math.min(bottom, containerRect.bottom);
|
4008
|
+
}
|
4009
|
+
}
|
4010
|
+
top = Math.max(0, top);
|
4011
|
+
left = Math.max(0, left);
|
4012
|
+
return `inset(${top}px ${viewportSize.width - right}px ${viewportSize.height - bottom}px ${left}px)`;
|
3925
4013
|
}));
|
3926
4014
|
}));
|
3927
4015
|
}
|
@@ -4603,7 +4691,7 @@ class Version {
|
|
4603
4691
|
/**
|
4604
4692
|
* Represents the version of @skyux/core.
|
4605
4693
|
*/
|
4606
|
-
const VERSION = new Version('12.
|
4694
|
+
const VERSION = new Version('12.6.0');
|
4607
4695
|
|
4608
4696
|
/**
|
4609
4697
|
* Generated bundle index. Do not edit.
|