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

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.
@@ -1062,12 +1062,13 @@ function _skyAnimationsDisabled() {
1062
1062
  * transitioning. When animations are globally disabled, the output
1063
1063
  * emits synchronously whenever the `transitionTrigger` input changes.
1064
1064
  *
1065
- * Consumers **must** call `cssPropertyToTrack()` to specify which CSS
1066
- * property to monitor before any transition occurs on the host element.
1065
+ * The CSS property to monitor can be set via the `transitionPropertyToTrack`
1066
+ * input (for template usage) or by calling `setPropertyToTrack()`
1067
+ * (for `hostDirectives` usage).
1067
1068
  */
1068
1069
  class _SkyAnimationTransitionHandlerDirective {
1069
1070
  #elementRef;
1070
- #propertyName;
1071
+ #propertyNameOverride;
1071
1072
  constructor() {
1072
1073
  this.#elementRef = inject((ElementRef));
1073
1074
  /**
@@ -1077,12 +1078,18 @@ class _SkyAnimationTransitionHandlerDirective {
1077
1078
  * disabled, `transitionEnd` emits synchronously instead.
1078
1079
  */
1079
1080
  this.transitionTrigger = input.required(...(ngDevMode ? [{ debugName: "transitionTrigger" }] : []));
1081
+ /**
1082
+ * The CSS property name to monitor for `transitionend` events
1083
+ * (e.g. `'opacity'`, `'transform'`). Can be set declaratively in
1084
+ * templates.
1085
+ */
1086
+ this.transitionPropertyToTrack = input(...(ngDevMode ? [undefined, { debugName: "transitionPropertyToTrack" }] : []));
1080
1087
  /**
1081
1088
  * Emits when the tracked CSS property's `transitionend` event fires
1082
1089
  * on the host element, or synchronously when animations are disabled.
1083
1090
  */
1084
1091
  this.transitionEnd = output();
1085
- this.#propertyName = signal(undefined, ...(ngDevMode ? [{ debugName: "#propertyName" }] : []));
1092
+ this.#propertyNameOverride = signal(undefined, ...(ngDevMode ? [{ debugName: "#propertyNameOverride" }] : []));
1086
1093
  if (_skyAnimationsDisabled()) {
1087
1094
  let initialized = false;
1088
1095
  effect(() => {
@@ -1096,38 +1103,39 @@ class _SkyAnimationTransitionHandlerDirective {
1096
1103
  }
1097
1104
  /**
1098
1105
  * 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.
1106
+ * programmatically. Use this when applying the directive via
1107
+ * `hostDirectives`.
1102
1108
  */
1103
- cssPropertyToTrack(propertyName) {
1104
- this.#propertyName.set(propertyName);
1109
+ setPropertyToTrack(propertyName) {
1110
+ this.#propertyNameOverride.set(propertyName);
1105
1111
  }
1106
1112
  onTransitionEnd(evt) {
1107
1113
  if (evt.target !== this.#elementRef.nativeElement) {
1108
1114
  return;
1109
1115
  }
1110
- if (!this.#propertyName()) {
1116
+ const propertyName = this.transitionPropertyToTrack() ?? this.#propertyNameOverride();
1117
+ if (!propertyName) {
1111
1118
  throw new Error(`SkyAnimationTransitionHandler: No CSS property specified for transition tracking on element ` +
1112
1119
  `'<${this.#elementRef.nativeElement.tagName.toLowerCase()}>'. ` +
1113
- `Call 'cssPropertyToTrack()' with a valid CSS property name before a transition occurs.`);
1120
+ `Set the 'transitionPropertyToTrack' input or call 'setPropertyToTrack()' with a valid CSS property name before a transition occurs.`);
1114
1121
  }
1115
- if (evt.propertyName === this.#propertyName()) {
1122
+ if (evt.propertyName === propertyName) {
1116
1123
  this.transitionEnd.emit();
1117
1124
  evt.stopPropagation();
1118
1125
  }
1119
1126
  }
1120
1127
  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 }); }
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 }); }
1122
1129
  }
1123
1130
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationTransitionHandlerDirective, decorators: [{
1124
1131
  type: Directive,
1125
1132
  args: [{
1133
+ selector: '[skyAnimationTransitionHandler]',
1126
1134
  host: {
1127
1135
  '(transitionend)': 'onTransitionEnd($event)',
1128
1136
  },
1129
1137
  }]
1130
- }], ctorParameters: () => [], propDecorators: { transitionTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "transitionTrigger", required: true }] }], transitionEnd: [{ type: i0.Output, args: ["transitionEnd"] }] } });
1138
+ }], ctorParameters: () => [], propDecorators: { transitionTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "transitionTrigger", required: true }] }], transitionPropertyToTrack: [{ type: i0.Input, args: [{ isSignal: true, alias: "transitionPropertyToTrack", required: false }] }], transitionEnd: [{ type: i0.Output, args: ["transitionEnd"] }] } });
1131
1139
 
1132
1140
  /**
1133
1141
  * @internal
@@ -1138,7 +1146,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1138
1146
  class _SkyAnimationSlideComponent {
1139
1147
  constructor() {
1140
1148
  this.opened = input.required(...(ngDevMode ? [{ debugName: "opened" }] : []));
1141
- inject(_SkyAnimationTransitionHandlerDirective).cssPropertyToTrack('visibility');
1149
+ inject(_SkyAnimationTransitionHandlerDirective).setPropertyToTrack('visibility');
1142
1150
  }
1143
1151
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: _SkyAnimationSlideComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1144
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 }); }
@@ -4872,7 +4880,7 @@ class Version {
4872
4880
  /**
4873
4881
  * Represents the version of @skyux/core.
4874
4882
  */
4875
- const VERSION = new Version('14.0.0-alpha.7');
4883
+ const VERSION = new Version('14.0.0-alpha.8');
4876
4884
 
4877
4885
  /**
4878
4886
  * Generated bundle index. Do not edit.