From a2e1aa246e6a9cbdd6d2c4647c9740ef411ad51a Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 9 Sep 2020 09:15:57 -0700 Subject: [PATCH] feat(core): export additional properties for plugin usage (#8835) --- packages/core/index.d.ts | 8 +++++++- packages/core/index.ts | 15 +++++++++++---- packages/core/ui/index.ts | 2 +- workspace.json | 28 +++++++--------------------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 423232b1d..99a8e4f3f 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -8,7 +8,7 @@ export type { NativeScriptConfig } from './config'; export { iOSApplication, AndroidApplication } from './application'; export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application'; -import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application'; +import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application'; export declare const Application: { launchEvent: string; displayedEvent: string; @@ -32,6 +32,8 @@ export declare const Application: { addCss: typeof addCss; on: typeof on; off: typeof off; + notify: typeof notify; + hasListeners: typeof hasListeners; run: typeof run; orientation: typeof orientation; getNativeApplication: typeof getNativeApplication; @@ -113,6 +115,10 @@ export declare const Utils: { android: typeof androidUtils; ad: typeof androidUtils; ios: typeof iosUtils; + setTimeout: typeof setTimeout; + setInterval: typeof setInterval; + clearInterval: typeof clearInterval; + clearTimeout: typeof clearTimeout; Source: typeof Source; ClassInfo: typeof ClassInfo; getClass: typeof getClass; diff --git a/packages/core/index.ts b/packages/core/index.ts index 39a56d0dc..68f03d56b 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -6,7 +6,7 @@ nsGlobals.initGlobal(); export { iOSApplication, AndroidApplication } from './application'; export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application'; -import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application'; +import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application'; export const Application = { launchEvent, displayedEvent, @@ -30,7 +30,9 @@ export const Application = { loadAppCss, addCss, on, - off, + off, + notify, + hasListeners, run, orientation, getNativeApplication, @@ -103,7 +105,8 @@ export { profile, enable as profilingEnable, disable as profilingDisable, time a export type { InstrumentationMode, TimerInfo } from './profiling'; export { encoding } from './text'; - +// for developers to be explicit if they desire around globals (allows access via Utils below) +import { setTimeout, setInterval, clearInterval, clearTimeout } from './timer'; export * from './trace'; export * from './ui'; @@ -133,7 +136,11 @@ export const Utils = { android: androidUtils, // legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android) ad: androidUtils, - ios: iosUtils, + ios: iosUtils, + setTimeout, + setInterval, + clearInterval, + clearTimeout, Source, ClassInfo, getClass, diff --git a/packages/core/ui/index.ts b/packages/core/ui/index.ts index 3cf1adefd..4304ae45c 100644 --- a/packages/core/ui/index.ts +++ b/packages/core/ui/index.ts @@ -74,7 +74,7 @@ export type { 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, getTransformedText } from './text-base'; +export { TextBase, getTransformedText, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, whiteSpaceProperty, lineHeightProperty } from './text-base'; export type { TextTransform } from './text-base'; export { FormattedString } from './text-base/formatted-string'; export { Span } from './text-base/span'; diff --git a/workspace.json b/workspace.json index f11d5a5a8..d08978ac0 100644 --- a/workspace.json +++ b/workspace.json @@ -300,12 +300,8 @@ "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ - { - "command": "./build.sh" - }, - { - "command": "cp -R dist/package/platforms/* ../../packages/core/platforms" - } + "./build.sh", + "cp -R dist/package/platforms/* ../../packages/core/platforms" ], "cwd": "packages/ui-mobile-base", "parallel": false @@ -337,12 +333,8 @@ "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ - { - "command": "npm run tsc" - }, - { - "command": "npm run jasmine" - } + "npm run tsc", + "npm run jasmine" ], "cwd": "packages/webpack", "parallel": false @@ -353,15 +345,9 @@ "outputs": ["dist/packages"], "options": { "commands": [ - { - "command": "npm run setup" - }, - { - "command": "mkdir -p ../../dist/packages" - }, - { - "command": "mv \"$(npm pack | tail -n 1)\" ../../dist/packages/nativescript-webpack.tgz" - } + "npm run setup", + "mkdir -p ../../dist/packages", + "mv \"$(npm pack | tail -n 1)\" ../../dist/packages/nativescript-webpack.tgz" ], "cwd": "packages/webpack", "parallel": false