mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-02 19:12:40 +08:00
chore: typing fixes
This commit is contained in:
@ -16,6 +16,7 @@ moduleAlias.addAliases({
|
||||
'@nativescript/core/color': path.resolve(tnsCoreModules, 'color/color-common'),
|
||||
'@nativescript/core/ui/styling/font': path.resolve(tnsCoreModules, 'ui/styling/font-common'),
|
||||
'@nativescript/core/ui/styling/background': path.resolve(tnsCoreModules, 'ui/styling/background-common'),
|
||||
'@nativescript/core/ui/styling/css-shadow': path.resolve(tnsCoreModules, 'ui/styling/css-shadow'),
|
||||
|
||||
'@nativescript/core': tnsCoreModules,
|
||||
'~': __dirname,
|
||||
|
||||
@ -2,144 +2,144 @@
|
||||
// the imports don't work. We need to fully switch to jest & set up ts support
|
||||
// todo: fix tests.
|
||||
|
||||
// import { parseCSSShadow } from "@nativescript/core/ui/styling/css-shadow";
|
||||
// import { zeroLength } from "@nativescript/core";
|
||||
import { parseCSSShadow } from '@nativescript/core/ui/styling/css-shadow';
|
||||
import { zeroLength } from '@nativescript/core';
|
||||
import { assert } from 'chai';
|
||||
|
||||
// describe('ui', () => {
|
||||
// describe('styling', () => {
|
||||
// describe('css-shadow', () => {
|
||||
//
|
||||
// it("empty", () => {
|
||||
// const shadow = parseCSSShadow("")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(zeroLength)
|
||||
// expect(shadow.offsetY).toBe(zeroLength)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
//
|
||||
// it("1px 1px 2px black", () => {
|
||||
// const shadow = parseCSSShadow("1px 1px 2px black")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(1)
|
||||
// expect(shadow.offsetY).toBe(1)
|
||||
// expect(shadow.blurRadius).toBe(2)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
//
|
||||
// it("#fc0 1px 0 10px", () => {
|
||||
// const shadow = parseCSSShadow("#fc0 1px 0 10px")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(1)
|
||||
// expect(shadow.offsetY).toBe(zeroLength)
|
||||
// expect(shadow.blurRadius).toBe(10)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#fc0')
|
||||
// });
|
||||
//
|
||||
// it("5px 5px #558abb", () => {
|
||||
// const shadow = parseCSSShadow("5px 5px #558abb")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(5)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#558abb')
|
||||
// });
|
||||
//
|
||||
// it("white 2px 5px", () => {
|
||||
// const shadow = parseCSSShadow("white 2px 5px")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(2)
|
||||
// expect(shadow.offsetY).toBe(5)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('white')
|
||||
// });
|
||||
//
|
||||
// it("5px 10px", () => {
|
||||
// const shadow = parseCSSShadow("5px 10px")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(10)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
//
|
||||
// // box
|
||||
// it("60px -16px teal", () => {
|
||||
// const shadow = parseCSSShadow("60px -16px teal")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(60)
|
||||
// expect(shadow.offsetY).toBe(-16)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('teal')
|
||||
// });
|
||||
//
|
||||
// it("10px 5px 5px black", () => {
|
||||
// const shadow = parseCSSShadow("10px 5px 5px black")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(10)
|
||||
// expect(shadow.offsetY).toBe(5)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
//
|
||||
// it("2px 2px 2px 1px rgba(0, 0, 0, 0.2)", () => {
|
||||
// const shadow = parseCSSShadow("2px 2px 2px 1px rgba(0, 0, 0, 0.2)")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(2)
|
||||
// expect(shadow.offsetY).toBe(2)
|
||||
// expect(shadow.blurRadius).toBe(2)
|
||||
// expect(shadow.spreadRadius).toBe(1)
|
||||
// expect(shadow.color).toBe('rgba(0, 0, 0, 0.2)')
|
||||
// });
|
||||
//
|
||||
// it("inset 5em 1em gold", () => {
|
||||
// const shadow = parseCSSShadow("inset 5em 1em gold")
|
||||
// expect(shadow.inset).toBe(true)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(1)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('gold')
|
||||
// });
|
||||
//
|
||||
// it("5 10", () => {
|
||||
// const shadow = parseCSSShadow("5 10")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(10)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
//
|
||||
// it("2 2 2 #333", () => {
|
||||
// const shadow = parseCSSShadow("2 2 2 #333")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(2)
|
||||
// expect(shadow.offsetY).toBe(2)
|
||||
// expect(shadow.blurRadius).toBe(2)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#333')
|
||||
// });
|
||||
//
|
||||
// it("-1 -1 1 #333", () => {
|
||||
// const shadow = parseCSSShadow("-1 -1 1 #333")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(-1)
|
||||
// expect(shadow.offsetY).toBe(-1)
|
||||
// expect(shadow.blurRadius).toBe(1)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#333')
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
//
|
||||
describe('ui', () => {
|
||||
describe('styling', () => {
|
||||
describe('css-shadow', () => {
|
||||
it('empty', () => {
|
||||
const shadow = parseCSSShadow('');
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(zeroLength)
|
||||
// expect(shadow.offsetY).toBe(zeroLength)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
assert.equal(shadow.inset, false);
|
||||
});
|
||||
|
||||
// it("1px 1px 2px black", () => {
|
||||
// const shadow = parseCSSShadow("1px 1px 2px black")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(1)
|
||||
// expect(shadow.offsetY).toBe(1)
|
||||
// expect(shadow.blurRadius).toBe(2)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
|
||||
// it("#fc0 1px 0 10px", () => {
|
||||
// const shadow = parseCSSShadow("#fc0 1px 0 10px")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(1)
|
||||
// expect(shadow.offsetY).toBe(zeroLength)
|
||||
// expect(shadow.blurRadius).toBe(10)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#fc0')
|
||||
// });
|
||||
|
||||
// it("5px 5px #558abb", () => {
|
||||
// const shadow = parseCSSShadow("5px 5px #558abb")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(5)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#558abb')
|
||||
// });
|
||||
|
||||
// it("white 2px 5px", () => {
|
||||
// const shadow = parseCSSShadow("white 2px 5px")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(2)
|
||||
// expect(shadow.offsetY).toBe(5)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('white')
|
||||
// });
|
||||
|
||||
// it("5px 10px", () => {
|
||||
// const shadow = parseCSSShadow("5px 10px")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(10)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
|
||||
// // box
|
||||
// it("60px -16px teal", () => {
|
||||
// const shadow = parseCSSShadow("60px -16px teal")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(60)
|
||||
// expect(shadow.offsetY).toBe(-16)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('teal')
|
||||
// });
|
||||
|
||||
// it("10px 5px 5px black", () => {
|
||||
// const shadow = parseCSSShadow("10px 5px 5px black")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(10)
|
||||
// expect(shadow.offsetY).toBe(5)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
|
||||
// it("2px 2px 2px 1px rgba(0, 0, 0, 0.2)", () => {
|
||||
// const shadow = parseCSSShadow("2px 2px 2px 1px rgba(0, 0, 0, 0.2)")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(2)
|
||||
// expect(shadow.offsetY).toBe(2)
|
||||
// expect(shadow.blurRadius).toBe(2)
|
||||
// expect(shadow.spreadRadius).toBe(1)
|
||||
// expect(shadow.color).toBe('rgba(0, 0, 0, 0.2)')
|
||||
// });
|
||||
|
||||
// it("inset 5em 1em gold", () => {
|
||||
// const shadow = parseCSSShadow("inset 5em 1em gold")
|
||||
// expect(shadow.inset).toBe(true)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(1)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('gold')
|
||||
// });
|
||||
|
||||
// it("5 10", () => {
|
||||
// const shadow = parseCSSShadow("5 10")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(5)
|
||||
// expect(shadow.offsetY).toBe(10)
|
||||
// expect(shadow.blurRadius).toBe(zeroLength)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('black')
|
||||
// });
|
||||
|
||||
// it("2 2 2 #333", () => {
|
||||
// const shadow = parseCSSShadow("2 2 2 #333")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(2)
|
||||
// expect(shadow.offsetY).toBe(2)
|
||||
// expect(shadow.blurRadius).toBe(2)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#333')
|
||||
// });
|
||||
|
||||
// it("-1 -1 1 #333", () => {
|
||||
// const shadow = parseCSSShadow("-1 -1 1 #333")
|
||||
// expect(shadow.inset).toBe(false)
|
||||
// expect(shadow.offsetX).toBe(-1)
|
||||
// expect(shadow.offsetY).toBe(-1)
|
||||
// expect(shadow.blurRadius).toBe(1)
|
||||
// expect(shadow.spreadRadius).toBe(zeroLength)
|
||||
// expect(shadow.color).toBe('#333')
|
||||
// });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
2
packages/core/ui/page/index.d.ts
vendored
2
packages/core/ui/page/index.d.ts
vendored
@ -96,7 +96,7 @@ export declare class Page extends PageBase {
|
||||
/**
|
||||
* Should page changed be annnounced to the screen reader.
|
||||
*/
|
||||
public accessibilityAnnouncePageEnabled = true;
|
||||
public accessibilityAnnouncePageEnabled: boolean;
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
|
||||
1
packages/core/ui/slider/index.d.ts
vendored
1
packages/core/ui/slider/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
import { View } from '../core/view';
|
||||
import { Property, CoercibleProperty } from '../core/properties';
|
||||
import { EventData } from '../../data/observable';
|
||||
import type { SliderBase } from './slider-common';
|
||||
|
||||
/**
|
||||
* Represents a slider component.
|
||||
|
||||
8
packages/core/ui/styling/background.d.ts
vendored
8
packages/core/ui/styling/background.d.ts
vendored
@ -2,7 +2,7 @@ import { Color } from '../../color';
|
||||
import { View } from '../core/view';
|
||||
import { BackgroundRepeat } from '../../css/parser';
|
||||
import { LinearGradient } from '../styling/linear-gradient';
|
||||
import { BoxShadow } from './box-shadow';
|
||||
import { CSSShadow } from './css-shadow';
|
||||
|
||||
export enum CacheMode {
|
||||
none,
|
||||
@ -30,7 +30,7 @@ export declare class Background {
|
||||
public borderBottomRightRadius: number;
|
||||
public borderBottomLeftRadius: number;
|
||||
public clipPath: string;
|
||||
public boxShadow: string | BoxShadow;
|
||||
public boxShadow: string | CSSShadow;
|
||||
|
||||
public withColor(value: Color): Background;
|
||||
public withImage(value: string | LinearGradient): Background;
|
||||
@ -50,7 +50,7 @@ export declare class Background {
|
||||
public withBorderBottomRightRadius(value: number): Background;
|
||||
public withBorderBottomLeftRadius(value: number): Background;
|
||||
public withClipPath(value: string): Background;
|
||||
public withBoxShadow(value: BoxShadow): Background;
|
||||
public withBoxShadow(value: CSSShadow): Background;
|
||||
|
||||
public isEmpty(): boolean;
|
||||
|
||||
@ -67,7 +67,7 @@ export declare class Background {
|
||||
public getUniformBorderWidth(): number;
|
||||
public getUniformBorderRadius(): number;
|
||||
public hasBoxShadow(): boolean;
|
||||
public getBoxShadow(): BoxShadow;
|
||||
public getBoxShadow(): CSSShadow;
|
||||
}
|
||||
|
||||
export namespace ios {
|
||||
|
||||
2
packages/core/ui/text-base/index.d.ts
vendored
2
packages/core/ui/text-base/index.d.ts
vendored
@ -130,7 +130,7 @@ export type TextDecoration = 'none' | 'underline' | 'line-through' | 'underline
|
||||
export const textAlignmentProperty: InheritedCssProperty<Style, TextAlignment>;
|
||||
export const textDecorationProperty: CssProperty<Style, TextDecoration>;
|
||||
export const textTransformProperty: CssProperty<Style, TextTransform>;
|
||||
export const textShadowProperty: CssProperty<Style, TextShadow>;
|
||||
export const textShadowProperty: CssProperty<Style, CSSShadow>;
|
||||
export const whiteSpaceProperty: CssProperty<Style, WhiteSpace>;
|
||||
export const letterSpacingProperty: CssProperty<Style, number>;
|
||||
export const lineHeightProperty: CssProperty<Style, number>;
|
||||
|
||||
Reference in New Issue
Block a user