chore: types cleanup

This commit is contained in:
Nathan Walker
2021-03-27 13:06:43 -07:00
parent 8af8de2166
commit b50a2e618f
9 changed files with 27 additions and 50 deletions

View File

@ -708,39 +708,39 @@ export namespace CoreTypes {
/**
* @deprecated Use `CoreTypes.dip` instead.
*/
export type dip = number;
export type dip = CoreTypes.dip;
/**
* @deprecated Use `CoreTypes.px` instead.
*/
export type px = number;
export type px = CoreTypes.px;
/**
* @deprecated Use `CoreTypes.percent` instead.
*/
export type percent = number;
export type percent = CoreTypes.percent;
/**
* @deprecated Use `CoreTypes.LengthDipUnit` instead.
*/
export type LengthDipUnit = { readonly unit: 'dip'; readonly value: dip };
export type LengthDipUnit = CoreTypes.LengthDipUnit;
/**
* @deprecated Use `CoreTypes.LengthPxUnit` instead.
*/
export type LengthPxUnit = { readonly unit: 'px'; readonly value: px };
export type LengthPxUnit = CoreTypes.LengthPxUnit;
/**
* @deprecated Use `CoreTypes.LengthPercentUnit` instead.
*/
export type LengthPercentUnit = { readonly unit: '%'; readonly value: percent };
export type LengthPercentUnit = CoreTypes.LengthPercentUnit;
/**
* @deprecated Use `CoreTypes.LengthType` instead.
*/
export type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit;
export type LengthType = CoreTypes.LengthType;
/**
* @deprecated Use `CoreTypes.PercentLengthType` instead.
*/
export type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit;
export type PercentLengthType = CoreTypes.PercentLengthType;
/**
* @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0

View File

@ -287,24 +287,24 @@ export type percent = number;
/**
* @deprecated Use `CoreTypes.LengthDipUnit` instead.
*/
export type LengthDipUnit = { readonly unit: 'dip'; readonly value: dip };
export type LengthDipUnit = CoreTypes.LengthDipUnit;
/**
* @deprecated Use `CoreTypes.LengthPxUnit` instead.
*/
export type LengthPxUnit = { readonly unit: 'px'; readonly value: px };
export type LengthPxUnit = CoreTypes.LengthPxUnit;
/**
* @deprecated Use `CoreTypes.LengthPercentUnit` instead.
*/
export type LengthPercentUnit = { readonly unit: '%'; readonly value: percent };
export type LengthPercentUnit = CoreTypes.LengthPercentUnit;
/**
* @deprecated Use `CoreTypes.LengthType` instead.
*/
export type LengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit;
export type LengthType = CoreTypes.LengthType;
/**
* @deprecated Use `CoreTypes.PercentLengthType` instead.
*/
export type PercentLengthType = 'auto' | dip | LengthDipUnit | LengthPxUnit | LengthPercentUnit;
export type PercentLengthType = CoreTypes.PercentLengthType;
/**
* @deprecated Use `CoreTypes` instead. Enums will be removed in 9.0

View File

@ -3,7 +3,7 @@
"main": "index",
"types": "index.d.ts",
"description": "NativeScript Core Modules",
"version": "8.0.0-alpha.7",
"version": "8.0.0-alpha.8",
"homepage": "https://nativescript.org",
"repository": {
"type": "git",

View File

@ -406,12 +406,12 @@ export abstract class View extends ViewBase {
/**
* Gets or sets the translateX affine transform of the view in device independent pixels.
*/
translateX: dip;
translateX: CoreTypes.dip;
/**
* Gets or sets the translateY affine transform of the view in device independent pixels.
*/
translateY: dip;
translateY: CoreTypes.dip;
/**
* Gets or sets the scaleX affine transform of the view.

View File

@ -16,7 +16,7 @@ export class AbsoluteLayout extends LayoutBase {
/**
* Sets the value of the Left property from a given View.
*/
static setLeft(view: View, value: Length): void;
static setLeft(view: View, value: CoreTypes.LengthType): void;
/**
* Gets the value of the Top property from a given View.

View File

@ -191,12 +191,12 @@ export const separatorColor: Property<ListView, Color>;
/**
* Represents the observable property backing the rowHeight property of each ListView instance.
*/
export const rowHeightProperty: Property<ListView, Length>;
export const rowHeightProperty: Property<ListView, CoreTypes.LengthType>;
/**
* Represents the observable property backing the iosEstimatedRowHeight property of each ListView instance.
*/
export const iosEstimatedRowHeightProperty: Property<ListView, Length>;
export const iosEstimatedRowHeightProperty: Property<ListView, CoreTypes.LengthType>;
/**
* Backing property for separator color property.

View File

@ -47,7 +47,7 @@ export const colorProperty: InheritedCssProperty<Style, Color>;
export const backgroundProperty: ShorthandProperty<Style, string>;
export const backgroundColorProperty: CssAnimationProperty<Style, Color>;
export const backgroundImageProperty: CssProperty<Style, string>;
export const backgroundRepeatProperty: CssProperty<Style, BackgroundRepeatType>;
export const backgroundRepeatProperty: CssProperty<Style, CoreTypes.BackgroundRepeatType>;
export const backgroundSizeProperty: CssProperty<Style, string>;
export const backgroundPositionProperty: CssProperty<Style, string>;
@ -70,7 +70,7 @@ export const borderBottomRightRadiusProperty: CssProperty<Style, CoreTypes.Lengt
export const borderBottomLeftRadiusProperty: CssProperty<Style, CoreTypes.LengthType>;
export const zIndexProperty: CssProperty<Style, number>;
export const visibilityProperty: CssProperty<Style, VisibilityType>;
export const visibilityProperty: CssProperty<Style, CoreTypes.VisibilityType>;
export const opacityProperty: CssAnimationProperty<Style, number>;
export const minWidthProperty: CssProperty<Style, CoreTypes.dip | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit>;
@ -90,8 +90,8 @@ export const paddingRightProperty: CssProperty<Style, CoreTypes.LengthType>;
export const paddingTopProperty: CssProperty<Style, CoreTypes.LengthType>;
export const paddingBottomProperty: CssProperty<Style, CoreTypes.LengthType>;
export const horizontalAlignmentProperty: CssProperty<Style, HorizontalAlignmentType>;
export const verticalAlignmentProperty: CssProperty<Style, VerticalAlignmentType>;
export const horizontalAlignmentProperty: CssProperty<Style, CoreTypes.HorizontalAlignmentType>;
export const verticalAlignmentProperty: CssProperty<Style, CoreTypes.VerticalAlignmentType>;
export const fontSizeProperty: InheritedCssProperty<Style, number>;
export const fontFamilyProperty: InheritedCssProperty<Style, string>;
@ -103,25 +103,3 @@ export const fontInternalProperty: InheritedCssProperty<Style, Font>;
export const androidElevationProperty: CssProperty<Style, number>;
export const androidDynamicElevationOffsetProperty: CssProperty<Style, number>;
export type BackgroundRepeatType = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
export type VisibilityType = 'visible' | 'hidden' | 'collapse';
export type HorizontalAlignmentType = 'left' | 'center' | 'right' | 'stretch';
export namespace HorizontalAlignment {
export const LEFT: 'left';
export const CENTER: 'center';
export const RIGHT: 'right';
export const STRETCH: 'stretch';
}
export type VerticalAlignmentType = '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';
}

View File

@ -9,7 +9,6 @@ import { EventData } from '../../data/observable';
import { Color } from '../../color';
import { CoreTypes } from '../../core-types';
import { Style } from '../styling/style';
import { TextTransform } from '../text-base';
/**
* Represents a tab view entry.
*/

View File

@ -1,4 +1,4 @@
import { dip, px } from '../../ui/core/view';
import { CoreTypes } from '../../core-types';
/**
* Bits that provide the actual measured size.
@ -45,19 +45,19 @@ export function getDisplayDensity(): number;
* 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.