@skyux/core 14.0.0-alpha.5 → 14.0.0-alpha.7
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 +145 -5
- package/fesm2022/skyux-core.mjs.map +1 -1
- package/package.json +2 -2
- package/types/skyux-core.d.ts +69 -2
package/fesm2022/skyux-core.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { NgModule, Injectable, inject, RendererFactory2, NgZone, DOCUMENT, EventEmitter, Output, Input, Directive,
|
|
2
|
+
import { NgModule, Injectable, inject, RendererFactory2, NgZone, DOCUMENT, EventEmitter, Output, Input, Directive, ElementRef, input, output, signal, effect, ChangeDetectionStrategy, Component, provideEnvironmentInitializer, DestroyRef, EnvironmentInjector, createEnvironmentInjector, createComponent, ChangeDetectorRef, ViewContainerRef, ViewChild, InjectionToken, Optional, Inject, ApplicationRef, afterNextRender, Injector, Pipe, HostBinding, Renderer2, HostListener } from '@angular/core';
|
|
3
3
|
import { Subject, Subscription, ReplaySubject, fromEvent, of, Observable, filter, map, distinctUntilChanged, shareReplay, observeOn, animationFrameScheduler, takeUntil as takeUntil$1, BehaviorSubject, combineLatestWith, switchMap, concat, debounceTime as debounceTime$1 } from 'rxjs';
|
|
4
4
|
import { takeUntil, debounceTime, take } from 'rxjs/operators';
|
|
5
5
|
import { ViewportRuler } from '@angular/cdk/overlay';
|
|
6
|
+
import * as i1$1 from '@angular/common';
|
|
7
|
+
import { DOCUMENT as DOCUMENT$1, CommonModule } from '@angular/common';
|
|
6
8
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
9
|
import * as i1 from '@skyux/i18n';
|
|
8
10
|
import { SkyLibResourcesService, SkyI18nModule, SkyIntlNumberFormatStyle, SkyIntlNumberFormatter } from '@skyux/i18n';
|
|
9
|
-
import * as i1$1 from '@angular/common';
|
|
10
|
-
import { CommonModule } from '@angular/common';
|
|
11
11
|
import { Router, NavigationStart } from '@angular/router';
|
|
12
12
|
import * as i1$2 from '@angular/platform-browser';
|
|
13
13
|
|
|
@@ -1042,6 +1042,146 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
1042
1042
|
}]
|
|
1043
1043
|
}] });
|
|
1044
1044
|
|
|
1045
|
+
/**
|
|
1046
|
+
* @internal
|
|
1047
|
+
*/
|
|
1048
|
+
const SKY_ANIMATIONS_DISABLED_CLASS_NAME = 'sky-animations-disabled';
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* @internal
|
|
1052
|
+
*/
|
|
1053
|
+
function _skyAnimationsDisabled() {
|
|
1054
|
+
return inject(DOCUMENT).body.classList.contains(SKY_ANIMATIONS_DISABLED_CLASS_NAME);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* @internal
|
|
1059
|
+
*
|
|
1060
|
+
* Listens for CSS `transitionend` events on the host element and emits
|
|
1061
|
+
* a `transitionEnd` output when the tracked CSS property finishes
|
|
1062
|
+
* transitioning. When animations are globally disabled, the output
|
|
1063
|
+
* emits synchronously whenever the `transitionTrigger` input changes.
|
|
1064
|
+
*
|
|
1065
|
+
* Consumers **must** call `cssPropertyToTrack()` to specify which CSS
|
|
1066
|
+
* property to monitor before any transition occurs on the host element.
|
|
1067
|
+
*/
|
|
1068
|
+
class _SkyAnimationTransitionHandlerDirective {
|
|
1069
|
+
#elementRef;
|
|
1070
|
+
#propertyName;
|
|
1071
|
+
constructor() {
|
|
1072
|
+
this.#elementRef = inject((ElementRef));
|
|
1073
|
+
/**
|
|
1074
|
+
* Drives the CSS transition on the host element. When the value
|
|
1075
|
+
* changes and animations are enabled, a CSS transition runs and
|
|
1076
|
+
* `transitionEnd` emits on completion. When animations are
|
|
1077
|
+
* disabled, `transitionEnd` emits synchronously instead.
|
|
1078
|
+
*/
|
|
1079
|
+
this.transitionTrigger = input.required(...(ngDevMode ? [{ debugName: "transitionTrigger" }] : []));
|
|
1080
|
+
/**
|
|
1081
|
+
* Emits when the tracked CSS property's `transitionend` event fires
|
|
1082
|
+
* on the host element, or synchronously when animations are disabled.
|
|
1083
|
+
*/
|
|
1084
|
+
this.transitionEnd = output();
|
|
1085
|
+
this.#propertyName = signal(undefined, ...(ngDevMode ? [{ debugName: "#propertyName" }] : []));
|
|
1086
|
+
if (_skyAnimationsDisabled()) {
|
|
1087
|
+
let initialized = false;
|
|
1088
|
+
effect(() => {
|
|
1089
|
+
this.transitionTrigger();
|
|
1090
|
+
if (initialized) {
|
|
1091
|
+
this.transitionEnd.emit();
|
|
1092
|
+
}
|
|
1093
|
+
initialized = true;
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Sets the CSS property name to monitor for `transitionend` events
|
|
1099
|
+
* (e.g. `'opacity'`, `'max-height'`). This must be called before a
|
|
1100
|
+
* transition occurs; otherwise an error is thrown when the host
|
|
1101
|
+
* element's `transitionend` event fires.
|
|
1102
|
+
*/
|
|
1103
|
+
cssPropertyToTrack(propertyName) {
|
|
1104
|
+
this.#propertyName.set(propertyName);
|
|
1105
|
+
}
|
|
1106
|
+
onTransitionEnd(evt) {
|
|
1107
|
+
if (evt.target !== this.#elementRef.nativeElement) {
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
if (!this.#propertyName()) {
|
|
1111
|
+
throw new Error(`SkyAnimationTransitionHandler: No CSS property specified for transition tracking on element ` +
|
|
1112
|
+
`'<${this.#elementRef.nativeElement.tagName.toLowerCase()}>'. ` +
|
|
1113
|
+
`Call 'cssPropertyToTrack()' with a valid CSS property name before a transition occurs.`);
|
|
1114
|
+
}
|
|
1115
|
+
if (evt.propertyName === this.#propertyName()) {
|
|
1116
|
+
this.transitionEnd.emit();
|
|
1117
|
+
evt.stopPropagation();
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationTransitionHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1121
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: _SkyAnimationTransitionHandlerDirective, isStandalone: true, inputs: { transitionTrigger: { classPropertyName: "transitionTrigger", publicName: "transitionTrigger", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { transitionEnd: "transitionEnd" }, host: { listeners: { "transitionend": "onTransitionEnd($event)" } }, ngImport: i0 }); }
|
|
1122
|
+
}
|
|
1123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationTransitionHandlerDirective, decorators: [{
|
|
1124
|
+
type: Directive,
|
|
1125
|
+
args: [{
|
|
1126
|
+
host: {
|
|
1127
|
+
'(transitionend)': 'onTransitionEnd($event)',
|
|
1128
|
+
},
|
|
1129
|
+
}]
|
|
1130
|
+
}], ctorParameters: () => [], propDecorators: { transitionTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "transitionTrigger", required: true }] }], transitionEnd: [{ type: i0.Output, args: ["transitionEnd"] }] } });
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* @internal
|
|
1134
|
+
*
|
|
1135
|
+
* Animates content open and closed by sliding the host element's
|
|
1136
|
+
* height.
|
|
1137
|
+
*/
|
|
1138
|
+
class _SkyAnimationSlideComponent {
|
|
1139
|
+
constructor() {
|
|
1140
|
+
this.opened = input.required(...(ngDevMode ? [{ debugName: "opened" }] : []));
|
|
1141
|
+
inject(_SkyAnimationTransitionHandlerDirective).cssPropertyToTrack('visibility');
|
|
1142
|
+
}
|
|
1143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1144
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.0", type: _SkyAnimationSlideComponent, isStandalone: true, selector: "sky-animation-slide", inputs: { opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.sky-animation-slide-in": "!opened()", "class.sky-animation-slide-out": "opened()" } }, hostDirectives: [{ directive: _SkyAnimationTransitionHandlerDirective, inputs: ["transitionTrigger", "opened"], outputs: ["transitionEnd", "transitionEnd"] }], ngImport: i0, template: '<div class="sky-animation-slide-content"><ng-content /></div>', isInline: true, styles: [":host{display:grid;grid-template-rows:0fr;overflow:hidden;transition-property:grid-template-rows,visibility;transition-duration:var(--sky-transition-time-short);transition-timing-function:ease-in}:host.sky-animation-slide-in{grid-template-rows:0fr;visibility:hidden}:host.sky-animation-slide-out{grid-template-rows:1fr;visibility:visible}:host>.sky-animation-slide-content{min-height:0;overflow:hidden}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1145
|
+
}
|
|
1146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, decorators: [{
|
|
1147
|
+
type: Component,
|
|
1148
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1149
|
+
'[class.sky-animation-slide-in]': '!opened()',
|
|
1150
|
+
'[class.sky-animation-slide-out]': 'opened()',
|
|
1151
|
+
}, hostDirectives: [
|
|
1152
|
+
{
|
|
1153
|
+
directive: _SkyAnimationTransitionHandlerDirective,
|
|
1154
|
+
inputs: ['transitionTrigger: opened'],
|
|
1155
|
+
outputs: ['transitionEnd'],
|
|
1156
|
+
},
|
|
1157
|
+
], selector: 'sky-animation-slide', template: '<div class="sky-animation-slide-content"><ng-content /></div>', styles: [":host{display:grid;grid-template-rows:0fr;overflow:hidden;transition-property:grid-template-rows,visibility;transition-duration:var(--sky-transition-time-short);transition-timing-function:ease-in}:host.sky-animation-slide-in{grid-template-rows:0fr;visibility:hidden}:host.sky-animation-slide-out{grid-template-rows:1fr;visibility:visible}:host>.sky-animation-slide-content{min-height:0;overflow:hidden}\n"] }]
|
|
1158
|
+
}], ctorParameters: () => [], propDecorators: { opened: [{ type: i0.Input, args: [{ isSignal: true, alias: "opened", required: true }] }] } });
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* Disables CSS transitions and animations for SKY UX components.
|
|
1162
|
+
*
|
|
1163
|
+
* Use this in unit tests or in applications that need to suppress
|
|
1164
|
+
* motion globally. Provide once at the root level only.
|
|
1165
|
+
*
|
|
1166
|
+
* @example
|
|
1167
|
+
* ```typescript
|
|
1168
|
+
* TestBed.configureTestingModule({
|
|
1169
|
+
* imports: [MyComponent],
|
|
1170
|
+
* providers: [provideNoopSkyAnimations()],
|
|
1171
|
+
* });
|
|
1172
|
+
* ```
|
|
1173
|
+
*/
|
|
1174
|
+
function provideNoopSkyAnimations() {
|
|
1175
|
+
return provideEnvironmentInitializer(() => {
|
|
1176
|
+
const doc = inject(DOCUMENT$1);
|
|
1177
|
+
const destroyRef = inject(DestroyRef);
|
|
1178
|
+
doc.body.classList.add(SKY_ANIMATIONS_DISABLED_CLASS_NAME);
|
|
1179
|
+
destroyRef.onDestroy(() => {
|
|
1180
|
+
doc.body.classList.remove(SKY_ANIMATIONS_DISABLED_CLASS_NAME);
|
|
1181
|
+
});
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1045
1185
|
/**
|
|
1046
1186
|
* @internal
|
|
1047
1187
|
* An API to provide information about a parent component's content to child components.
|
|
@@ -4732,11 +4872,11 @@ class Version {
|
|
|
4732
4872
|
/**
|
|
4733
4873
|
* Represents the version of @skyux/core.
|
|
4734
4874
|
*/
|
|
4735
|
-
const VERSION = new Version('14.0.0-alpha.
|
|
4875
|
+
const VERSION = new Version('14.0.0-alpha.7');
|
|
4736
4876
|
|
|
4737
4877
|
/**
|
|
4738
4878
|
* Generated bundle index. Do not edit.
|
|
4739
4879
|
*/
|
|
4740
4880
|
|
|
4741
|
-
export { NumericOptions, SKY_BREAKPOINTS, SKY_BREAKPOINT_OBSERVER, SKY_HELP_GLOBAL_OPTIONS, SKY_LOG_LEVEL, SKY_STACKING_CONTEXT, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyContainerBreakpointObserver, SkyContentInfoProvider, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDefaultInputProvider, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLegacyService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyFileReaderService, SkyHelpService, SkyIdModule, SkyIdService, SkyLayoutHostDirective, SkyLayoutHostService, SkyLiveAnnouncerService, SkyLogLevel, SkyLogModule, SkyLogService, SkyMediaBreakpointObserver, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyMutationObserverService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayLegacyService, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyResponsiveHostDirective, SkyScreenReaderLabelDirective, SkyScrollShadowDirective, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeper, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, VERSION, provideSkyBreakpointObserver, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
|
|
4881
|
+
export { NumericOptions, SKY_BREAKPOINTS, SKY_BREAKPOINT_OBSERVER, SKY_HELP_GLOBAL_OPTIONS, SKY_LOG_LEVEL, SKY_STACKING_CONTEXT, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyContainerBreakpointObserver, SkyContentInfoProvider, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDefaultInputProvider, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLegacyService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyFileReaderService, SkyHelpService, SkyIdModule, SkyIdService, SkyLayoutHostDirective, SkyLayoutHostService, SkyLiveAnnouncerService, SkyLogLevel, SkyLogModule, SkyLogService, SkyMediaBreakpointObserver, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyMutationObserverService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayLegacyService, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyResponsiveHostDirective, SkyScreenReaderLabelDirective, SkyScrollShadowDirective, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeper, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, VERSION, _SkyAnimationSlideComponent, _SkyAnimationTransitionHandlerDirective, provideNoopSkyAnimations, provideSkyBreakpointObserver, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
|
|
4742
4882
|
//# sourceMappingURL=skyux-core.mjs.map
|