FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: circular reference · NativeScript/NativeScript@dfdd748 · GitHub

Commit dfdd748

Browse files
committed
fix: circular reference
1 parent e9fdd28 commit dfdd748

10 files changed

Lines changed: 47 additions & 38 deletions

File tree

‎tns-core-modules/application/application-common.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ import {
4040
LoadAppCSSEventData,
4141
UnhandledErrorEventData
4242
} from "./application";
43+
4344
import { DeviceOrientation } from "../ui/enums/enums";
45+
import { CSS_CLASS_PREFIX } from "../ui/utils";
4446

4547
export { UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData };
4648

@@ -54,13 +56,6 @@ export const uncaughtErrorEvent = "uncaughtError";
5456
export const discardedErrorEvent = "discardedError";
5557
export const orientationChangedEvent = "orientationChanged";
5658

57-
const MODAL = "modal";
58-
const ROOT = "root";
59-
60-
export const CSS_CLASS_PREFIX = "ns-";
61-
export const MODAL_ROOT_VIEW_CSS_CLASS = `${CSS_CLASS_PREFIX}${MODAL}`;
62-
export const ROOT_VIEW_CSS_CLASSES = [`${CSS_CLASS_PREFIX}${ROOT}`];
63-
6459
const ORIENTATION_CSS_CLASSES = [
6560
`${CSS_CLASS_PREFIX}${DeviceOrientation.portrait}`,
6661
`${CSS_CLASS_PREFIX}${DeviceOrientation.landscape}`,

‎tns-core-modules/application/application.d.ts‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,6 @@ export const lowMemoryEvent: string;
5353
*/
5454
export const orientationChangedEvent: string;
5555

56-
/**
57-
* String value "ns-" used for CSS class prefix.
58-
*/
59-
export const CSS_CLASS_PREFIX: string;
60-
61-
/**
62-
* String value "ns-modal" used for default CSS class of a modal root view.
63-
*/
64-
export const MODAL_ROOT_VIEW_CSS_CLASS: string;
65-
66-
/**
67-
* Array of string values used for CSS classes of a root view.
68-
* Default value - "ns-root".
69-
* Platform values: "ns-android" and "ns-ios".
70-
* Device type values: "ns-phone" and "ns-tablet".
71-
* Orientation values: "ns-portrait", "ns-landscape" and "ns-unknown".
72-
*/
73-
export const ROOT_VIEW_CSS_CLASSES: string[];
74-
7556
/**
7657
* Event data containing information for the application events.
7758
*/

‎tns-core-modules/application/application.ios.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
} from ".";
99

1010
import {
11-
CSS_CLASS_PREFIX, displayedEvent, exitEvent, getCssFileName, launchEvent, livesync, lowMemoryEvent, notify, on,
12-
orientationChanged, orientationChangedEvent, resumeEvent, ROOT_VIEW_CSS_CLASSES, setApplication, suspendEvent
11+
displayedEvent, exitEvent, getCssFileName, launchEvent, livesync, lowMemoryEvent, notify, on,
12+
orientationChanged, orientationChangedEvent, resumeEvent, setApplication, suspendEvent
1313
} from "./application-common";
1414

1515
// First reexport so that app module is initialized.
@@ -19,6 +19,7 @@ export * from "./application-common";
1919
import { createViewFromEntry } from "../ui/builder";
2020
import { ios as iosView, View } from "../ui/core/view";
2121
import { Frame, NavigationEntry } from "../ui/frame";
22+
import { CSS_CLASS_PREFIX, ROOT_VIEW_CSS_CLASSES } from "../ui/utils";
2223
import { device } from "../platform/platform";
2324
import { profile } from "../profiling";
2425
import { ios } from "../utils/utils";

‎tns-core-modules/ui/core/view-base/view-base.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Definitions.
22
import { ViewBase as ViewBaseDefinition } from ".";
3-
import { MODAL_ROOT_VIEW_CSS_CLASS, ROOT_VIEW_CSS_CLASSES } from "../../../application";
43
import {
54
AlignSelf, FlexGrow, FlexShrink, FlexWrapBefore, Order
65
} from "../../layouts/flexbox-layout";
@@ -13,6 +12,7 @@ import { Binding, BindingOptions, Observable, WrappedValue, PropertyChangeData,
1312
import { isIOS, isAndroid } from "../../../platform";
1413
import { layout } from "../../../utils/utils";
1514
import { Length, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty } from "../../styling/style-properties";
15+
import { MODAL_ROOT_VIEW_CSS_CLASS, ROOT_VIEW_CSS_CLASSES } from "../../utils";
1616

1717
// TODO: Remove this import!
1818
import * as types from "../../../utils/types";

‎tns-core-modules/ui/core/view/view-common.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
Property, ShowModalOptions, traceCategories, traceEnabled, traceWrite, ViewBase
1010
} from "../view-base";
1111

12-
import { MODAL_ROOT_VIEW_CSS_CLASS } from "../../../application";
1312
import { HorizontalAlignment, VerticalAlignment, Visibility, Length, PercentLength } from "../../styling/style-properties";
1413

1514
import {
@@ -25,6 +24,7 @@ import { sanitizeModuleName } from "../../builder/module-name-sanitizer";
2524
import { StyleScope } from "../../styling/style-scope";
2625
import { LinearGradient } from "../../styling/linear-gradient";
2726
import { BackgroundRepeat } from "../../styling/style-properties";
27+
import { MODAL_ROOT_VIEW_CSS_CLASS } from "../../utils";
2828

2929
export * from "../../styling/style-properties";
3030
export * from "../view-base";

‎tns-core-modules/ui/frame/frame.android.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Page } from "../page";
77

88
// Types.
99
import * as application from "../../application";
10+
1011
import {
1112
_stack, FrameBase, goBack, NavigationType, Observable,
1213
traceCategories, traceEnabled, traceError, traceWrite, View
@@ -19,6 +20,7 @@ import {
1920

2021
// TODO: Remove this and get it from global to decouple builder for angular
2122
import { createViewFromEntry } from "../builder";
23+
import { CSS_CLASS_PREFIX, ROOT_VIEW_CSS_CLASSES } from "../utils";
2224
import { device } from "../../platform/platform";
2325
import { profile } from "../../profiling";
2426

@@ -1284,10 +1286,10 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
12841286
activityRootViewsMap.set(rootView._domId, new WeakRef(rootView));
12851287

12861288
const deviceType = device.deviceType.toLowerCase();
1287-
application.ROOT_VIEW_CSS_CLASSES.push(`${application.CSS_CLASS_PREFIX}${ANDROID_PLATFORM}`);
1288-
application.ROOT_VIEW_CSS_CLASSES.push(`${application.CSS_CLASS_PREFIX}${deviceType}`);
1289-
application.ROOT_VIEW_CSS_CLASSES.push(`${application.CSS_CLASS_PREFIX}${application.android.orientation}`);
1290-
application.ROOT_VIEW_CSS_CLASSES.forEach(c => this._rootView.cssClasses.add(c));
1289+
ROOT_VIEW_CSS_CLASSES.push(`${CSS_CLASS_PREFIX}${ANDROID_PLATFORM}`);
1290+
ROOT_VIEW_CSS_CLASSES.push(`${CSS_CLASS_PREFIX}${deviceType}`);
1291+
ROOT_VIEW_CSS_CLASSES.push(`${CSS_CLASS_PREFIX}${application.android.orientation}`);
1292+
ROOT_VIEW_CSS_CLASSES.forEach(c => this._rootView.cssClasses.add(c));
12911293
}
12921294

12931295
// Initialize native visual tree;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const MODAL = "modal";
2+
const ROOT = "root";
3+
4+
export const CSS_CLASS_PREFIX = "ns-";
5+
export const MODAL_ROOT_VIEW_CSS_CLASS = `${CSS_CLASS_PREFIX}${MODAL}`;
6+
export const ROOT_VIEW_CSS_CLASSES = [`${CSS_CLASS_PREFIX}${ROOT}`];

‎tns-core-modules/ui/utils.android.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export module ios {
1+
export { CSS_CLASS_PREFIX, MODAL_ROOT_VIEW_CSS_CLASS, ROOT_VIEW_CSS_CLASSES } from "./utils-common";
2+
3+
export module ios {
24
export function getActualHeight(view: any): number {
35
throw new Error("Not implemented for Android");
46
}
@@ -10,4 +12,4 @@
1012
export function _layoutRootView(rootView: any, parentBounds: any) {
1113
throw new Error("Not implemented for Android");
1214
}
13-
}
15+
}

‎tns-core-modules/ui/utils.d.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
*/
44

55
import { View } from "./core/view";
6+
7+
/**
8+
* String value "ns-" used for CSS class prefix.
9+
*/
10+
export const CSS_CLASS_PREFIX: string;
11+
12+
/**
13+
* String value "ns-modal" used for default CSS class of a modal root view.
14+
*/
15+
export const MODAL_ROOT_VIEW_CSS_CLASS: string;
16+
17+
/**
18+
* Array of string values used for CSS classes of a root view.
19+
* Default value - "ns-root".
20+
* Platform values: "ns-android" and "ns-ios".
21+
* Device type values: "ns-phone" and "ns-tablet".
22+
* Orientation values: "ns-portrait", "ns-landscape" and "ns-unknown".
23+
*/
24+
export const ROOT_VIEW_CSS_CLASSES: string[];
25+
626
export module ios {
727
/**
828
* Gets actual height of a [UIView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/) widget in device pixels.

‎tns-core-modules/ui/utils.ios.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import * as utils from "../utils/utils";
1+
export { CSS_CLASS_PREFIX, MODAL_ROOT_VIEW_CSS_CLASS, ROOT_VIEW_CSS_CLASSES } from "./utils-common";
2+
3+
import * as utils from "../utils/utils";
24

35
export module ios {
46
export function getActualHeight(view: UIView): number {
@@ -24,4 +26,4 @@ export module ios {
2426

2527
return utils.layout.toDevicePixels(min);
2628
}
27-
}
29+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL