From 3f8af4cc0e511820ccb9f9c160567d0711b4d3e2 Mon Sep 17 00:00:00 2001 From: Alexander Djenkov Date: Thu, 17 May 2018 15:44:40 +0300 Subject: [PATCH] fix(styling-gradient): introduce gradient definition file (#5828) --- tns-core-modules/ui/styling/gradient.d.ts | 21 +++++++++++++++++++ .../ui/styling/linear-gradient.ts | 12 ++++------- 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 tns-core-modules/ui/styling/gradient.d.ts diff --git a/tns-core-modules/ui/styling/gradient.d.ts b/tns-core-modules/ui/styling/gradient.d.ts new file mode 100644 index 000000000..3dce43c83 --- /dev/null +++ b/tns-core-modules/ui/styling/gradient.d.ts @@ -0,0 +1,21 @@ +/** + * @module "ui/styling/gradient" + */ /** */ + +import { LengthPercentUnit } from "./style-properties"; +import { Color } from "../../color"; +import * as parser from "../../css/parser"; + +export class LinearGradient { + public angle: number; + public colorStops: ColorStop[]; + + public static parse(value: parser.LinearGradient): LinearGradient; + + public static equals(first: LinearGradient, second: LinearGradient): boolean; +} + +export interface ColorStop { + color: Color; + offset?: LengthPercentUnit; +} diff --git a/tns-core-modules/ui/styling/linear-gradient.ts b/tns-core-modules/ui/styling/linear-gradient.ts index ecedacbcb..a1de0b60a 100644 --- a/tns-core-modules/ui/styling/linear-gradient.ts +++ b/tns-core-modules/ui/styling/linear-gradient.ts @@ -1,12 +1,13 @@ import { LengthPercentUnit } from "./style-properties"; -import * as parser from "../../css/parser"; import { Color } from "../../color"; +import { ColorStop } from "./gradient"; +import * as parser from "../../css/parser"; export class LinearGradient { public angle: number; public colorStops: ColorStop[]; - static parse(value: parser.LinearGradient): LinearGradient { + public static parse(value: parser.LinearGradient): LinearGradient { const result = new LinearGradient(); result.angle = value.angle; result.colorStops = value.colors.map(color => { @@ -28,7 +29,7 @@ export class LinearGradient { return result; } - static equals(first: LinearGradient, second: LinearGradient): boolean { + public static equals(first: LinearGradient, second: LinearGradient): boolean { if (!first && !second) { return true; } else if (!first || !second) { @@ -57,8 +58,3 @@ export class LinearGradient { return true; } } - -export interface ColorStop { - color: Color; - offset?: LengthPercentUnit; -} \ No newline at end of file