From 266ae2a71d4e4bb1c0d8d961fa20b502b4d345a9 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 26 Mar 2021 16:32:24 -0700 Subject: [PATCH] chore: fix types --- packages/core/ui/core/view/index.d.ts | 2 +- packages/core/ui/editable-text-base/index.d.ts | 2 +- packages/core/ui/image/index.d.ts | 10 +++++----- packages/core/ui/layouts/absolute-layout/index.d.ts | 11 ++++++----- packages/core/ui/layouts/dock-layout/index.d.ts | 4 ++-- packages/core/ui/layouts/root-layout/index.d.ts | 1 - packages/core/ui/layouts/stack-layout/index.d.ts | 2 +- packages/core/ui/layouts/wrap-layout/index.d.ts | 13 +++++++------ packages/core/ui/list-view/index.d.ts | 5 +++-- packages/core/ui/scroll-view/index.d.ts | 5 +++-- packages/core/ui/styling/gradient.d.ts | 4 ++-- packages/core/ui/tab-view/index.d.ts | 3 ++- packages/core/ui/text-base/index.d.ts | 10 +++++----- packages/core/utils/index.d.ts | 8 ++++---- 14 files changed, 42 insertions(+), 38 deletions(-) diff --git a/packages/core/ui/core/view/index.d.ts b/packages/core/ui/core/view/index.d.ts index 067fa37b8..b4cc92eb3 100644 --- a/packages/core/ui/core/view/index.d.ts +++ b/packages/core/ui/core/view/index.d.ts @@ -6,7 +6,7 @@ import { Animation, AnimationDefinition, AnimationPromise } from '../../animatio import { GestureTypes, GesturesObserver } from '../../gestures'; import { LinearGradient } from '../../styling/gradient'; import { AccessibilityLiveRegion, AccessibilityRole, AccessibilityState, AccessibilityTrait, AccessibilityEventOptions } from '../../../accessibility/accessibility-types'; -import { CoreTypes } from '../../core-types'; +import { CoreTypes } from '../../../core-types'; import { CSSShadow } from '../../styling/css-shadow'; // helpers (these are okay re-exported here) diff --git a/packages/core/ui/editable-text-base/index.d.ts b/packages/core/ui/editable-text-base/index.d.ts index 3821fb383..9e3fafbd0 100644 --- a/packages/core/ui/editable-text-base/index.d.ts +++ b/packages/core/ui/editable-text-base/index.d.ts @@ -31,7 +31,7 @@ export class EditableTextBase extends TextBase { /** * Gets or sets the autocapitalization type. */ - autocapitalizationType: CoreTypes.AutocapitalizationType; + autocapitalizationType: CoreTypes.AutocapitalizationInputType; /** * Gets or sets whether the instance is editable. diff --git a/packages/core/ui/image/index.d.ts b/packages/core/ui/image/index.d.ts index ffc04302d..c81588c37 100644 --- a/packages/core/ui/image/index.d.ts +++ b/packages/core/ui/image/index.d.ts @@ -37,7 +37,7 @@ export class Image extends View { /** * Gets or sets the image stretch mode. */ - stretch: Stretch; + stretch: CoreTypes.ImageStretchType; /** * Gets or sets the loading strategy for images on the local file system: @@ -56,13 +56,13 @@ export class Image extends View { * Gets or sets the desired decode height of the image. * This property is Android specific. */ - decodeHeight: Length; + decodeHeight: CoreTypes.LengthType; /** * Gets or sets the desired decode width of the image. * This property is Android specific. */ - decodeWidth: Length; + decodeWidth: CoreTypes.LengthType; } export const imageSourceProperty: Property; @@ -71,5 +71,5 @@ export const isLoadingProperty: Property; export const loadMode: Property; export const stretchProperty: Property; export const tintColorProperty: InheritedCssProperty; -export const decodeHeightProperty: Property; -export const decodeWidthProperty: Property; +export const decodeHeightProperty: Property; +export const decodeWidthProperty: Property; diff --git a/packages/core/ui/layouts/absolute-layout/index.d.ts b/packages/core/ui/layouts/absolute-layout/index.d.ts index 37167409f..d430b2828 100644 --- a/packages/core/ui/layouts/absolute-layout/index.d.ts +++ b/packages/core/ui/layouts/absolute-layout/index.d.ts @@ -2,6 +2,7 @@ import { Property } from '../../core/properties'; import { View } from '../../core/view'; import { Length } from '../../styling/style-properties'; +import { CoreTypes } from '../../../core-types'; /** * A layout that lets you specify exact locations (left/top coordinates) of its children. @@ -10,7 +11,7 @@ export class AbsoluteLayout extends LayoutBase { /** * Gets the value of the Left property from a given View. */ - static getLeft(view: View): Length; + static getLeft(view: View): CoreTypes.LengthType; /** * Sets the value of the Left property from a given View. @@ -20,20 +21,20 @@ export class AbsoluteLayout extends LayoutBase { /** * Gets the value of the Top property from a given View. */ - static getTop(view: View): Length; + static getTop(view: View): CoreTypes.LengthType; /** * Sets the value of the Top property from a given View. */ - static setTop(view: View, value: Length): void; + static setTop(view: View, value: CoreTypes.LengthType): void; } /** * Represents the observable property backing the left property. */ -export const leftProperty: Property; +export const leftProperty: Property; /** * Represents the observable property backing the top property. */ -export const topProperty: Property; +export const topProperty: Property; diff --git a/packages/core/ui/layouts/dock-layout/index.d.ts b/packages/core/ui/layouts/dock-layout/index.d.ts index fc007c466..bdbff74e5 100644 --- a/packages/core/ui/layouts/dock-layout/index.d.ts +++ b/packages/core/ui/layouts/dock-layout/index.d.ts @@ -10,12 +10,12 @@ export class DockLayout extends LayoutBase { /** * Gets the value of the Dock property from a given View. */ - static getDock(view: View): Dock; + static getDock(view: View): CoreTypes.DockType; /** * Sets the value of the Dock property from a given View. */ - static setDock(view: View, value: Dock): void; + static setDock(view: View, value: CoreTypes.DockType): void; /** * Gets or sets a value that indicates whether the last child element within a DockLayout stretches to fill the remaining available space. diff --git a/packages/core/ui/layouts/root-layout/index.d.ts b/packages/core/ui/layouts/root-layout/index.d.ts index 4fa954944..93e7b0300 100644 --- a/packages/core/ui/layouts/root-layout/index.d.ts +++ b/packages/core/ui/layouts/root-layout/index.d.ts @@ -1,6 +1,5 @@ import { GridLayout } from '../grid-layout'; import { View } from '../../core/view'; -import { AnimationCurve } from '../../../core-types'; export class RootLayout extends GridLayout { open(view: View, options?: RootLayoutOptions): Promise; diff --git a/packages/core/ui/layouts/stack-layout/index.d.ts b/packages/core/ui/layouts/stack-layout/index.d.ts index 8d6b75ed7..82e8ec259 100644 --- a/packages/core/ui/layouts/stack-layout/index.d.ts +++ b/packages/core/ui/layouts/stack-layout/index.d.ts @@ -1,6 +1,6 @@ import { LayoutBase } from '../layout-base'; import { Property } from '../../core/properties'; -import { CoreTypes } from '../../core-types'; +import { CoreTypes } from '../../../core-types'; /** * A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property. diff --git a/packages/core/ui/layouts/wrap-layout/index.d.ts b/packages/core/ui/layouts/wrap-layout/index.d.ts index 3ff18101e..d41747958 100644 --- a/packages/core/ui/layouts/wrap-layout/index.d.ts +++ b/packages/core/ui/layouts/wrap-layout/index.d.ts @@ -1,6 +1,7 @@ import { LayoutBase } from '../layout-base'; import { Length } from '../../styling/style-properties'; import { Property } from '../../core/properties'; +import { CoreTypes } from '../../../core-types'; /** * WrapLayout position children in rows or columns depending on orientation property @@ -11,32 +12,32 @@ export class WrapLayout extends LayoutBase { * Gets or sets the flow direction. Default value is horizontal. * If orientation is horizontal items are arranged in rows, else items are arranged in columns. */ - orientation: Orientation; + orientation: CoreTypes.OrientationType; /** * Gets or sets the width used to measure and layout each child. * Default value is Number.NaN which does not restrict children. */ - itemWidth: Length; + itemWidth: CoreTypes.LengthType; /** * Gets or sets the height used to measure and layout each child. * Default value is Number.NaN which does not restrict children. */ - itemHeight: Length; + itemHeight: CoreTypes.LengthType; } /** * Represents the observable property backing the orientation property of each WrapLayout instance. */ -export const orientationProperty: Property; +export const orientationProperty: Property; /** * Represents the observable property backing the itemWidth property of each WrapLayout instance. */ -export const itemWidthProperty: Property; +export const itemWidthProperty: Property; /** * Represents the observable property backing the itemHeight property of each WrapLayout instance. */ -export const itemHeightProperty: Property; +export const itemHeightProperty: Property; diff --git a/packages/core/ui/list-view/index.d.ts b/packages/core/ui/list-view/index.d.ts index af3ffc11e..3789ee4e6 100644 --- a/packages/core/ui/list-view/index.d.ts +++ b/packages/core/ui/list-view/index.d.ts @@ -1,5 +1,6 @@ import { View, Template, KeyedTemplate } from '../core/view'; import { Color } from '../../color'; +import { CoreTypes } from '../../core-types'; import { EventData } from '../../data/observable'; import { Length } from '../styling/style-properties'; import { Style } from '../styling/style'; @@ -66,13 +67,13 @@ export class ListView extends View { /** * Gets or set row height of the ListView. */ - rowHeight: Length; + rowHeight: CoreTypes.LengthType; /** * Gets or set the estimated height of rows in the ListView. * The default value is 44px. */ - iosEstimatedRowHeight: Length; + iosEstimatedRowHeight: CoreTypes.LengthType; /** * Forces the ListView to reload all its items. diff --git a/packages/core/ui/scroll-view/index.d.ts b/packages/core/ui/scroll-view/index.d.ts index 1599695f2..a6176a381 100644 --- a/packages/core/ui/scroll-view/index.d.ts +++ b/packages/core/ui/scroll-view/index.d.ts @@ -1,6 +1,7 @@ import { ContentView } from '../content-view'; import { Property } from '../core/properties'; import { EventData } from '../../data/observable'; +import { CoreTypes } from '../../core-types'; /** * Represents a scrollable area that can have content that is larger than its bounds. @@ -58,7 +59,7 @@ export class ScrollView extends ContentView { /** * Gets or sets direction in which the content can be scrolled. */ - orientation: Orientation; + orientation: CoreTypes.OrientationType; /** * A basic method signature to hook an event listener (shortcut alias to the addEventListener method). @@ -81,4 +82,4 @@ export interface ScrollEventData extends EventData { scrollY: number; } -export const orientationProperty: Property; +export const orientationProperty: Property; diff --git a/packages/core/ui/styling/gradient.d.ts b/packages/core/ui/styling/gradient.d.ts index a634c9f21..170f58b22 100644 --- a/packages/core/ui/styling/gradient.d.ts +++ b/packages/core/ui/styling/gradient.d.ts @@ -1,4 +1,4 @@ -import { LengthPercentUnit } from './style-properties'; +import { CoreTypes } from '../../core-types'; import { Color } from '../../color'; import { LinearGradient as LinearGradientDefinition } from '../../css/parser'; @@ -13,5 +13,5 @@ export class LinearGradient { export interface ColorStop { color: Color; - offset?: LengthPercentUnit; + offset?: CoreTypes.LengthPercentUnit; } diff --git a/packages/core/ui/tab-view/index.d.ts b/packages/core/ui/tab-view/index.d.ts index 5791ca71f..bfe007e8e 100644 --- a/packages/core/ui/tab-view/index.d.ts +++ b/packages/core/ui/tab-view/index.d.ts @@ -7,6 +7,7 @@ import { ViewBase } from '../core/view-base'; import { Property, CssProperty } from '../core/properties'; import { EventData } from '../../data/observable'; import { Color } from '../../color'; +import { CoreTypes } from '../../core-types'; import { Style } from '../styling/style'; import { TextTransform } from '../text-base'; /** @@ -31,7 +32,7 @@ export class TabViewItem extends ViewBase { /** * Gets or sets the text transform of the tab titles. */ - textTransform: TextTransform; + textTransform: CoreTypes.TextTransformType; /** * @private diff --git a/packages/core/ui/text-base/index.d.ts b/packages/core/ui/text-base/index.d.ts index f2463ced7..47e58d996 100644 --- a/packages/core/ui/text-base/index.d.ts +++ b/packages/core/ui/text-base/index.d.ts @@ -66,27 +66,27 @@ export class TextBase extends View implements AddChildFromBuilder { /** * Gets or sets padding style property. */ - padding: string | Length; + padding: string | CoreTypes.LengthType; /** * Specify the bottom padding of this layout. */ - paddingBottom: Length; + paddingBottom: CoreTypes.LengthType; /** * Specify the left padding of this layout. */ - paddingLeft: Length; + paddingLeft: CoreTypes.LengthType; /** * Specify the right padding of this layout. */ - paddingRight: Length; + paddingRight: CoreTypes.LengthType; /** * Specify the top padding of this layout. */ - paddingTop: Length; + paddingTop: CoreTypes.LengthType; /** * Called for every child element declared in xml. diff --git a/packages/core/utils/index.d.ts b/packages/core/utils/index.d.ts index 08ddfe79e..6e947b3c3 100644 --- a/packages/core/utils/index.d.ts +++ b/packages/core/utils/index.d.ts @@ -1,4 +1,4 @@ -import { dip, px } from '../ui/core/view'; +import { CoreTypes } from '../core-types'; export * from './mainthread-helper'; export * from './macrotask-scheduler'; @@ -68,19 +68,19 @@ export namespace layout { * Convert device independent pixels to device pixels - dip to px. * @param value - The pixel to convert. */ - export function toDevicePixels(value: dip): px; + export function toDevicePixels(value: CoreTypes.dip): CoreTypes.px; /** * Convert device pixels to device independent pixels - px to dip. * @param value - The pixel to convert. */ - export function toDeviceIndependentPixels(value: px): dip; + export function toDeviceIndependentPixels(value: CoreTypes.px): CoreTypes.dip; /** * Rounds value used in layout. * @param px to round. */ - export function round(px: px): px; + export function round(px: CoreTypes.px): CoreTypes.px; /** * Converts device pixels to device independent pixes and measure the nativeView.