mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
// Require globals first so that snapshot takes __extends function.
|
||||
import '../globals';
|
||||
// apply polyfills first
|
||||
import { initGlobal } from '../globals';
|
||||
if (!(<any>global).hasInitGlobal) {
|
||||
initGlobal();
|
||||
}
|
||||
|
||||
// Types
|
||||
import { AndroidApplication, iOSApplication } from '.';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Types
|
||||
import { iOSApplication as iOSApplicationDefinition } from '.';
|
||||
import { ApplicationEventData, CssChangedEventData, LaunchEventData, LoadAppCSSEventData, OrientationChangedEventData, SystemAppearanceChangedEventData } from './application-interfaces';
|
||||
import { View } from '../ui/core/view';
|
||||
import { NavigationEntry } from '../ui/frame/frame-interfaces';
|
||||
|
||||
// Require
|
||||
import { displayedEvent, exitEvent, getCssFileName, launchEvent, livesync, lowMemoryEvent, notify, on, orientationChanged, orientationChangedEvent, resumeEvent, setApplication, suspendEvent, systemAppearanceChanged, systemAppearanceChangedEvent } from './application-common';
|
||||
// First reexport so that app module is initialized.
|
||||
export * from './application-common';
|
||||
|
||||
import { View } from '../ui/core/view';
|
||||
import { NavigationEntry } from '../ui/frame/frame-interfaces';
|
||||
// TODO: Remove this and get it from global to decouple builder for angular
|
||||
import { Builder } from '../ui/builder';
|
||||
import { CLASS_PREFIX, getSystemCssClasses, pushToSystemCssClasses, ROOT_VIEW_CSS_CLASS } from '../css/system-classes';
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// Required by TypeScript compiler
|
||||
import './ts-helpers';
|
||||
import './register-module-helpers';
|
||||
|
||||
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
|
||||
// Note: the method will not check for naming collisions and will override any already existing entries in the destination exports.
|
||||
global.moduleMerge = function (sourceExports: any, destExports: any) {
|
||||
for (let key in sourceExports) {
|
||||
destExports[key] = sourceExports[key];
|
||||
}
|
||||
};
|
||||
|
||||
global.zonedCallback = function (callback: Function): Function {
|
||||
if ((<any>global).zone) {
|
||||
// Zone v0.5.* style callback wrapping
|
||||
return (<any>global).zone.bind(callback);
|
||||
}
|
||||
if ((<any>global).Zone) {
|
||||
// Zone v0.6.* style callback wrapping
|
||||
return (<any>global).Zone.current.wrap(callback);
|
||||
} else {
|
||||
return callback;
|
||||
}
|
||||
};
|
||||
|
||||
(<any>global).System = {
|
||||
import(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
resolve(global.require(path));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) {
|
||||
if (descriptor) {
|
||||
const originalMethod = descriptor.value;
|
||||
|
||||
descriptor.value = function (...args: any[]) {
|
||||
console.log(`${key.toString()} is deprecated`);
|
||||
|
||||
return originalMethod.apply(this, args);
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
} else {
|
||||
console.log(`${(target && (<any>target).name) || target} is deprecated`);
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
global.Deprecated = Deprecated;
|
||||
|
||||
export function Experimental(target: Object, key?: string | symbol, descriptor?: any) {
|
||||
if (descriptor) {
|
||||
const originalMethod = descriptor.value;
|
||||
|
||||
descriptor.value = function (...args: any[]) {
|
||||
console.log(`${key.toString()} is experimental`);
|
||||
|
||||
return originalMethod.apply(this, args);
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
} else {
|
||||
console.log(`${(target && (<any>target).name) || target} is experimental`);
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
global.Experimental = Experimental;
|
||||
1
nativescript-core/globals/index.d.ts
vendored
1
nativescript-core/globals/index.d.ts
vendored
@@ -1,3 +1,2 @@
|
||||
export declare var hasInitGlobal: boolean;
|
||||
export function installPolyfills(moduleName: string, exportNames: string[]): void;
|
||||
export function initGlobal(): void;
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
export let hasInitGlobal = false;
|
||||
import * as tslib from 'tslib';
|
||||
|
||||
type ModuleLoader = (name?: string) => any;
|
||||
|
||||
interface Context {
|
||||
keys(): string[];
|
||||
(key: string): any;
|
||||
}
|
||||
|
||||
interface ExtensionMap {
|
||||
[originalFileExtension: string]: string;
|
||||
}
|
||||
|
||||
function registerOnGlobalContext(moduleName: string, exportName: string): void {
|
||||
Object.defineProperty(global, exportName, {
|
||||
@@ -30,11 +41,195 @@ export function installPolyfills(moduleName: string, exportNames: string[]) {
|
||||
}
|
||||
|
||||
export function initGlobal() {
|
||||
console.log('initPolyfills called, init:', hasInitGlobal);
|
||||
if (!hasInitGlobal) {
|
||||
hasInitGlobal = true;
|
||||
// apply global polyfills first
|
||||
require('./core');
|
||||
console.log('initGlobal called, init:', (<any>global).hasInitGlobal);
|
||||
if (!(<any>global).hasInitGlobal) {
|
||||
(<any>global).hasInitGlobal = true;
|
||||
// ts-helpers
|
||||
// Required by V8 snapshot generator
|
||||
if (!(<any>global).__extends) {
|
||||
(<any>global).__extends = function (d, b) {
|
||||
for (let p in b) {
|
||||
if (b.hasOwnProperty(p)) {
|
||||
d[p] = b[p];
|
||||
}
|
||||
}
|
||||
function __() {
|
||||
this.constructor = d;
|
||||
}
|
||||
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
|
||||
};
|
||||
}
|
||||
|
||||
// Bind the tslib helpers to global scope.
|
||||
// This is needed when we don't use importHelpers, which
|
||||
// breaks extending native-classes
|
||||
for (const fnName of Object.keys(tslib)) {
|
||||
if (typeof tslib[fnName] !== 'function') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fnName in global) {
|
||||
// Don't override globals that are already defined (ex. __extends)
|
||||
continue;
|
||||
}
|
||||
|
||||
global[fnName] = tslib[fnName];
|
||||
}
|
||||
|
||||
// module helpers
|
||||
const modules: Map<string, { moduleId: string; loader: ModuleLoader }> = new Map<string, { moduleId: string; loader: ModuleLoader }>();
|
||||
const modulesLoadedForUI = new Set<string>();
|
||||
const defaultExtensionMap: ExtensionMap = {
|
||||
'.js': '.js',
|
||||
'.ts': '.js',
|
||||
'.kt': '.js',
|
||||
'.css': '.css',
|
||||
'.scss': '.css',
|
||||
'.less': '.css',
|
||||
'.sass': '.css',
|
||||
'.xml': '.xml',
|
||||
};
|
||||
|
||||
// Cast to <any> because moduleResolvers is read-only in definitions
|
||||
(<any>global).moduleResolvers = [global.require];
|
||||
|
||||
global.registerModule = function (name: string, loader: ModuleLoader): void {
|
||||
modules.set(name, { loader, moduleId: name });
|
||||
};
|
||||
|
||||
global._unregisterModule = function _unregisterModule(name: string): void {
|
||||
modules.delete(name);
|
||||
};
|
||||
|
||||
global._isModuleLoadedForUI = function _isModuleLoadedForUI(moduleName: string): boolean {
|
||||
return modulesLoadedForUI.has(moduleName);
|
||||
};
|
||||
|
||||
global.registerWebpackModules = function registerWebpackModules(context: Context, extensionMap: ExtensionMap = {}) {
|
||||
context.keys().forEach((moduleId) => {
|
||||
const extDotIndex = moduleId.lastIndexOf('.');
|
||||
const base = moduleId.substr(0, extDotIndex);
|
||||
const originalExt = moduleId.substr(extDotIndex);
|
||||
const registerExt = extensionMap[originalExt] || defaultExtensionMap[originalExt] || originalExt;
|
||||
|
||||
// We prefer source files for webpack scenarios before compilation leftovers,
|
||||
// e. g. if we get a .js and .ts for the same module, the .js is probably the compiled version of the .ts file,
|
||||
// so we register the .ts with higher priority, similar is the case with us preferring the .scss to .css
|
||||
const isSourceFile = originalExt !== registerExt;
|
||||
const registerName = base + registerExt;
|
||||
|
||||
const registerWithName = (nickName: string) => {
|
||||
modules.set(nickName, {
|
||||
moduleId,
|
||||
loader: () => {
|
||||
return context(moduleId);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (registerName.startsWith('./') && registerName.endsWith('.js')) {
|
||||
const jsNickNames = [
|
||||
// This is extremely short version like "main-page" that was promoted to be used with global.registerModule("module-name", loaderFunc);
|
||||
registerName.substr(2, registerName.length - 5),
|
||||
// This is for supporting module names like "./main/main-page"
|
||||
registerName.substr(0, registerName.length - 3),
|
||||
// This is for supporting module names like "main/main-page.js"
|
||||
registerName.substr(2),
|
||||
];
|
||||
|
||||
jsNickNames.forEach((jsNickName) => {
|
||||
if (isSourceFile || !global.moduleExists(jsNickName)) {
|
||||
registerWithName(jsNickName);
|
||||
}
|
||||
});
|
||||
} else if (registerName.startsWith('./')) {
|
||||
const moduleNickNames = [
|
||||
// This is for supporting module names like "main/main-page.xml"
|
||||
registerName.substr(2),
|
||||
];
|
||||
|
||||
moduleNickNames.forEach((moduleNickName) => {
|
||||
if (!global.moduleExists(moduleNickName)) {
|
||||
registerWithName(moduleNickName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (isSourceFile || !global.moduleExists(registerName)) {
|
||||
registerWithName(registerName);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
global.moduleExists = function moduleExists(name: string): boolean {
|
||||
return modules.has(name);
|
||||
};
|
||||
|
||||
global.loadModule = function loadModule(name: string, isUIModule: boolean = false): any {
|
||||
const moduleInfo = modules.get(name);
|
||||
if (moduleInfo) {
|
||||
if (isUIModule) {
|
||||
modulesLoadedForUI.add(moduleInfo.moduleId);
|
||||
}
|
||||
|
||||
const result = moduleInfo.loader(name);
|
||||
|
||||
if (result.enableAutoAccept) {
|
||||
result.enableAutoAccept();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
for (let resolver of (<any>global).moduleResolvers) {
|
||||
const result = resolver(name);
|
||||
if (result) {
|
||||
modules.set(name, { moduleId: name, loader: () => result });
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
global.getRegisteredModules = function getRegisteredModules(): string[] {
|
||||
return Array.from(modules.keys());
|
||||
};
|
||||
|
||||
/**
|
||||
* Polyfills
|
||||
*/
|
||||
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
|
||||
// Note: the method will not check for naming collisions and will override any already existing entries in the destination exports.
|
||||
global.moduleMerge = function (sourceExports: any, destExports: any) {
|
||||
for (let key in sourceExports) {
|
||||
destExports[key] = sourceExports[key];
|
||||
}
|
||||
};
|
||||
|
||||
global.zonedCallback = function (callback: Function): Function {
|
||||
if ((<any>global).zone) {
|
||||
// Zone v0.5.* style callback wrapping
|
||||
return (<any>global).zone.bind(callback);
|
||||
}
|
||||
if ((<any>global).Zone) {
|
||||
// Zone v0.6.* style callback wrapping
|
||||
return (<any>global).Zone.current.wrap(callback);
|
||||
} else {
|
||||
return callback;
|
||||
}
|
||||
};
|
||||
|
||||
(<any>global).System = {
|
||||
import(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
resolve(global.require(path));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
// DOM api polyfills
|
||||
global.registerModule('timer', () => require('../timer'));
|
||||
@@ -56,6 +251,41 @@ export function initGlobal() {
|
||||
installPolyfills('fetch', ['fetch', 'Headers', 'Request', 'Response']);
|
||||
|
||||
// Custom decorators
|
||||
require('./decorators');
|
||||
|
||||
global.Deprecated = function (target: Object, key?: string | symbol, descriptor?: any) {
|
||||
if (descriptor) {
|
||||
const originalMethod = descriptor.value;
|
||||
|
||||
descriptor.value = function (...args: any[]) {
|
||||
console.log(`${key.toString()} is deprecated`);
|
||||
|
||||
return originalMethod.apply(this, args);
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
} else {
|
||||
console.log(`${(target && (<any>target).name) || target} is deprecated`);
|
||||
|
||||
return target;
|
||||
}
|
||||
};
|
||||
|
||||
global.Experimental = function (target: Object, key?: string | symbol, descriptor?: any) {
|
||||
if (descriptor) {
|
||||
const originalMethod = descriptor.value;
|
||||
|
||||
descriptor.value = function (...args: any[]) {
|
||||
console.log(`${key.toString()} is experimental`);
|
||||
|
||||
return originalMethod.apply(this, args);
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
} else {
|
||||
console.log(`${(target && (<any>target).name) || target} is experimental`);
|
||||
|
||||
return target;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
type ModuleLoader = (name?: string) => any;
|
||||
|
||||
interface Context {
|
||||
keys(): string[];
|
||||
(key: string): any;
|
||||
}
|
||||
|
||||
interface ExtensionMap {
|
||||
[originalFileExtension: string]: string;
|
||||
}
|
||||
|
||||
const modules: Map<string, { moduleId: string; loader: ModuleLoader }> = new Map<string, { moduleId: string; loader: ModuleLoader }>();
|
||||
const modulesLoadedForUI = new Set<string>();
|
||||
const defaultExtensionMap: ExtensionMap = {
|
||||
'.js': '.js',
|
||||
'.ts': '.js',
|
||||
'.kt': '.js',
|
||||
'.css': '.css',
|
||||
'.scss': '.css',
|
||||
'.less': '.css',
|
||||
'.sass': '.css',
|
||||
'.xml': '.xml',
|
||||
};
|
||||
|
||||
// Cast to <any> because moduleResolvers is read-only in definitions
|
||||
(<any>global).moduleResolvers = [global.require];
|
||||
|
||||
global.registerModule = function (name: string, loader: ModuleLoader): void {
|
||||
modules.set(name, { loader, moduleId: name });
|
||||
};
|
||||
|
||||
global._unregisterModule = function _unregisterModule(name: string): void {
|
||||
modules.delete(name);
|
||||
};
|
||||
|
||||
global._isModuleLoadedForUI = function _isModuleLoadedForUI(moduleName: string): boolean {
|
||||
return modulesLoadedForUI.has(moduleName);
|
||||
};
|
||||
|
||||
global.registerWebpackModules = function registerWebpackModules(context: Context, extensionMap: ExtensionMap = {}) {
|
||||
context.keys().forEach((moduleId) => {
|
||||
const extDotIndex = moduleId.lastIndexOf('.');
|
||||
const base = moduleId.substr(0, extDotIndex);
|
||||
const originalExt = moduleId.substr(extDotIndex);
|
||||
const registerExt = extensionMap[originalExt] || defaultExtensionMap[originalExt] || originalExt;
|
||||
|
||||
// We prefer source files for webpack scenarios before compilation leftovers,
|
||||
// e. g. if we get a .js and .ts for the same module, the .js is probably the compiled version of the .ts file,
|
||||
// so we register the .ts with higher priority, similar is the case with us preferring the .scss to .css
|
||||
const isSourceFile = originalExt !== registerExt;
|
||||
const registerName = base + registerExt;
|
||||
|
||||
const registerWithName = (nickName: string) => {
|
||||
modules.set(nickName, {
|
||||
moduleId,
|
||||
loader: () => {
|
||||
return context(moduleId);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (registerName.startsWith('./') && registerName.endsWith('.js')) {
|
||||
const jsNickNames = [
|
||||
// This is extremely short version like "main-page" that was promoted to be used with global.registerModule("module-name", loaderFunc);
|
||||
registerName.substr(2, registerName.length - 5),
|
||||
// This is for supporting module names like "./main/main-page"
|
||||
registerName.substr(0, registerName.length - 3),
|
||||
// This is for supporting module names like "main/main-page.js"
|
||||
registerName.substr(2),
|
||||
];
|
||||
|
||||
jsNickNames.forEach((jsNickName) => {
|
||||
if (isSourceFile || !global.moduleExists(jsNickName)) {
|
||||
registerWithName(jsNickName);
|
||||
}
|
||||
});
|
||||
} else if (registerName.startsWith('./')) {
|
||||
const moduleNickNames = [
|
||||
// This is for supporting module names like "main/main-page.xml"
|
||||
registerName.substr(2),
|
||||
];
|
||||
|
||||
moduleNickNames.forEach((moduleNickName) => {
|
||||
if (!global.moduleExists(moduleNickName)) {
|
||||
registerWithName(moduleNickName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (isSourceFile || !global.moduleExists(registerName)) {
|
||||
registerWithName(registerName);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
global.moduleExists = function moduleExists(name: string): boolean {
|
||||
return modules.has(name);
|
||||
};
|
||||
|
||||
global.loadModule = function loadModule(name: string, isUIModule: boolean = false): any {
|
||||
const moduleInfo = modules.get(name);
|
||||
if (moduleInfo) {
|
||||
if (isUIModule) {
|
||||
modulesLoadedForUI.add(moduleInfo.moduleId);
|
||||
}
|
||||
|
||||
const result = moduleInfo.loader(name);
|
||||
|
||||
if (result.enableAutoAccept) {
|
||||
result.enableAutoAccept();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
for (let resolver of (<any>global).moduleResolvers) {
|
||||
const result = resolver(name);
|
||||
if (result) {
|
||||
modules.set(name, { moduleId: name, loader: () => result });
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
global.getRegisteredModules = function getRegisteredModules(): string[] {
|
||||
return Array.from(modules.keys());
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
// Required by V8 snapshot generator
|
||||
if (!global.__extends) {
|
||||
global.__extends = function (d, b) {
|
||||
for (let p in b) {
|
||||
if (b.hasOwnProperty(p)) {
|
||||
d[p] = b[p];
|
||||
}
|
||||
}
|
||||
function __() {
|
||||
this.constructor = d;
|
||||
}
|
||||
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
|
||||
};
|
||||
}
|
||||
|
||||
import * as tslib from 'tslib';
|
||||
|
||||
// Bind the tslib helpers to global scope.
|
||||
// This is needed when we don't use importHelpers, which
|
||||
// breaks extending native-classes
|
||||
for (const fnName of Object.keys(tslib)) {
|
||||
if (typeof tslib[fnName] !== 'function') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fnName in global) {
|
||||
// Don't override globals that are already defined (ex. __extends)
|
||||
continue;
|
||||
}
|
||||
|
||||
global[fnName] = tslib[fnName];
|
||||
}
|
||||
79
nativescript-core/index.d.ts
vendored
79
nativescript-core/index.d.ts
vendored
@@ -27,6 +27,32 @@ export declare const Application: {
|
||||
hasLaunched: typeof hasLaunched;
|
||||
android: AndroidApplication;
|
||||
ios: iOSApplication;
|
||||
} = {
|
||||
launchEvent: 'launch',
|
||||
displayedEvent: 'displayed',
|
||||
uncaughtErrorEvent: 'uncaughtError',
|
||||
discardedErrorEvent: 'discardedError',
|
||||
suspendEvent: 'suspend',
|
||||
resumeEvent: 'resume',
|
||||
exitEvent: 'exit',
|
||||
lowMemoryEvent: 'lowMemory',
|
||||
orientationChangedEvent: 'orientationChanged',
|
||||
getMainEntry,
|
||||
getRootView,
|
||||
resetRootView,
|
||||
setResources,
|
||||
setCssFileName,
|
||||
getCssFileName,
|
||||
loadAppCss,
|
||||
addCss,
|
||||
on,
|
||||
off,
|
||||
run,
|
||||
orientation,
|
||||
getNativeApplication,
|
||||
hasLaunched,
|
||||
android,
|
||||
ios,
|
||||
};
|
||||
import { setString, getString, clear, flush, getAllKeys, getBoolean, getNumber, hasKey, remove, setBoolean, setNumber } from './application-settings';
|
||||
export declare const ApplicationSettings: {
|
||||
@@ -41,6 +67,18 @@ export declare const ApplicationSettings: {
|
||||
setBoolean: typeof setBoolean;
|
||||
getNumber: typeof getNumber;
|
||||
setNumber: typeof setNumber;
|
||||
} = {
|
||||
clear,
|
||||
flush,
|
||||
hasKey,
|
||||
remove,
|
||||
setString,
|
||||
getString,
|
||||
getAllKeys,
|
||||
getBoolean,
|
||||
setBoolean,
|
||||
getNumber,
|
||||
setNumber,
|
||||
};
|
||||
export { Color } from './color';
|
||||
import { connectionType, getConnectionType, startMonitoring, stopMonitoring } from './connectivity';
|
||||
@@ -49,6 +87,11 @@ export declare const Connectivity: {
|
||||
getConnectionType: typeof getConnectionType;
|
||||
startMonitoring: typeof startMonitoring;
|
||||
stopMonitoring: typeof stopMonitoring;
|
||||
} = {
|
||||
connectionType,
|
||||
getConnectionType,
|
||||
startMonitoring,
|
||||
stopMonitoring,
|
||||
};
|
||||
export { ObservableArray, ChangeType, ChangedData } from './data/observable-array';
|
||||
export { Observable, PropertyChangeData, EventData } from './data/observable';
|
||||
@@ -62,6 +105,12 @@ export declare const Http: {
|
||||
getJSON: typeof getJSON;
|
||||
getString: typeof httpGetString;
|
||||
request: typeof request;
|
||||
} = {
|
||||
getFile,
|
||||
getImage,
|
||||
getJSON,
|
||||
getString,
|
||||
request,
|
||||
};
|
||||
export { ImageAsset, ImageAssetOptions } from './image-asset';
|
||||
export { ImageSource } from './image-source';
|
||||
@@ -81,6 +130,19 @@ export declare const Profiling: {
|
||||
profile: typeof profile;
|
||||
startCPUProfile: typeof startCPUProfile;
|
||||
stopCPUProfile: typeof stopCPUProfile;
|
||||
} = {
|
||||
enable: profilingEnable,
|
||||
disable: profilingDisable,
|
||||
time,
|
||||
uptime,
|
||||
start,
|
||||
stop,
|
||||
isRunning,
|
||||
dumpProfiles,
|
||||
resetProfiles,
|
||||
profile,
|
||||
startCPUProfile,
|
||||
stopCPUProfile,
|
||||
};
|
||||
export { encoding } from './text';
|
||||
export * from './trace';
|
||||
@@ -104,5 +166,22 @@ export declare const Utils: {
|
||||
layout: typeof layout;
|
||||
android: typeof androidUtils;
|
||||
ios: typeof iosUtils;
|
||||
} = {
|
||||
GC,
|
||||
isFontIconURI,
|
||||
isDataURI,
|
||||
isFileOrResourcePath,
|
||||
executeOnMainThread,
|
||||
mainThreadify,
|
||||
isMainThread,
|
||||
dispatchToMainThread,
|
||||
releaseNativeObject,
|
||||
getModuleName,
|
||||
openFile,
|
||||
openUrl,
|
||||
isRealDevice,
|
||||
layout,
|
||||
android,
|
||||
ios,
|
||||
};
|
||||
export { XmlParser, ParserEventType, ParserEvent } from './xml';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// <reference path="./tns-core-modules.d.ts" />
|
||||
|
||||
// apply polyfills first
|
||||
import { initGlobal, hasInitGlobal } from './globals';
|
||||
if (!hasInitGlobal) {
|
||||
// Init globals first
|
||||
import { initGlobal } from './globals';
|
||||
if (!(<any>global).hasInitGlobal) {
|
||||
initGlobal();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
console.log('Loading inspector modules...');
|
||||
require('./globals/ts-helpers');
|
||||
import { initGlobal } from './globals';
|
||||
if (!(<any>global).hasInitGlobal) {
|
||||
initGlobal();
|
||||
}
|
||||
require('./debugger/webinspector-network');
|
||||
require('./debugger/webinspector-dom');
|
||||
require('./debugger/webinspector-css');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"main": "index",
|
||||
"types": "index.d.ts",
|
||||
"description": "NativeScript Core Modules",
|
||||
"version": "7.0.0-rc.2",
|
||||
"version": "7.0.0-rc.6",
|
||||
"homepage": "https://www.nativescript.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Color } from '../../color';
|
||||
import { ImageSource } from '../../image-source';
|
||||
import { Device } from '../../platform';
|
||||
import { ios as iosUtils, isFontIconURI, layout } from '../../utils';
|
||||
import { CSSType, ios as iosView, View } from '../core/view';
|
||||
import { CSSType, IOSHelper, View } from '../core/view';
|
||||
import { Frame } from '../frame';
|
||||
import { Font } from '../styling/font';
|
||||
import { getIconSpecSize, itemsProperty, selectedIndexProperty, TabNavigationBase, tabStripProperty } from '../tab-navigation-base/tab-navigation-base';
|
||||
@@ -44,7 +44,7 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
// Unify translucent and opaque bars layout
|
||||
this.extendedLayoutIncludesOpaqueBars = true;
|
||||
|
||||
iosView.updateAutoAdjustScrollInsets(this, owner);
|
||||
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
|
||||
|
||||
if (!owner.parent) {
|
||||
owner.callLoaded();
|
||||
@@ -86,7 +86,7 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({
|
||||
eventName: iosView.traitCollectionColorAppearanceChangedEvent,
|
||||
eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent,
|
||||
object: owner,
|
||||
});
|
||||
}
|
||||
@@ -540,7 +540,7 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
newController = item.content.ios.controller;
|
||||
(<any>item).setViewController(newController, newController.view);
|
||||
} else {
|
||||
newController = iosView.UILayoutViewController.initWithOwner(new WeakRef(item.content)) as UIViewController;
|
||||
newController = IOSHelper.UILayoutViewController.initWithOwner(new WeakRef(item.content)) as UIViewController;
|
||||
newController.view.addSubview(item.content.nativeViewProtected);
|
||||
item.content.viewController = newController;
|
||||
(<any>item).setViewController(newController, item.content.nativeViewProtected);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Definitions.
|
||||
import { ComponentModule } from '.';
|
||||
import { View } from '../../core/view';
|
||||
|
||||
// Types.
|
||||
@@ -11,6 +10,11 @@ import { Device } from '../../../platform';
|
||||
import { sanitizeModuleName } from '../module-name-sanitizer';
|
||||
import { resolveModuleName } from '../../../module-name-resolver';
|
||||
|
||||
export interface ComponentModule {
|
||||
component: View;
|
||||
exports: any;
|
||||
}
|
||||
|
||||
const UI_PATH = 'ui/';
|
||||
const MODULES = {
|
||||
TabViewItem: 'ui/tab-view',
|
||||
@@ -156,7 +160,7 @@ export function getComponentModule(elementName: string, namespace: string, attri
|
||||
applyComponentCss(instance, moduleNamePath, attributes);
|
||||
}
|
||||
|
||||
applyComponentAttributes(instance, instanceModule, moduleExports);
|
||||
applyComponentAttributes(instance, instanceModule, moduleExports, attributes);
|
||||
|
||||
let componentModule;
|
||||
if (instance && instanceModule) {
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "component-builder",
|
||||
"main": "component-builder",
|
||||
"types": "component-builder.d.ts"
|
||||
}
|
||||
26
nativescript-core/ui/core/view/index.d.ts
vendored
26
nativescript-core/ui/core/view/index.d.ts
vendored
@@ -7,6 +7,9 @@ import { HorizontalAlignment, VerticalAlignment, Visibility, Length, PercentLeng
|
||||
import { GestureTypes, GestureEventData, GesturesObserver } from '../../gestures';
|
||||
import { LinearGradient } from '../../styling/gradient';
|
||||
|
||||
// helpers (these are okay re-exported here)
|
||||
export * from './view-helper';
|
||||
|
||||
export function PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator;
|
||||
|
||||
/**
|
||||
@@ -854,26 +857,3 @@ export const isEnabledProperty: Property<View, boolean>;
|
||||
export const isUserInteractionEnabledProperty: Property<View, boolean>;
|
||||
export const iosOverflowSafeAreaProperty: Property<View, boolean>;
|
||||
export const iosOverflowSafeAreaEnabledProperty: InheritedProperty<View, boolean>;
|
||||
|
||||
export namespace ios {
|
||||
/**
|
||||
* String value used when hooking to traitCollectionColorAppearanceChangedEvent event.
|
||||
*/
|
||||
export const traitCollectionColorAppearanceChangedEvent: string;
|
||||
|
||||
/**
|
||||
* Returns a view with viewController or undefined if no such found along the view's parent chain.
|
||||
* @param view The view form which to start the search.
|
||||
*/
|
||||
export function getParentWithViewController(view: View): View;
|
||||
export function updateAutoAdjustScrollInsets(controller: any /* UIViewController */, owner: View): void;
|
||||
export function updateConstraints(controller: any /* UIViewController */, owner: View): void;
|
||||
export function layoutView(controller: any /* UIViewController */, owner: View): void;
|
||||
export function getPositionFromFrame(frame: any /* CGRect */): { left; top; right; bottom };
|
||||
export function getFrameFromPosition(position: { left; top; right; bottom }, insets?: { left; top; right; bottom }): any; /* CGRect */
|
||||
export function shrinkToSafeArea(view: View, frame: any /* CGRect */): any; /* CGRect */
|
||||
export function expandBeyondSafeArea(view: View, frame: any /* CGRect */): any; /* CGRect */
|
||||
export class UILayoutViewController {
|
||||
public static initWithOwner(owner: WeakRef<View>): UILayoutViewController;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ import { TextTransform } from '../../text-base';
|
||||
|
||||
import * as am from '../../animation';
|
||||
|
||||
// helpers (these are okay re-exported here)
|
||||
export * from './view-helper';
|
||||
|
||||
let animationModule: typeof am;
|
||||
function ensureAnimationModule() {
|
||||
if (!animationModule) {
|
||||
@@ -166,7 +169,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
}
|
||||
|
||||
let handled = false;
|
||||
this.eachChildView((child) => {
|
||||
this.eachChildView((child: ViewCommon) => {
|
||||
if (child._onLivesync(context)) {
|
||||
handled = true;
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ export class ViewHelper {
|
||||
public static combineMeasuredStates(curState: number, newState): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Various iOS view helper methods
|
||||
*/
|
||||
export namespace IOSHelper {
|
||||
/**
|
||||
* String value used when hooking to traitCollectionColorAppearanceChangedEvent event.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* iOS specific dialogs functions implementation.
|
||||
*/
|
||||
import { ios as iosView } from '../core/view';
|
||||
import { Trace } from '../../trace';
|
||||
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions, getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, capitalizationType, DialogStrings, parseLoginOptions } from './dialogs-common';
|
||||
import { isString, isDefined, isFunction } from '../../utils/types';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { EditableTextBase as EditableTextBaseDefinition, KeyboardType, ReturnKeyType, UpdateTextTrigger, AutocapitalizationType } from '.';
|
||||
import { EditableTextBase as EditableTextBaseDefinition, ReturnKeyType, UpdateTextTrigger, AutocapitalizationType } from '.';
|
||||
import { TextBase } from '../text-base';
|
||||
import { Property, CssProperty, makeValidator, makeParser } from '../core/properties';
|
||||
import { PseudoClassHandler } from '../core/view';
|
||||
import { booleanConverter } from '../core/view-base';
|
||||
import { Style } from '../styling/style';
|
||||
import { Color } from '../../color';
|
||||
import { KeyboardType } from '../enums';
|
||||
|
||||
export abstract class EditableTextBase extends TextBase implements EditableTextBaseDefinition {
|
||||
public static blurEvent = 'blur';
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Color } from '../../color';
|
||||
import { FormattedString } from '../text-base/formatted-string';
|
||||
import { Style } from '../styling/style';
|
||||
import { Property, CssProperty } from '../core/properties';
|
||||
import { KeyboardType } from '../enums';
|
||||
|
||||
/**
|
||||
* Represents the base class for all editable text views.
|
||||
@@ -65,7 +66,6 @@ export class EditableTextBase extends TextBase {
|
||||
//@endprivate
|
||||
}
|
||||
|
||||
export type KeyboardType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
|
||||
export type ReturnKeyType = 'done' | 'next' | 'go' | 'search' | 'send';
|
||||
export type UpdateTextTrigger = 'focusLost' | 'textChanged';
|
||||
export type AutocapitalizationType = 'none' | 'words' | 'sentences' | 'allcharacters';
|
||||
@@ -86,5 +86,3 @@ export const maxLengthProperty: Property<EditableTextBase, number>;
|
||||
*/
|
||||
export function _updateCharactersInRangeReplacementString(formattedText: FormattedString, rangeLocation: number, rangeLength: number, replacementString: string): void;
|
||||
//@endprivate
|
||||
|
||||
export * from '../text-base';
|
||||
|
||||
15
nativescript-core/ui/enums/index.d.ts
vendored
15
nativescript-core/ui/enums/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { CubicBezierAnimationCurve } from '../animation';
|
||||
import { KeyboardType as BaseKeyboardType, ReturnKeyType as BaseReturnKeyType, UpdateTextTrigger as BaseUpdateTrigger, AutocapitalizationType as BaseAutocapitalizationType } from '../editable-text-base';
|
||||
import { ReturnKeyType as BaseReturnKeyType, UpdateTextTrigger as BaseUpdateTrigger, AutocapitalizationType as BaseAutocapitalizationType } from '../editable-text-base';
|
||||
|
||||
import { WhiteSpace as BaseWhiteSpace, TextAlignment as BaseTextAlignment, TextTransform as BaseTextTransform, TextDecoration as BaseTextDecoration } from '../text-base';
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Stretch as BaseStretch } from '../image';
|
||||
|
||||
import { FontStyle as BaseFontStyle, FontWeight as BaseFontWeight } from '../styling/font-common';
|
||||
|
||||
export type KeyboardType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
|
||||
/**
|
||||
* Represents a soft keyboard flavor.
|
||||
*/
|
||||
@@ -21,36 +22,36 @@ export module KeyboardType {
|
||||
* Android: [TYPE_CLASS_DATETIME](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_DATETIME) | [TYPE_DATETIME_VARIATION_NORMAL](http://developer.android.com/reference/android/text/InputType.html#TYPE_DATETIME_VARIATION_NORMAL)
|
||||
* iOS: [UIKeyboardTypeNumbersAndPunctuation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
|
||||
*/
|
||||
export const datetime: BaseKeyboardType;
|
||||
export const datetime: KeyboardType;
|
||||
/**
|
||||
* Android: [TYPE_CLASS_PHONE](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_PHONE)
|
||||
* iOS: [UIKeyboardTypePhonePad](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
|
||||
*/
|
||||
export const phone: BaseKeyboardType;
|
||||
export const phone: KeyboardType;
|
||||
|
||||
/**
|
||||
* Android: [TYPE_CLASS_NUMBER](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_NUMBER) | [TYPE_NUMBER_VARIATION_NORMAL](http://developer.android.com/intl/es/reference/android/text/InputType.html#TYPE_NUMBER_VARIATION_NORMAL) | [TYPE_NUMBER_FLAG_SIGNED](http://developer.android.com/reference/android/text/InputType.html#TYPE_NUMBER_FLAG_SIGNED) | [TYPE_NUMBER_FLAG_DECIMAL](http://developer.android.com/reference/android/text/InputType.html#TYPE_NUMBER_FLAG_DECIMAL)
|
||||
* iOS: [UIKeyboardTypeNumbersAndPunctuation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
|
||||
*/
|
||||
export const number: BaseKeyboardType;
|
||||
export const number: KeyboardType;
|
||||
|
||||
/**
|
||||
* Android: [TYPE_CLASS_TEXT](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_TEXT) | [TYPE_TEXT_VARIATION_URI](http://developer.android.com/reference/android/text/InputType.html#TYPE_TEXT_VARIATION_URI)
|
||||
* iOS: [UIKeyboardTypeURL](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
|
||||
*/
|
||||
export const url: BaseKeyboardType;
|
||||
export const url: KeyboardType;
|
||||
|
||||
/**
|
||||
* Android: [TYPE_CLASS_TEXT](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_TEXT) | [TYPE_TEXT_VARIATION_EMAIL_ADDRESS](http://developer.android.com/reference/android/text/InputType.html#TYPE_TEXT_VARIATION_EMAIL_ADDRESS)
|
||||
* iOS: [UIKeyboardTypeEmailAddress](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
|
||||
*/
|
||||
export const email: BaseKeyboardType;
|
||||
export const email: KeyboardType;
|
||||
|
||||
/**
|
||||
* Android: [TYPE_CLASS_NUMBER](http://developer.android.com/reference/android/text/InputType.html#TYPE_CLASS_NUMBER | [TYPE_NUMBER_VARIATION_PASSWORD](android type_text_variation_password))
|
||||
* iOS: [UIKeyboardTypeNumberPad](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html#//apple_ref/c/tdef/UIKeyboardType)
|
||||
*/
|
||||
export const integer: BaseKeyboardType;
|
||||
export const integer: KeyboardType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// imported for definition purposes only
|
||||
import * as animationModule from '../../ui/animation';
|
||||
|
||||
export type KeyboardType = 'datetime' | 'phone' | 'number' | 'url' | 'email' | 'integer';
|
||||
export module KeyboardType {
|
||||
export const datetime = 'datetime';
|
||||
export const phone = 'phone';
|
||||
|
||||
2
nativescript-core/ui/index.d.ts
vendored
2
nativescript-core/ui/index.d.ts
vendored
@@ -14,6 +14,8 @@ export { DatePicker } from './date-picker';
|
||||
export { action, alert, confirm, login, prompt, getCurrentPage, Dialogs, DialogStrings, DialogOptions, CancelableOptions, AlertOptions, PromptResult, PromptOptions, ActionOptions, ConfirmOptions, LoginResult, LoginOptions, inputType, capitalizationType } from './dialogs';
|
||||
|
||||
export * from './editable-text-base';
|
||||
import * as enumsModule from './enums';
|
||||
export const Enums = enumsModule;
|
||||
export { Frame, NavigationEntry, NavigationContext, NavigationTransition, BackstackEntry, ViewEntry } from './frame';
|
||||
|
||||
export { GestureEventData, GestureEventDataWithState, GestureStateTypes, GestureTypes, GesturesObserver, TapGestureEventData, PanGestureEventData, PinchGestureEventData, RotationGestureEventData, SwipeDirection, SwipeGestureEventData, TouchGestureEventData } from './gestures';
|
||||
|
||||
@@ -14,6 +14,8 @@ export { DatePicker } from './date-picker';
|
||||
export { action, alert, confirm, login, prompt, getCurrentPage, Dialogs, DialogStrings, DialogOptions, CancelableOptions, AlertOptions, PromptResult, PromptOptions, ActionOptions, ConfirmOptions, LoginResult, LoginOptions, inputType, capitalizationType } from './dialogs';
|
||||
|
||||
export * from './editable-text-base';
|
||||
import * as enumsModule from './enums';
|
||||
export const Enums = enumsModule;
|
||||
export { Frame, NavigationEntry, NavigationContext, NavigationTransition, BackstackEntry, ViewEntry } from './frame';
|
||||
|
||||
export { GestureEventData, GestureEventDataWithState, GestureStateTypes, GestureTypes, GesturesObserver, TapGestureEventData, PanGestureEventData, PinchGestureEventData, RotationGestureEventData, SwipeDirection, SwipeGestureEventData, TouchGestureEventData } from './gestures';
|
||||
@@ -49,7 +51,7 @@ export { TabStrip, TabStripItemEventData } from './tab-navigation-base/tab-strip
|
||||
export { TabStripItem } from './tab-navigation-base/tab-strip-item';
|
||||
export { TabView, TabViewItem } from './tab-view';
|
||||
export { Tabs } from './tabs';
|
||||
export { TextBase } from './text-base';
|
||||
export { TextBase, TextTransform } from './text-base';
|
||||
export { FormattedString } from './text-base/formatted-string';
|
||||
export { Span } from './text-base/span';
|
||||
export { TextField } from './text-field';
|
||||
|
||||
2
nativescript-core/ui/layouts/index.d.ts
vendored
2
nativescript-core/ui/layouts/index.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
export { AbsoluteLayout } from './absolute-layout';
|
||||
export { DockLayout } from './dock-layout';
|
||||
export { FlexboxLayout } from './flexbox-layout';
|
||||
export { GridLayout, GridUnitType } from './grid-layout';
|
||||
export { GridLayout, GridUnitType, ItemSpec } from './grid-layout';
|
||||
export { StackLayout } from './stack-layout';
|
||||
export { WrapLayout } from './wrap-layout';
|
||||
export { LayoutBase } from './layout-base';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export { AbsoluteLayout } from './absolute-layout';
|
||||
export { DockLayout } from './dock-layout';
|
||||
export { FlexboxLayout } from './flexbox-layout';
|
||||
export { GridLayout, GridUnitType } from './grid-layout';
|
||||
export { GridLayout, GridUnitType, ItemSpec } from './grid-layout';
|
||||
export { StackLayout } from './stack-layout';
|
||||
export { WrapLayout } from './wrap-layout';
|
||||
export { LayoutBase } from './layout-base';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Frame, BackstackEntry } from '../frame';
|
||||
import { NavigationType } from '../frame/frame-common';
|
||||
|
||||
// Types.
|
||||
import { ios as iosView, View } from '../core/view';
|
||||
import { View, IOSHelper } from '../core/view';
|
||||
import { PageBase, actionBarHiddenProperty, statusBarStyleProperty } from './page-common';
|
||||
|
||||
import { profile } from '../../profiling';
|
||||
@@ -118,7 +118,7 @@ class UIViewControllerImpl extends UIViewController {
|
||||
}
|
||||
|
||||
// Set autoAdjustScrollInsets in will appear - as early as possible
|
||||
iosView.updateAutoAdjustScrollInsets(this, owner);
|
||||
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
|
||||
|
||||
// Pages in backstack are unloaded so raise loaded here.
|
||||
if (!owner.isLoaded) {
|
||||
@@ -242,7 +242,7 @@ class UIViewControllerImpl extends UIViewController {
|
||||
super.viewWillLayoutSubviews();
|
||||
const owner = this._owner.get();
|
||||
if (owner) {
|
||||
iosView.updateConstraints(this, owner);
|
||||
IOSHelper.updateConstraints(this, owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ class UIViewControllerImpl extends UIViewController {
|
||||
}
|
||||
}
|
||||
|
||||
iosView.layoutView(this, owner);
|
||||
IOSHelper.layoutView(this, owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ class UIViewControllerImpl extends UIViewController {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({
|
||||
eventName: iosView.traitCollectionColorAppearanceChangedEvent,
|
||||
eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent,
|
||||
object: owner,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,4 +111,21 @@ export const fontInternalProperty: InheritedCssProperty<Style, Font>;
|
||||
export type BackgroundRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
||||
export type Visibility = 'visible' | 'hidden' | 'collapse';
|
||||
export type HorizontalAlignment = 'left' | 'center' | 'right' | 'stretch';
|
||||
export type VerticalAlignment = 'top' | 'middle' | 'bottom' | 'stretch';
|
||||
export namespace HorizontalAlignment {
|
||||
export const LEFT: 'left';
|
||||
export const CENTER: 'center';
|
||||
export const RIGHT: 'right';
|
||||
export const STRETCH: 'stretch';
|
||||
}
|
||||
export type VerticalAlignment = 'top' | 'middle' | 'bottom' | 'stretch' | 'text-top' | 'text-bottom' | 'super' | 'sub' | 'baseline';
|
||||
export namespace VerticalAlignment {
|
||||
export const TOP: 'top';
|
||||
export const MIDDLE: 'middle';
|
||||
export const BOTTOM: 'bottom';
|
||||
export const STRETCH: 'stretch';
|
||||
export const TEXTTOP: 'text-top';
|
||||
export const TEXTBOTTOM: 'text-bottom';
|
||||
export const SUPER: 'super';
|
||||
export const SUB: 'sub';
|
||||
export const BASELINE: 'baseline';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TabViewItem as TabViewItemDefinition } from '.';
|
||||
import { Font } from '../styling/font';
|
||||
|
||||
import { ios as iosView, View } from '../core/view';
|
||||
import { IOSHelper, View } from '../core/view';
|
||||
import { ViewBase } from '../core/view-base';
|
||||
import { TabViewBase, TabViewItemBase, itemsProperty, selectedIndexProperty, tabTextColorProperty, tabTextFontSizeProperty, tabBackgroundColorProperty, selectedTabTextColorProperty, iosIconRenderingModeProperty, traceMissingIcon } from './tab-view-common';
|
||||
import { Color } from '../../color';
|
||||
@@ -44,7 +44,7 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
return;
|
||||
}
|
||||
|
||||
iosView.updateAutoAdjustScrollInsets(this, owner);
|
||||
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
|
||||
|
||||
if (!owner.parent) {
|
||||
owner.callLoaded();
|
||||
@@ -78,7 +78,7 @@ class UITabBarControllerImpl extends UITabBarController {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({
|
||||
eventName: iosView.traitCollectionColorAppearanceChangedEvent,
|
||||
eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent,
|
||||
object: owner,
|
||||
});
|
||||
}
|
||||
@@ -432,7 +432,7 @@ export class TabView extends TabViewBase {
|
||||
newController = item.view.ios.controller;
|
||||
item.setViewController(newController, newController.view);
|
||||
} else {
|
||||
newController = iosView.UILayoutViewController.initWithOwner(new WeakRef(item.view)) as UIViewController;
|
||||
newController = IOSHelper.UILayoutViewController.initWithOwner(new WeakRef(item.view)) as UIViewController;
|
||||
newController.view.addSubview(item.view.nativeViewProtected);
|
||||
item.view.viewController = newController;
|
||||
item.setViewController(newController, item.view.nativeViewProtected);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Color } from '../../color';
|
||||
import { ImageSource } from '../../image-source';
|
||||
import { Device } from '../../platform';
|
||||
import { ios as iosUtils, isFontIconURI, layout } from '../../utils';
|
||||
import { ios as iosView, View } from '../core/view';
|
||||
import { IOSHelper, View } from '../core/view';
|
||||
import { ViewBase } from '../core/view-base';
|
||||
import { Frame } from '../frame';
|
||||
import { Font } from '../styling/font';
|
||||
@@ -144,7 +144,7 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
return;
|
||||
}
|
||||
|
||||
iosView.updateAutoAdjustScrollInsets(this, owner);
|
||||
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
|
||||
|
||||
// Tabs can be reset as a root view. Call loaded here in this scenario.
|
||||
if (!owner.isLoaded) {
|
||||
@@ -234,7 +234,7 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
const owner = this._owner.get();
|
||||
if (owner && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection && this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
||||
owner.notify({
|
||||
eventName: iosView.traitCollectionColorAppearanceChangedEvent,
|
||||
eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent,
|
||||
object: owner,
|
||||
});
|
||||
}
|
||||
@@ -665,7 +665,7 @@ export class Tabs extends TabsBase {
|
||||
newController = item.content.ios.controller;
|
||||
(<any>item).setViewController(newController, newController.view);
|
||||
} else {
|
||||
newController = iosView.UILayoutViewController.initWithOwner(new WeakRef(item.content)) as UIViewController;
|
||||
newController = IOSHelper.UILayoutViewController.initWithOwner(new WeakRef(item.content)) as UIViewController;
|
||||
newController.view.addSubview(item.content.nativeViewProtected);
|
||||
item.content.viewController = newController;
|
||||
(<any>item).setViewController(newController, item.content.nativeViewProtected);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ScrollEventData } from '../scroll-view';
|
||||
import { textProperty } from '../text-base';
|
||||
import { TextViewBase as TextViewBaseCommon, maxLinesProperty } from './text-view-common';
|
||||
import { editableProperty, hintProperty, textProperty, placeholderColorProperty, _updateCharactersInRangeReplacementString } from '../editable-text-base';
|
||||
import { editableProperty, hintProperty, placeholderColorProperty, _updateCharactersInRangeReplacementString } from '../editable-text-base';
|
||||
import { CSSType } from '../core/view';
|
||||
import { Color } from '../../color';
|
||||
import { colorProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, Length } from '../styling/style-properties';
|
||||
|
||||
Reference in New Issue
Block a user