mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
perf(all): dynamic import
This commit is contained in:
@@ -6,7 +6,7 @@ import { Animation } from '../../../interface';
|
||||
* type will provide their own animations for open and close
|
||||
* and registers itself with Menu.
|
||||
*/
|
||||
export default function baseAnimation(Animation: Animation): Promise<Animation> {
|
||||
export function baseAnimation(Animation: Animation): Promise<Animation> {
|
||||
// https://material.io/guidelines/motion/movement.html#movement-movement-in-out-of-screen-bounds
|
||||
// https://material.io/guidelines/motion/duration-easing.html#duration-easing-natural-easing-curves
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Animation, Menu } from '../../../interface';
|
||||
import baseAnimation from './base';
|
||||
import { baseAnimation } from './base';
|
||||
|
||||
const BOX_SHADOW_WIDTH = 8;
|
||||
/**
|
||||
@@ -8,7 +8,7 @@ const BOX_SHADOW_WIDTH = 8;
|
||||
* The menu slides over the content. The content
|
||||
* itself, which is under the menu, does not move.
|
||||
*/
|
||||
export default function(Animation: Animation, _: HTMLElement, menu: Menu): Promise<Animation> {
|
||||
export function menuOverlayAnimation(Animation: Animation, _: HTMLElement, menu: Menu): Promise<Animation> {
|
||||
let closedX: string, openedX: string;
|
||||
const width = menu.width + BOX_SHADOW_WIDTH;
|
||||
if (menu.isEndSide) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Animation, Menu } from '../../../interface';
|
||||
import baseAnimation from './base';
|
||||
import { baseAnimation } from './base';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
@@ -7,7 +7,7 @@ import baseAnimation from './base';
|
||||
* The content slides over to reveal the menu underneath.
|
||||
* The menu itself also slides over to reveal its bad self.
|
||||
*/
|
||||
export default function(Animation: Animation, _: HTMLElement, menu: Menu): Promise<Animation> {
|
||||
export function menuPushAnimation(Animation: Animation, _: HTMLElement, menu: Menu): Promise<Animation> {
|
||||
|
||||
let contentOpenedX: string, menuClosedX: string;
|
||||
const width = menu.width;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Animation, Menu } from '../../../interface';
|
||||
import baseAnimation from './base';
|
||||
import { baseAnimation } from './base';
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
@@ -7,7 +7,7 @@ import baseAnimation from './base';
|
||||
* The content slides over to reveal the menu underneath.
|
||||
* The menu itself, which is under the content, does not move.
|
||||
*/
|
||||
export default function(Animation: Animation, _: HTMLElement, menu: Menu): Promise<Animation> {
|
||||
export function menuRevealAnimation(Animation: Animation, _: HTMLElement, menu: Menu): Promise<Animation> {
|
||||
const openedX = (menu.width * (menu.isEndSide ? -1 : 1)) + 'px';
|
||||
|
||||
const contentOpen = new Animation()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Component, Method, Prop } from '@stencil/core';
|
||||
import { Animation, AnimationBuilder, Menu } from '../../interface';
|
||||
|
||||
import MenuOverlayAnimation from './animations/overlay';
|
||||
import MenuPushAnimation from './animations/push';
|
||||
import MenuRevealAnimation from './animations/reveal';
|
||||
import { menuOverlayAnimation } from './animations/overlay';
|
||||
import { menuPushAnimation } from './animations/push';
|
||||
import { menuRevealAnimation } from './animations/reveal';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-menu-controller'
|
||||
@@ -16,9 +16,9 @@ export class MenuController {
|
||||
@Prop({ connect: 'ion-animation-controller' }) animationCtrl!: HTMLIonAnimationControllerElement;
|
||||
|
||||
constructor() {
|
||||
this.registerAnimation('reveal', MenuRevealAnimation);
|
||||
this.registerAnimation('push', MenuPushAnimation);
|
||||
this.registerAnimation('overlay', MenuOverlayAnimation);
|
||||
this.registerAnimation('reveal', menuRevealAnimation);
|
||||
this.registerAnimation('push', menuPushAnimation);
|
||||
this.registerAnimation('overlay', menuOverlayAnimation);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,4 +279,4 @@ export class MenuController {
|
||||
|
||||
}
|
||||
|
||||
export { MenuOverlayAnimation, MenuPushAnimation, MenuRevealAnimation };
|
||||
export { menuOverlayAnimation, menuPushAnimation, menuRevealAnimation };
|
||||
|
||||
Reference in New Issue
Block a user