Skip to content

Commit

Permalink
fix(exports): update module exports
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Sep 14, 2016
1 parent 8585427 commit 6784f5e
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 114 deletions.
13 changes: 0 additions & 13 deletions src/components/tap-click/tap-click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,3 @@ export function setupTapClick(config: Config, app: App, zone: NgZone) {
return new TapClick(config, app, zone);
};
}

export function provideTapClick() {
return {
provide: APP_INITIALIZER,
useFactory: setupTapClick,
deps: [
Config,
App,
NgZone
],
multi: true
};
}
15 changes: 0 additions & 15 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,18 +376,3 @@ export function setupConfig(userConfig: any, queryParams: QueryParams, platform:
config.init(userConfig, queryParams, platform);
return config;
}

export function provideConfig(userConfig: any): any {
return [
{ provide: UserConfig, useValue: userConfig },
{
provide: Config,
useFactory: setupConfig,
deps: [
UserConfig,
QueryParams,
Platform
]
}
];
}
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

export { Config } from './config/config';
export { IonicModule } from './module';

export * from './module';
export * from './directives';

export * from './gestures/drag-gesture';
Expand All @@ -10,6 +8,7 @@ export * from './gestures/slide-edge-gesture';
export * from './gestures/slide-gesture';
export * from './gestures/gesture-controller';

export * from './config/config';
export * from './platform/platform';
export * from './storage/storage';
export * from './storage/sql';
Expand Down
88 changes: 64 additions & 24 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ANALYZE_FOR_ENTRY_COMPONENTS, ModuleWithProviders, NgModule } from '@angular/core';
import { ANALYZE_FOR_ENTRY_COMPONENTS, APP_INITIALIZER, ModuleWithProviders, NgModule, NgZone } from '@angular/core';
import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common';
import { BrowserModule, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';


/**
* Import Providers
*/
import { ActionSheetController } from './components/action-sheet/action-sheet';
import { AlertController } from './components/alert/alert';
import { App } from './components/app/app';
import { provideConfig } from './config/config';
import { provideEvents } from './util/events';
import { Config, UserConfig, setupConfig } from './config/config';
import { DeepLinker, setupDeepLinker, UserDeepLinkConfig } from './navigation/deep-linker';
import { setupProvideEvents } from './util/events';
import { FeatureDetect } from './util/feature-detect';
import { Form } from './util/form';
import { GestureController } from './gestures/gesture-controller';
Expand All @@ -21,26 +22,19 @@ import { LoadingController } from './components/loading/loading';
import { MenuController } from './components/menu/menu-controller';
import { ModalController } from './components/modal/modal';
import { PickerController } from './components/picker/picker';
import { providePlatform, UserAgent, UserNavigatorPlatform, UserDir, UserLang } from './platform/platform';
import { Platform, setupPlatform, UserAgent, UserNavigatorPlatform, UserDir, UserLang } from './platform/platform';
import { PopoverController } from './components/popover/popover';
import { provideDeepLinker } from './navigation/deep-linker';
import { provideQueryParams, UserUrl } from './platform/query-params';
import { TapClick, provideTapClick } from './components/tap-click/tap-click';
import { QueryParams, setupQueryParams, UserUrl } from './platform/query-params';
import { TapClick, setupTapClick } from './components/tap-click/tap-click';
import { ToastController } from './components/toast/toast';
import { Translate } from './translation/translate';
import { TransitionController } from './transitions/transition-controller';
import { UserRoot } from './components/app/app-root';

import { UrlSerializer } from './navigation/url-serializer';

/**
* Export Providers
* Import Overlay Entry Components
*/
export { DeepLinker, provideDeepLinker } from './navigation/deep-linker';
export { NavController } from './navigation/nav-controller';
export { NavParams } from './navigation/nav-params';
export { NavLink, NavOptions, DeepLink, DeepLinkConfig } from './navigation/nav-util';
export { ViewController } from './navigation/view-controller';

import { ActionSheetCmp } from './components/action-sheet/action-sheet-component';
import { AlertCmp } from './components/alert/alert-component';
import { IONIC_DIRECTIVES } from './directives';
Expand All @@ -51,6 +45,16 @@ import { PickerCmp } from './components/picker/picker-component';
import { PopoverCmp } from './components/popover/popover-component';
import { ToastCmp } from './components/toast/toast-component';

/**
* Export Providers
*/
export { DeepLinker, UserDeepLinkConfig } from './navigation/deep-linker';
export { NavController } from './navigation/nav-controller';
export { NavParams } from './navigation/nav-params';
export { NavLink, NavOptions, DeepLink, DeepLinkConfig } from './navigation/nav-util';
export { UrlSerializer } from './navigation/url-serializer';
export { ViewController } from './navigation/view-controller';


@NgModule({
imports: [BrowserModule, HttpModule, FormsModule, ReactiveFormsModule],
Expand Down Expand Up @@ -83,20 +87,54 @@ export class IonicModule {
ngModule: IonicModule,
providers: [
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: userAppRoot, multi: true },
{ provide: APP_INITIALIZER, useFactory: setupTapClick,
deps: [
Config,
App,
NgZone
],
multi: true
},
{ provide: APP_INITIALIZER, useFactory: setupProvideEvents, deps: [ Platform ], multi: true },
{ provide: Config, useFactory: setupConfig,
deps: [
UserConfig,
QueryParams,
Platform
]
},
{ provide: DeepLinker, useFactory: setupDeepLinker,
deps: [
App,
UrlSerializer,
Location
]
},
{ provide: HAMMER_GESTURE_CONFIG, useClass: IonicGestureConfig },
{ provide: LocationStrategy, useClass: HashLocationStrategy },
{ provide: Platform, useFactory: setupPlatform,
deps: [
QueryParams,
UserAgent,
UserNavigatorPlatform,
UserDir,
UserLang,
NgZone
]
},
{ provide: QueryParams, useFactory: setupQueryParams,
deps: [
UserUrl
]
},
{ provide: UserAgent, useFactory: getWindowUserAgent },
{ provide: UserDir, useFactory: getDocumentDir },
{ provide: UserLang, useFactory: getDocumentLang },
{ provide: UserNavigatorPlatform, useFactory: getWindowPlatform },
{ provide: UserRoot, useValue: userAppRoot },
{ provide: UserUrl, useFactory: getWindowLocation },

provideConfig(userConfig),
provideDeepLinker(userDeepLinkConfig),
provideEvents(),
providePlatform(),
provideQueryParams(),
provideTapClick(),
{ provide: UserConfig, useValue: userConfig },
{ provide: UserDeepLinkConfig, useValue: userDeepLinkConfig },

ActionSheetController,
AlertController,
Expand All @@ -106,14 +144,16 @@ export class IonicModule {
GestureController,
Keyboard,
LoadingController,
Location,
MenuController,
ModalController,
PickerController,
PopoverController,
TapClick,
ToastController,
Translate,
TransitionController
TransitionController,
UrlSerializer
]
};
}
Expand Down
21 changes: 1 addition & 20 deletions src/navigation/deep-linker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, OpaqueToken } from '@angular/core';
import { Location, LocationStrategy, HashLocationStrategy } from '@angular/common';
import { Location } from '@angular/common';

import { App } from '../components/app/app';
import { convertToViews, isNav, isTab, isTabs, NavSegment, DIRECTION_BACK } from './nav-util';
Expand Down Expand Up @@ -418,25 +418,6 @@ export function setupDeepLinker(app: App, serializer: UrlSerializer, location: L
export const UserDeepLinkConfig = new OpaqueToken('USERLINKS');


export function provideDeepLinker(userDeepLinkConfig: any): any[] {
return [
UrlSerializer,
Location,
{ provide: UserDeepLinkConfig, useValue: userDeepLinkConfig },
{ provide: LocationStrategy, useClass: HashLocationStrategy },
{
provide: DeepLinker,
useFactory: setupDeepLinker,
deps: [
App,
UrlSerializer,
Location
]
},
];
}


export function normalizeUrl(browserUrl: string): string {
browserUrl = browserUrl.trim();
if (browserUrl.charAt(0) !== '/') {
Expand Down
16 changes: 0 additions & 16 deletions src/platform/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,19 +844,3 @@ export const UserAgent = new OpaqueToken('USERAGENT');
export const UserNavigatorPlatform = new OpaqueToken('USERNAVPLT');
export const UserDir = new OpaqueToken('USERDIR');
export const UserLang = new OpaqueToken('USERLANG');


export function providePlatform(): any {
return {
provide: Platform,
useFactory: setupPlatform,
deps: [
QueryParams,
UserAgent,
UserNavigatorPlatform,
UserDir,
UserLang,
NgZone
]
};
}
10 changes: 0 additions & 10 deletions src/platform/query-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,3 @@ export const UserUrl = new OpaqueToken('USERURL');
export function setupQueryParams(url: string): QueryParams {
return new QueryParams(url);
}

export function provideQueryParams(): any {
return {
provide: QueryParams,
useFactory: setupQueryParams,
deps: [
UserUrl
]
};
}
13 changes: 0 additions & 13 deletions src/util/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { APP_INITIALIZER } from '@angular/core';

import { nativeTimeout } from '../util/dom';
import { Platform } from '../platform/platform';
import { ScrollView } from '../util/scroll-view';
Expand Down Expand Up @@ -152,14 +150,3 @@ export function setupProvideEvents(platform: Platform) {
return setupEvents(platform);
};
}

export function provideEvents() {
return {
provide: APP_INITIALIZER,
useFactory: setupProvideEvents,
deps: [
Platform
],
multi: true
};
}

0 comments on commit 6784f5e

Please sign in to comment.