Skip to content

Commit

Permalink
chore(cleanup): Repo cleanup (#1003)
Browse files Browse the repository at this point in the history
* chore(cleanup): Use index files and move module definitionss in folders

* chore(cleanup): remove collection-facade.ts

* chore(cleanup): Limit the use of lang-facade

* chore: Fixed value-accessors imports
  • Loading branch information
Alexander Vakrilov committed Oct 6, 2017
1 parent c264453 commit 61c5def
Show file tree
Hide file tree
Showing 27 changed files with 98 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
ɵBrowserAnimationBuilder as BrowserAnimationBuilder,
} from "@angular/platform-browser/animations";

import { NativeScriptAnimationEngine } from "./animations/animation-engine";
import { NativeScriptAnimationDriver } from "./animations/animation-driver";
import { NativeScriptModule } from "./nativescript.module";
import { NativeScriptRendererFactory } from "./renderer";
import { NativeScriptAnimationEngine } from "./animation-engine";
import { NativeScriptAnimationDriver } from "./animation-driver";
import { NativeScriptModule } from "../nativescript.module";
import { NativeScriptRendererFactory } from "../renderer";

@Injectable()
export class InjectableAnimationEngine extends NativeScriptAnimationEngine {
Expand Down
1 change: 1 addition & 0 deletions nativescript-angular/animations/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./animations.module";
134 changes: 0 additions & 134 deletions nativescript-angular/collection-facade.ts

This file was deleted.

42 changes: 0 additions & 42 deletions nativescript-angular/directives.ts

This file was deleted.

37 changes: 37 additions & 0 deletions nativescript-angular/directives/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ListViewComponent, TemplateKeyDirective } from "./list-view-comp";
import { TabViewDirective, TabViewItemDirective } from "./tab-view";
import {
ActionBarComponent,
ActionBarScope,
ActionItemDirective,
NavigationButtonDirective
} from "./action-bar";
import { AndroidFilterComponent, IosFilterComponent } from "./platform-filters";

export {
ListViewComponent,
SetupItemViewArgs,
TemplateKeyDirective
} from "./list-view-comp";

export { TabViewDirective, TabViewItemDirective } from "./tab-view";
export {
ActionBarComponent,
ActionBarScope,
ActionItemDirective,
NavigationButtonDirective
} from "./action-bar";
export { AndroidFilterComponent, IosFilterComponent } from "./platform-filters";

export const NS_DIRECTIVES = [
ListViewComponent,
TemplateKeyDirective,
TabViewDirective,
TabViewItemDirective,
ActionBarComponent,
ActionBarScope,
ActionItemDirective,
NavigationButtonDirective,
AndroidFilterComponent,
IosFilterComponent,
];
2 changes: 1 addition & 1 deletion nativescript-angular/directives/list-view-comp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
TemplateRef,
ViewChild,
ViewContainerRef,
ɵisListLikeIterable as isListLikeIterable
} from "@angular/core";
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
import { View, KeyedTemplate } from "tns-core-modules/ui/core/view";
Expand All @@ -26,7 +27,6 @@ import { ObservableArray } from "tns-core-modules/data/observable-array";
import { profile } from "tns-core-modules/profiling";

import { getSingleViewRecursive } from "../element-registry";
import { isListLikeIterable } from "../collection-facade";
import { listViewLog, listViewError } from "../trace";

const NG_VIEW = "_ngViewRef";
Expand Down
7 changes: 3 additions & 4 deletions nativescript-angular/dom-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { Type } from "@angular/core";
import { ɵDomAdapter } from "@angular/platform-browser";
import { rendererLog } from "./trace";
import { print } from "./lang-facade";

export class NativeScriptDomAdapter implements ɵDomAdapter {
static makeCurrent() {
Expand All @@ -27,15 +26,15 @@ export class NativeScriptDomAdapter implements ɵDomAdapter {
}

log(arg: any): void {
print(arg);
console.log(arg);
}

logError(arg: any): void {
print(arg);
console.log(arg);
}

logGroup(arg: any): void {
print(arg);
console.log(arg);
}

logGroupEnd(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { TextValueAccessor } from "./value-accessors/text-value-accessor";
import { CheckedValueAccessor } from "./value-accessors/checked-value-accessor";
import { DateValueAccessor } from "./value-accessors/date-value-accessor";
import { TimeValueAccessor } from "./value-accessors/time-value-accessor";
import { NumberValueAccessor } from "./value-accessors/number-value-accessor";
import { SelectedIndexValueAccessor } from "./value-accessors/selectedIndex-value-accessor";
import {
TextValueAccessor,
CheckedValueAccessor,
DateValueAccessor,
TimeValueAccessor,
NumberValueAccessor,
SelectedIndexValueAccessor
} from "./value-accessors";

export const FORMS_DIRECTIVES = [
TextValueAccessor,
Expand Down
1 change: 1 addition & 0 deletions nativescript-angular/forms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./forms.module";
7 changes: 7 additions & 0 deletions nativescript-angular/forms/value-accessors/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from "./base-value-accessor";
export * from "./text-value-accessor";
export * from "./checked-value-accessor";
export * from "./date-value-accessor";
export * from "./time-value-accessor";
export * from "./number-value-accessor";
export * from "./selectedIndex-value-accessor";
2 changes: 1 addition & 1 deletion nativescript-angular/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export {
registerElement,
} from "./element-registry";

export * from "./value-accessors/base-value-accessor";
export * from "./forms/value-accessors/base-value-accessor";
60 changes: 0 additions & 60 deletions nativescript-angular/lang-facade.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,7 @@
/* tslint:disable */
//Copied unexported functions from @angular/core/src/facade/lang
var globalScope = global;
export var global = globalScope;

export function isPresent(obj: any): boolean {
return obj !== undefined && obj !== null;
}

export function isBlank(obj: any): boolean {
return obj === undefined || obj === null;
}

export function isDate(obj: any): obj is Date {
return obj instanceof Date && !isNaN(obj.valueOf());
}

export function print(obj: Error | Object) {
console.log(obj);
}

export function isJsObject(o: any): boolean {
return o !== null && (typeof o === 'function' || typeof o === 'object');
}

export function isArray(obj: any): boolean {
return Array.isArray(obj);
}

// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
declare var Symbol: any;
let _symbolIterator: any = null;
export function getSymbolIterator(): string|symbol {
if (isBlank(_symbolIterator)) {
if (isPresent((<any>globalScope).Symbol) && isPresent(Symbol.iterator)) {
_symbolIterator = Symbol.iterator;
} else {
// es6-shim specific logic
let keys = Object.getOwnPropertyNames(Map.prototype);
for (let i = 0; i < keys.length; ++i) {
let key = keys[i];
if (key !== 'entries' && key !== 'size' &&
(Map as any).prototype[key] === Map.prototype['entries']) {
_symbolIterator = key;
}
}
}
}
return _symbolIterator;
}

export function setValueOnPath(global: any, path: string, value: any) {
let parts = path.split('.');
let obj: any = global;
while (parts.length > 1) {
let name = parts.shift();
if (obj.hasOwnProperty(name) && isPresent(obj[name])) {
obj = obj[name];
} else {
obj = obj[name] = {};
}
}
if (obj === undefined || obj === null) {
obj = {};
}
obj[parts.shift()] = value;
}
3 changes: 1 addition & 2 deletions nativescript-angular/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { topmost } from "tns-core-modules/ui/frame";
import { profile } from "tns-core-modules/profiling";

import { APP_ROOT_VIEW, DEVICE, getRootPage } from "./platform-providers";
import { isBlank } from "./lang-facade";
import { ViewUtil } from "./view-util";
import { NgView, InvisibleNode } from "./element-registry";
import { rendererLog as traceLog } from "./trace";
Expand Down Expand Up @@ -60,7 +59,7 @@ export class NativeScriptRendererFactory implements RendererFactory2 {
}

let renderer: NativeScriptRenderer = this.componentRenderers.get(type.id);
if (!isBlank(renderer)) {
if (renderer) {
return renderer;
}

Expand Down
1 change: 1 addition & 0 deletions nativescript-angular/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./router.module";
Loading

0 comments on commit 61c5def

Please sign in to comment.