Skip to content

Commit fbc9f53

Browse files
authored
refactor(angular): animation controller uses correct core instance (#28473)
Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `AnimationController` does not use the correct underlying instance of the utilities from either the lazy or custom elements build, depending on if the developer is using `@ionic/angular` or `@ionic/angular/standalone`. It will always use the lazy instance. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - `AnimationController` uses the instance of the utilities based on it's implementation type, e.g. `@ionic/angular/standalone` uses the custom elements build with the utilities from `@ionic/core/components`. - `@ionic/angular` and `@ionic/angular/standalone` now export their own specific implementation of `AnimationController` ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> Ionic was re-exporting the `AnimationController` from both `@ionic/angular` and `@ionic/angular/standalone` entry points. Developers will not need to update their implementations or change import paths to take advantage of this change. ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
1 parent d69ad43 commit fbc9f53

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

packages/angular/common/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export { LoadingController } from './providers/loading-controller';
33
export { MenuController } from './providers/menu-controller';
44
export { PickerController } from './providers/picker-controller';
55

6-
export { AnimationController } from './providers/animation-controller';
76
export { GestureController } from './providers/gesture-controller';
87
export { DomController } from './providers/dom-controller';
98
export { NavController } from './providers/nav-controller';

packages/angular/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export {
2323
AlertController,
2424
LoadingController,
2525
PickerController,
26-
AnimationController,
2726
GestureController,
2827
DomController,
2928
NavController,
@@ -37,6 +36,7 @@ export {
3736
ViewDidEnter,
3837
ViewDidLeave,
3938
} from '@ionic/angular/common';
39+
export { AnimationController } from './providers/animation-controller';
4040
export { ActionSheetController } from './providers/action-sheet-controller';
4141
export { MenuController } from './providers/menu-controller';
4242
export { ModalController } from './providers/modal-controller';
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Injectable } from '@angular/core';
2+
import { createAnimation, getTimeGivenProgression } from '@ionic/core';
3+
import type { Animation } from '@ionic/core';
4+
5+
@Injectable({
6+
providedIn: 'root',
7+
})
8+
export class AnimationController {
9+
/**
10+
* Create a new animation
11+
*/
12+
create(animationId?: string): Animation {
13+
return createAnimation(animationId);
14+
}
15+
16+
/**
17+
* EXPERIMENTAL
18+
*
19+
* Given a progression and a cubic bezier function,
20+
* this utility returns the time value(s) at which the
21+
* cubic bezier reaches the given time progression.
22+
*
23+
* If the cubic bezier never reaches the progression
24+
* the result will be an empty array.
25+
*
26+
* This is most useful for switching between easing curves
27+
* when doing a gesture animation (i.e. going from linear easing
28+
* during a drag, to another easing when `progressEnd` is called)
29+
*/
30+
easingTime(p0: number[], p1: number[], p2: number[], p3: number[], progression: number): number[] {
31+
return getTimeGivenProgression(p0, p1, p2, p3, progression);
32+
}
33+
}

packages/angular/standalone/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export { IonRouterLink, IonRouterLinkWithHref } from './navigation/router-link-d
66
export { IonTabs } from './navigation/tabs';
77
export { provideIonicAngular } from './providers/ionic-angular';
88
export { ActionSheetController } from './providers/action-sheet-controller';
9+
export { AnimationController } from './providers/animation-controller';
910
export { MenuController } from './providers/menu-controller';
1011
export { ModalController } from './providers/modal-controller';
1112
export { PopoverController } from './providers/popover-controller';
@@ -14,7 +15,6 @@ export {
1415
AlertController,
1516
LoadingController,
1617
PickerController,
17-
AnimationController,
1818
GestureController,
1919
DomController,
2020
NavController,

packages/angular/common/src/providers/animation-controller.ts renamed to packages/angular/standalone/src/providers/animation-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import type { Animation } from '@ionic/core/components';
2+
import type { Animation } from '@ionic/core';
33
import { createAnimation, getTimeGivenProgression } from '@ionic/core/components';
44

55
@Injectable({

0 commit comments

Comments
 (0)