Skip to content

Commit 61c5def

Browse files
author
Alexander Vakrilov
authored
chore(cleanup): Repo cleanup (#1003)
* 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
1 parent c264453 commit 61c5def

27 files changed

+98
-289
lines changed

Diff for: nativescript-angular/animations.ts renamed to nativescript-angular/animations/animations.module.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import {
1313
ɵBrowserAnimationBuilder as BrowserAnimationBuilder,
1414
} from "@angular/platform-browser/animations";
1515

16-
import { NativeScriptAnimationEngine } from "./animations/animation-engine";
17-
import { NativeScriptAnimationDriver } from "./animations/animation-driver";
18-
import { NativeScriptModule } from "./nativescript.module";
19-
import { NativeScriptRendererFactory } from "./renderer";
16+
import { NativeScriptAnimationEngine } from "./animation-engine";
17+
import { NativeScriptAnimationDriver } from "./animation-driver";
18+
import { NativeScriptModule } from "../nativescript.module";
19+
import { NativeScriptRendererFactory } from "../renderer";
2020

2121
@Injectable()
2222
export class InjectableAnimationEngine extends NativeScriptAnimationEngine {

Diff for: nativescript-angular/animations/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./animations.module";

Diff for: nativescript-angular/collection-facade.ts

-134
This file was deleted.

Diff for: nativescript-angular/directives.ts

-42
This file was deleted.

Diff for: nativescript-angular/directives/index.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { ListViewComponent, TemplateKeyDirective } from "./list-view-comp";
2+
import { TabViewDirective, TabViewItemDirective } from "./tab-view";
3+
import {
4+
ActionBarComponent,
5+
ActionBarScope,
6+
ActionItemDirective,
7+
NavigationButtonDirective
8+
} from "./action-bar";
9+
import { AndroidFilterComponent, IosFilterComponent } from "./platform-filters";
10+
11+
export {
12+
ListViewComponent,
13+
SetupItemViewArgs,
14+
TemplateKeyDirective
15+
} from "./list-view-comp";
16+
17+
export { TabViewDirective, TabViewItemDirective } from "./tab-view";
18+
export {
19+
ActionBarComponent,
20+
ActionBarScope,
21+
ActionItemDirective,
22+
NavigationButtonDirective
23+
} from "./action-bar";
24+
export { AndroidFilterComponent, IosFilterComponent } from "./platform-filters";
25+
26+
export const NS_DIRECTIVES = [
27+
ListViewComponent,
28+
TemplateKeyDirective,
29+
TabViewDirective,
30+
TabViewItemDirective,
31+
ActionBarComponent,
32+
ActionBarScope,
33+
ActionItemDirective,
34+
NavigationButtonDirective,
35+
AndroidFilterComponent,
36+
IosFilterComponent,
37+
];

Diff for: nativescript-angular/directives/list-view-comp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
TemplateRef,
1919
ViewChild,
2020
ViewContainerRef,
21+
ɵisListLikeIterable as isListLikeIterable
2122
} from "@angular/core";
2223
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
2324
import { View, KeyedTemplate } from "tns-core-modules/ui/core/view";
@@ -26,7 +27,6 @@ import { ObservableArray } from "tns-core-modules/data/observable-array";
2627
import { profile } from "tns-core-modules/profiling";
2728

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

3232
const NG_VIEW = "_ngViewRef";

Diff for: nativescript-angular/dom-adapter.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { Type } from "@angular/core";
33
import { ɵDomAdapter } from "@angular/platform-browser";
44
import { rendererLog } from "./trace";
5-
import { print } from "./lang-facade";
65

76
export class NativeScriptDomAdapter implements ɵDomAdapter {
87
static makeCurrent() {
@@ -27,15 +26,15 @@ export class NativeScriptDomAdapter implements ɵDomAdapter {
2726
}
2827

2928
log(arg: any): void {
30-
print(arg);
29+
console.log(arg);
3130
}
3231

3332
logError(arg: any): void {
34-
print(arg);
33+
console.log(arg);
3534
}
3635

3736
logGroup(arg: any): void {
38-
print(arg);
37+
console.log(arg);
3938
}
4039

4140
logGroupEnd(): void {

Diff for: nativescript-angular/forms.ts renamed to nativescript-angular/forms/forms.module.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { NgModule } from "@angular/core";
22
import { FormsModule } from "@angular/forms";
3-
import { TextValueAccessor } from "./value-accessors/text-value-accessor";
4-
import { CheckedValueAccessor } from "./value-accessors/checked-value-accessor";
5-
import { DateValueAccessor } from "./value-accessors/date-value-accessor";
6-
import { TimeValueAccessor } from "./value-accessors/time-value-accessor";
7-
import { NumberValueAccessor } from "./value-accessors/number-value-accessor";
8-
import { SelectedIndexValueAccessor } from "./value-accessors/selectedIndex-value-accessor";
3+
import {
4+
TextValueAccessor,
5+
CheckedValueAccessor,
6+
DateValueAccessor,
7+
TimeValueAccessor,
8+
NumberValueAccessor,
9+
SelectedIndexValueAccessor
10+
} from "./value-accessors";
911

1012
export const FORMS_DIRECTIVES = [
1113
TextValueAccessor,

Diff for: nativescript-angular/forms/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./forms.module";

Diff for: nativescript-angular/forms/value-accessors/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export * from "./base-value-accessor";
2+
export * from "./text-value-accessor";
3+
export * from "./checked-value-accessor";
4+
export * from "./date-value-accessor";
5+
export * from "./time-value-accessor";
6+
export * from "./number-value-accessor";
7+
export * from "./selectedIndex-value-accessor";

Diff for: nativescript-angular/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export {
2626
registerElement,
2727
} from "./element-registry";
2828

29-
export * from "./value-accessors/base-value-accessor";
29+
export * from "./forms/value-accessors/base-value-accessor";

Diff for: nativescript-angular/lang-facade.ts

-60
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,7 @@
1-
/* tslint:disable */
2-
//Copied unexported functions from @angular/core/src/facade/lang
3-
var globalScope = global;
4-
export var global = globalScope;
5-
61
export function isPresent(obj: any): boolean {
72
return obj !== undefined && obj !== null;
83
}
94

105
export function isBlank(obj: any): boolean {
116
return obj === undefined || obj === null;
127
}
13-
14-
export function isDate(obj: any): obj is Date {
15-
return obj instanceof Date && !isNaN(obj.valueOf());
16-
}
17-
18-
export function print(obj: Error | Object) {
19-
console.log(obj);
20-
}
21-
22-
export function isJsObject(o: any): boolean {
23-
return o !== null && (typeof o === 'function' || typeof o === 'object');
24-
}
25-
26-
export function isArray(obj: any): boolean {
27-
return Array.isArray(obj);
28-
}
29-
30-
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
31-
declare var Symbol: any;
32-
let _symbolIterator: any = null;
33-
export function getSymbolIterator(): string|symbol {
34-
if (isBlank(_symbolIterator)) {
35-
if (isPresent((<any>globalScope).Symbol) && isPresent(Symbol.iterator)) {
36-
_symbolIterator = Symbol.iterator;
37-
} else {
38-
// es6-shim specific logic
39-
let keys = Object.getOwnPropertyNames(Map.prototype);
40-
for (let i = 0; i < keys.length; ++i) {
41-
let key = keys[i];
42-
if (key !== 'entries' && key !== 'size' &&
43-
(Map as any).prototype[key] === Map.prototype['entries']) {
44-
_symbolIterator = key;
45-
}
46-
}
47-
}
48-
}
49-
return _symbolIterator;
50-
}
51-
52-
export function setValueOnPath(global: any, path: string, value: any) {
53-
let parts = path.split('.');
54-
let obj: any = global;
55-
while (parts.length > 1) {
56-
let name = parts.shift();
57-
if (obj.hasOwnProperty(name) && isPresent(obj[name])) {
58-
obj = obj[name];
59-
} else {
60-
obj = obj[name] = {};
61-
}
62-
}
63-
if (obj === undefined || obj === null) {
64-
obj = {};
65-
}
66-
obj[parts.shift()] = value;
67-
}

Diff for: nativescript-angular/renderer.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { topmost } from "tns-core-modules/ui/frame";
1111
import { profile } from "tns-core-modules/profiling";
1212

1313
import { APP_ROOT_VIEW, DEVICE, getRootPage } from "./platform-providers";
14-
import { isBlank } from "./lang-facade";
1514
import { ViewUtil } from "./view-util";
1615
import { NgView, InvisibleNode } from "./element-registry";
1716
import { rendererLog as traceLog } from "./trace";
@@ -60,7 +59,7 @@ export class NativeScriptRendererFactory implements RendererFactory2 {
6059
}
6160

6261
let renderer: NativeScriptRenderer = this.componentRenderers.get(type.id);
63-
if (!isBlank(renderer)) {
62+
if (renderer) {
6463
return renderer;
6564
}
6665

Diff for: nativescript-angular/router/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./router.module";

0 commit comments

Comments
 (0)