@skyux/core 14.0.0-alpha.8 → 14.0.0-alpha.9

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
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';
2
+ import { NgModule, Injectable, inject, RendererFactory2, NgZone, DOCUMENT, EventEmitter, Output, Input, Directive, effect, ElementRef, input, output, signal, DestroyRef, ChangeDetectionStrategy, Component, provideEnvironmentInitializer, 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';
@@ -1054,19 +1054,50 @@ function _skyAnimationsDisabled() {
1054
1054
  return inject(DOCUMENT).body.classList.contains(SKY_ANIMATIONS_DISABLED_CLASS_NAME);
1055
1055
  }
1056
1056
 
1057
+ /**
1058
+ * Mimics a CSS motion end event (`animationend`/`transitionend`) when
1059
+ * CSS motion is disabled.
1060
+ *
1061
+ * Registers an effect that watches the provided trigger signal and, after the
1062
+ * first change, emits on a microtask when the host element is visible. This
1063
+ * preserves async timing that callers expect from real motion end events.
1064
+ */
1065
+ function mimicCssMotionEvent(elementRef, destroyRef, triggerSignal, output) {
1066
+ const el = elementRef.nativeElement;
1067
+ let destroyed = false;
1068
+ let initialized = false;
1069
+ destroyRef.onDestroy(() => {
1070
+ destroyed = true;
1071
+ });
1072
+ effect(() => {
1073
+ triggerSignal();
1074
+ // CSS animation/transition events do not fire when the element is `display: none`.
1075
+ if (initialized && getComputedStyle(el).display !== 'none') {
1076
+ // Defer the emit to a microtask so it fires after the current
1077
+ // change detection pass, matching real transition timing.
1078
+ queueMicrotask(() => {
1079
+ if (!destroyed) {
1080
+ output.emit();
1081
+ }
1082
+ });
1083
+ }
1084
+ initialized = true;
1085
+ });
1086
+ }
1087
+
1057
1088
  /**
1058
1089
  * @internal
1059
1090
  *
1060
1091
  * Listens for CSS `transitionend` events on the host element and emits
1061
1092
  * a `transitionEnd` output when the tracked CSS property finishes
1062
1093
  * transitioning. When animations are globally disabled, the output
1063
- * emits synchronously whenever the `transitionTrigger` input changes.
1094
+ * emits via a microtask whenever the `transitionTrigger` input changes.
1064
1095
  *
1065
1096
  * The CSS property to monitor can be set via the `transitionPropertyToTrack`
1066
1097
  * input (for template usage) or by calling `setPropertyToTrack()`
1067
1098
  * (for `hostDirectives` usage).
1068
1099
  */
1069
- class _SkyAnimationTransitionHandlerDirective {
1100
+ class _SkyTransitionEndHandlerDirective {
1070
1101
  #elementRef;
1071
1102
  #propertyNameOverride;
1072
1103
  constructor() {
@@ -1075,7 +1106,7 @@ class _SkyAnimationTransitionHandlerDirective {
1075
1106
  * Drives the CSS transition on the host element. When the value
1076
1107
  * changes and animations are enabled, a CSS transition runs and
1077
1108
  * `transitionEnd` emits on completion. When animations are
1078
- * disabled, `transitionEnd` emits synchronously instead.
1109
+ * disabled, `transitionEnd` emits via a microtask instead.
1079
1110
  */
1080
1111
  this.transitionTrigger = input.required(...(ngDevMode ? [{ debugName: "transitionTrigger" }] : []));
1081
1112
  /**
@@ -1086,19 +1117,12 @@ class _SkyAnimationTransitionHandlerDirective {
1086
1117
  this.transitionPropertyToTrack = input(...(ngDevMode ? [undefined, { debugName: "transitionPropertyToTrack" }] : []));
1087
1118
  /**
1088
1119
  * Emits when the tracked CSS property's `transitionend` event fires
1089
- * on the host element, or synchronously when animations are disabled.
1120
+ * on the host element, or via a microtask when animations are disabled.
1090
1121
  */
1091
1122
  this.transitionEnd = output();
1092
1123
  this.#propertyNameOverride = signal(undefined, ...(ngDevMode ? [{ debugName: "#propertyNameOverride" }] : []));
1093
1124
  if (_skyAnimationsDisabled()) {
1094
- let initialized = false;
1095
- effect(() => {
1096
- this.transitionTrigger();
1097
- if (initialized) {
1098
- this.transitionEnd.emit();
1099
- }
1100
- initialized = true;
1101
- });
1125
+ mimicCssMotionEvent(this.#elementRef, inject(DestroyRef), this.transitionTrigger, this.transitionEnd);
1102
1126
  }
1103
1127
  }
1104
1128
  /**
@@ -1115,7 +1139,7 @@ class _SkyAnimationTransitionHandlerDirective {
1115
1139
  }
1116
1140
  const propertyName = this.transitionPropertyToTrack() ?? this.#propertyNameOverride();
1117
1141
  if (!propertyName) {
1118
- throw new Error(`SkyAnimationTransitionHandler: No CSS property specified for transition tracking on element ` +
1142
+ throw new Error(`SkyTransitionEndHandler: No CSS property specified for transition tracking on element ` +
1119
1143
  `'<${this.#elementRef.nativeElement.tagName.toLowerCase()}>'. ` +
1120
1144
  `Set the 'transitionPropertyToTrack' input or call 'setPropertyToTrack()' with a valid CSS property name before a transition occurs.`);
1121
1145
  }
@@ -1124,13 +1148,13 @@ class _SkyAnimationTransitionHandlerDirective {
1124
1148
  evt.stopPropagation();
1125
1149
  }
1126
1150
  }
1127
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationTransitionHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1128
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: _SkyAnimationTransitionHandlerDirective, isStandalone: true, selector: "[skyAnimationTransitionHandler]", inputs: { transitionTrigger: { classPropertyName: "transitionTrigger", publicName: "transitionTrigger", isSignal: true, isRequired: true, transformFunction: null }, transitionPropertyToTrack: { classPropertyName: "transitionPropertyToTrack", publicName: "transitionPropertyToTrack", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { transitionEnd: "transitionEnd" }, host: { listeners: { "transitionend": "onTransitionEnd($event)" } }, ngImport: i0 }); }
1151
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyTransitionEndHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1152
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: _SkyTransitionEndHandlerDirective, isStandalone: true, selector: "[skyTransitionEndHandler]", inputs: { transitionTrigger: { classPropertyName: "transitionTrigger", publicName: "transitionTrigger", isSignal: true, isRequired: true, transformFunction: null }, transitionPropertyToTrack: { classPropertyName: "transitionPropertyToTrack", publicName: "transitionPropertyToTrack", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { transitionEnd: "transitionEnd" }, host: { listeners: { "transitionend": "onTransitionEnd($event)" } }, ngImport: i0 }); }
1129
1153
  }
1130
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationTransitionHandlerDirective, decorators: [{
1154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyTransitionEndHandlerDirective, decorators: [{
1131
1155
  type: Directive,
1132
1156
  args: [{
1133
- selector: '[skyAnimationTransitionHandler]',
1157
+ selector: '[skyTransitionEndHandler]',
1134
1158
  host: {
1135
1159
  '(transitionend)': 'onTransitionEnd($event)',
1136
1160
  },
@@ -1146,10 +1170,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1146
1170
  class _SkyAnimationSlideComponent {
1147
1171
  constructor() {
1148
1172
  this.opened = input.required(...(ngDevMode ? [{ debugName: "opened" }] : []));
1149
- inject(_SkyAnimationTransitionHandlerDirective).setPropertyToTrack('visibility');
1173
+ inject(_SkyTransitionEndHandlerDirective).setPropertyToTrack('visibility');
1150
1174
  }
1151
1175
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1152
- 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 }); }
1176
+ 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: _SkyTransitionEndHandlerDirective, 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 }); }
1153
1177
  }
1154
1178
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, decorators: [{
1155
1179
  type: Component,
@@ -1158,7 +1182,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1158
1182
  '[class.sky-animation-slide-out]': 'opened()',
1159
1183
  }, hostDirectives: [
1160
1184
  {
1161
- directive: _SkyAnimationTransitionHandlerDirective,
1185
+ directive: _SkyTransitionEndHandlerDirective,
1162
1186
  inputs: ['transitionTrigger: opened'],
1163
1187
  outputs: ['transitionEnd'],
1164
1188
  },
@@ -4880,11 +4904,11 @@ class Version {
4880
4904
  /**
4881
4905
  * Represents the version of @skyux/core.
4882
4906
  */
4883
- const VERSION = new Version('14.0.0-alpha.8');
4907
+ const VERSION = new Version('14.0.0-alpha.9');
4884
4908
 
4885
4909
  /**
4886
4910
  * Generated bundle index. Do not edit.
4887
4911
  */
4888
4912
 
4889
- 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 };
4913
+ 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, _SkyTransitionEndHandlerDirective, provideNoopSkyAnimations, provideSkyBreakpointObserver, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
4890
4914
  //# sourceMappingURL=skyux-core.mjs.map