@skyux/core 14.0.0-alpha.10 → 14.0.0-alpha.12

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, effect, untracked, ElementRef, input, output, signal, computed, DestroyRef, ChangeDetectionStrategy, Component, provideEnvironmentInitializer, 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, untracked, input, booleanAttribute, output, ElementRef, DestroyRef, signal, computed, 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';
@@ -1079,11 +1079,13 @@ function watchForDisabledCssTransitions(args) {
1079
1079
  }
1080
1080
  /**
1081
1081
  * Creates an effect that watches a trigger signal and emits via a microtask
1082
- * when the host element's CSS motion is disabled. Skips the initial effect
1083
- * run and unrendered elements to match native CSS behavior.
1082
+ * when the host element's CSS motion is disabled. By default, skips the
1083
+ * initial effect run to match native CSS behavior. When `emitOnAnimateEnter`
1084
+ * is `true`, the first run is not skipped, allowing emission for elements
1085
+ * that use `animate.enter` (where DOM insertion is the animation event).
1084
1086
  */
1085
1087
  function emitWhenMotionDisabled(args, isMotionDisabled) {
1086
- const { destroyRef, elementRef, emitter, trigger } = args;
1088
+ const { destroyRef, elementRef, emitOnAnimateEnter, emitter, trigger } = args;
1087
1089
  const el = elementRef.nativeElement;
1088
1090
  let destroyed = false;
1089
1091
  let initialized = false;
@@ -1092,10 +1094,15 @@ function emitWhenMotionDisabled(args, isMotionDisabled) {
1092
1094
  });
1093
1095
  effect(() => {
1094
1096
  trigger();
1097
+ // On the first run, check if emitOnAnimateEnter opts out of skipping.
1098
+ if (!initialized && emitOnAnimateEnter) {
1099
+ initialized = untracked(() => emitOnAnimateEnter());
1100
+ }
1095
1101
  const style = getComputedStyle(el);
1096
1102
  const isRendered = style.display !== 'none';
1097
- // Skip the first effect run (and unrendered elements) to match native CSS behavior.
1098
- // Motion events only fire on rendered elements when a property value changes.
1103
+ // By default, skip the first effect run (and unrendered elements) to match
1104
+ // native CSS behavior. When emitOnAnimateEnter is true, the first run is
1105
+ // treated as initialized, allowing emission for enter animations.
1099
1106
  if (initialized && isRendered && untracked(() => isMotionDisabled(style))) {
1100
1107
  // Defer the emit to a microtask so it fires after the current
1101
1108
  // change detection pass, matching real transition timing.
@@ -1144,6 +1151,60 @@ function isTransitionDisabledForProperty(args) {
1144
1151
  return parseFloat(duration) <= 0;
1145
1152
  }
1146
1153
 
1154
+ /**
1155
+ * @internal
1156
+ *
1157
+ * Listens for CSS `animationend` events on the host element and emits
1158
+ * an `animationEnd` output when an animation completes. When the
1159
+ * element's CSS animation is disabled (e.g. `animation-name: none`
1160
+ * or `animation-duration: 0s`), the output emits via a microtask
1161
+ * whenever the `animationTrigger` input changes.
1162
+ */
1163
+ class _SkyAnimationEndHandlerDirective {
1164
+ constructor() {
1165
+ /**
1166
+ * When `true` and the host element uses `animate.enter`, the
1167
+ * disabled-animation fallback emits `animationEnd` on the initial
1168
+ * render. Use this when the element's insertion into the DOM is
1169
+ * the animation event.
1170
+ */
1171
+ this.emitOnAnimateEnter = input(false, { ...(ngDevMode ? { debugName: "emitOnAnimateEnter" } : {}), transform: booleanAttribute });
1172
+ /**
1173
+ * Drives animation lifecycle tracking on the host element. When the
1174
+ * value changes and the CSS animation is disabled, `animationEnd`
1175
+ * emits via a microtask.
1176
+ */
1177
+ this.animationTrigger = input.required(...(ngDevMode ? [{ debugName: "animationTrigger" }] : []));
1178
+ /**
1179
+ * Emits when an `animationend` event fires on the host element, or via a
1180
+ * microtask when the CSS animation is disabled.
1181
+ */
1182
+ this.animationEnd = output();
1183
+ watchForDisabledCssAnimations({
1184
+ destroyRef: inject(DestroyRef),
1185
+ elementRef: inject(ElementRef),
1186
+ emitOnAnimateEnter: this.emitOnAnimateEnter,
1187
+ emitter: this.animationEnd,
1188
+ trigger: this.animationTrigger,
1189
+ });
1190
+ }
1191
+ onAnimationEnd(evt) {
1192
+ this.animationEnd.emit();
1193
+ evt.stopPropagation();
1194
+ }
1195
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationEndHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1196
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: _SkyAnimationEndHandlerDirective, isStandalone: true, selector: "[skyAnimationEndHandler]", inputs: { emitOnAnimateEnter: { classPropertyName: "emitOnAnimateEnter", publicName: "emitOnAnimateEnter", isSignal: true, isRequired: false, transformFunction: null }, animationTrigger: { classPropertyName: "animationTrigger", publicName: "animationTrigger", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { animationEnd: "animationEnd" }, host: { listeners: { "animationend": "onAnimationEnd($event)" } }, ngImport: i0 }); }
1197
+ }
1198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationEndHandlerDirective, decorators: [{
1199
+ type: Directive,
1200
+ args: [{
1201
+ selector: '[skyAnimationEndHandler]',
1202
+ host: {
1203
+ '(animationend)': 'onAnimationEnd($event)',
1204
+ },
1205
+ }]
1206
+ }], ctorParameters: () => [], propDecorators: { emitOnAnimateEnter: [{ type: i0.Input, args: [{ isSignal: true, alias: "emitOnAnimateEnter", required: false }] }], animationTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "animationTrigger", required: true }] }], animationEnd: [{ type: i0.Output, args: ["animationEnd"] }] } });
1207
+
1147
1208
  /**
1148
1209
  * @internal
1149
1210
  *
@@ -1241,7 +1302,7 @@ class _SkyAnimationSlideComponent {
1241
1302
  inject(_SkyTransitionEndHandlerDirective).setPropertyToTrack('visibility');
1242
1303
  }
1243
1304
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1244
- 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 }); }
1305
+ 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-global-duration-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 }); }
1245
1306
  }
1246
1307
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, decorators: [{
1247
1308
  type: Component,
@@ -1254,7 +1315,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1254
1315
  inputs: ['transitionTrigger: opened'],
1255
1316
  outputs: ['transitionEnd'],
1256
1317
  },
1257
- ], 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"] }]
1318
+ ], 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-global-duration-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"] }]
1258
1319
  }], ctorParameters: () => [], propDecorators: { opened: [{ type: i0.Input, args: [{ isSignal: true, alias: "opened", required: true }] }] } });
1259
1320
 
1260
1321
  /**
@@ -4977,11 +5038,11 @@ class Version {
4977
5038
  /**
4978
5039
  * Represents the version of @skyux/core.
4979
5040
  */
4980
- const VERSION = new Version('14.0.0-alpha.10');
5041
+ const VERSION = new Version('14.0.0-alpha.12');
4981
5042
 
4982
5043
  /**
4983
5044
  * Generated bundle index. Do not edit.
4984
5045
  */
4985
5046
 
4986
- 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 };
5047
+ 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, _SkyAnimationEndHandlerDirective, _SkyAnimationSlideComponent, _SkyTransitionEndHandlerDirective, provideNoopSkyAnimations, provideSkyBreakpointObserver, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
4987
5048
  //# sourceMappingURL=skyux-core.mjs.map