Skip to content

Commit

Permalink
perf(all): dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed May 8, 2018
1 parent cc7ab4e commit bb809b6
Show file tree
Hide file tree
Showing 56 changed files with 179 additions and 218 deletions.
33 changes: 0 additions & 33 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2265,39 +2265,6 @@ declare global {
}


declare global {

namespace StencilComponents {
interface IonInputShims {

}
}

interface HTMLIonInputShimsElement extends StencilComponents.IonInputShims, HTMLStencilElement {}

var HTMLIonInputShimsElement: {
prototype: HTMLIonInputShimsElement;
new (): HTMLIonInputShimsElement;
};
interface HTMLElementTagNameMap {
'ion-input-shims': HTMLIonInputShimsElement;
}
interface ElementTagNameMap {
'ion-input-shims': HTMLIonInputShimsElement;
}
namespace JSX {
interface IntrinsicElements {
'ion-input-shims': JSXElements.IonInputShimsAttributes;
}
}
namespace JSXElements {
export interface IonInputShimsAttributes extends HTMLAttributes {

}
}
}


declare global {

namespace StencilComponents {
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/action-sheet/action-sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Component, Element, Event, EventEmitter, Listen, Method, Prop } from '@
import { ActionSheetButton, Animation, AnimationBuilder, Config, CssClassMap, Mode } from '../../interface';
import { BACKDROP, OverlayEventDetail, OverlayInterface, dismiss, eventMethod, isCancel, present } from '../../utils/overlays';
import { createThemedClasses, getClassMap } from '../../utils/theme';
import iosEnterAnimation from './animations/ios.enter';
import iosLeaveAnimation from './animations/ios.leave';
import mdEnterAnimation from './animations/md.enter';
import mdLeaveAnimation from './animations/md.leave';
import { iosEnterAnimation } from './animations/ios.enter';
import { iosLeaveAnimation } from './animations/ios.leave';
import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave';


@Component({
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/animations/ios.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* iOS Action Sheet Enter Animation
*/
export default function iosEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function iosEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/animations/ios.leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* iOS Action Sheet Leave Animation
*/
export default function iosLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function iosLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/animations/md.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Animation } from '../../../interface';
/**
* MD Action Sheet Enter Animation
*/
export default function mdEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function mdEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/animations/md.leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* MD Action Sheet Leave Animation
*/
export default function mdLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function mdLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { AlertButton, AlertInput, Animation, AnimationBuilder, Config, CssClassM
import { BACKDROP, OverlayEventDetail, OverlayInterface, dismiss, eventMethod, isCancel, present } from '../../utils/overlays';
import { createThemedClasses, getClassMap } from '../../utils/theme';

import iosEnterAnimation from './animations/ios.enter';
import iosLeaveAnimation from './animations/ios.leave';
import mdEnterAnimation from './animations/md.enter';
import mdLeaveAnimation from './animations/md.leave';
import { iosEnterAnimation } from './animations/ios.enter';
import { iosLeaveAnimation } from './animations/ios.leave';
import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave';

@Component({
tag: 'ion-alert',
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert/animations/ios.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* iOS Alert Enter Animation
*/
export default function iosEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function iosEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert/animations/ios.leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* iOS Alert Leave Animation
*/
export default function iosLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function iosLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert/animations/md.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* Md Alert Enter Animation
*/
export default function mdEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function mdEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert/animations/md.leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* Md Alert Leave Animation
*/
export default function mdLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function mdLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/app/app.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// TODO this can be simplified
&.statusbar-padding {
.ion-page,
> ion-header,
.ion-page > ion-header,
ion-tab ion-nav .ion-page > ion-header,
ion-menu > .menu-inner,
ion-menu > .menu-inner > ion-header {
@include toolbar-statusbar-padding($toolbar-ios-height, $toolbar-ios-padding, $content-ios-padding, $app-ios-statusbar-padding);
Expand Down
14 changes: 11 additions & 3 deletions core/src/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class App {
@Prop({ context: 'window' }) win!: Window;
@Prop({ context: 'config' }) config!: Config;

componentDidLoad() {
loadInputShims(this.win, this.config);
}

hostData() {
const hybrid = isHybrid(this.win);
const statusBar = this.config.getBoolean('statusbarPadding', hybrid);
Expand All @@ -35,13 +39,17 @@ export class App {

render() {
const device = this.config.getBoolean('isDevice', isDevice(this.win));
const inputShims = this.config.getBoolean('inputShims', needInputShims(this.win));

return [
inputShims && <ion-input-shims></ion-input-shims>,
<ion-tap-click></ion-tap-click>,
device && <ion-status-tap></ion-status-tap>,
<slot></slot>
];
}
}

async function loadInputShims(win: Window, config: Config) {
const inputShims = config.getBoolean('inputShims', needInputShims(win));
if (inputShims) {
(await import('../../utils/input-shims/input-shims')).startInputShims(win.document, config);
}
}
101 changes: 0 additions & 101 deletions core/src/components/input-shims/input-shims.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion core/src/components/loading/animations/ios.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Animation } from '../../../interface';
/**
* iOS Loading Enter Animation
*/
export default function iosEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function iosEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/loading/animations/ios.leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Animation } from '../../../interface';
/**
* iOS Loading Leave Animation
*/
export default function iosLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function iosLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/loading/animations/md.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* Md Loading Enter Animation
*/
export default function mdEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function mdEnterAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/loading/animations/md.leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Animation } from '../../../interface';
/**
* Md Loading Leave Animation
*/
export default function mdLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
export function mdLeaveAnimation(Animation: Animation, baseEl: HTMLElement): Promise<Animation> {
const baseAnimation = new Animation();

const backdropAnimation = new Animation();
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/loading/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Animation, AnimationBuilder, Config, Mode } from '../../interface';
import { BACKDROP, OverlayEventDetail, OverlayInterface, dismiss, eventMethod, present } from '../../utils/overlays';
import { createThemedClasses, getClassMap } from '../../utils/theme';

import iosEnterAnimation from './animations/ios.enter';
import iosLeaveAnimation from './animations/ios.leave';
import { iosEnterAnimation } from './animations/ios.enter';
import { iosLeaveAnimation } from './animations/ios.leave';

import mdEnterAnimation from './animations/md.enter';
import mdLeaveAnimation from './animations/md.leave';
import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave';

@Component({
tag: 'ion-loading',
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/menu-controller/animations/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions core/src/components/menu-controller/animations/overlay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Animation, Menu } from '../../../interface';
import baseAnimation from './base';
import { baseAnimation } from './base';

const BOX_SHADOW_WIDTH = 8;
/**
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/menu-controller/animations/push.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Animation, Menu } from '../../../interface';
import baseAnimation from './base';
import { baseAnimation } from './base';

/**
* @hidden
* Menu Push Type
* 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;
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/menu-controller/animations/reveal.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Animation, Menu } from '../../../interface';
import baseAnimation from './base';
import { baseAnimation } from './base';

/**
* @hidden
* Menu Reveal Type
* 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()
Expand Down
Loading

0 comments on commit bb809b6

Please sign in to comment.