mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactoring circular imports
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
// Deifinitions.
|
||||
import { Background as BackgroundDefinition, BackgroundDrawParams } from "ui/styling/background";
|
||||
import { Color, BackgroundRepeat } from "ui/core/view";
|
||||
import { BackgroundRepeat } from "ui/core/view";
|
||||
import { ImageSource } from "image-source";
|
||||
|
||||
// Types.
|
||||
import { Color } from "color";
|
||||
import { CSSValue, parse as cssParse } from "css-value";
|
||||
|
||||
export class Background implements BackgroundDefinition {
|
||||
|
||||
3
tns-core-modules/ui/styling/background.d.ts
vendored
3
tns-core-modules/ui/styling/background.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
declare module "ui/styling/background" {
|
||||
import { ImageSource } from "image-source";
|
||||
import { View, Color, BackgroundRepeat } from "ui/core/view";
|
||||
import { Color } from "color";
|
||||
import { View, BackgroundRepeat } from "ui/core/view";
|
||||
|
||||
export interface BackgroundDrawParams {
|
||||
repeatX: boolean;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { View, Color, Point } from "ui/core/view";
|
||||
import { Color } from "color";
|
||||
import { View, Point } from "ui/core/view";
|
||||
import { Background } from "./background-common";
|
||||
import { ios as utilsIos } from "utils/utils";
|
||||
import { layout } from "utils/utils";
|
||||
|
||||
151
tns-core-modules/ui/styling/style-properties.d.ts
vendored
Normal file
151
tns-core-modules/ui/styling/style-properties.d.ts
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
declare module "ui/styling/style-properties" {
|
||||
|
||||
import { Color } from "color";
|
||||
import { Style, CssProperty, CssAnimationProperty, ShorthandProperty, InheritedCssProperty } from "ui/core/properties";
|
||||
import { Font, FontStyle, FontWeight } from "ui/styling/font";
|
||||
import { Background } from "ui/styling/background";
|
||||
|
||||
export type Length = "auto" | number | {
|
||||
readonly unit: "dip" | "px";
|
||||
readonly value: number;
|
||||
}
|
||||
|
||||
export namespace Length {
|
||||
export function parse(text: string): Length;
|
||||
export function equals(a: Length, b: Length): boolean;
|
||||
/**
|
||||
* Converts Length unit to device pixels.
|
||||
* @param length The Length to convert.
|
||||
* @param auto Value to use for conversion of "auto".
|
||||
*/
|
||||
export function toDevicePixels(length: Length, auto: number): number;
|
||||
export function convertToString(length: Length): string;
|
||||
|
||||
}
|
||||
|
||||
export type PercentLength = "auto" | number | {
|
||||
readonly unit: "%" | "dip" | "px";
|
||||
/**
|
||||
* Length value. When unit is "%" the value is normalized (ex. for 5% the value is 0.05)
|
||||
*/
|
||||
readonly value: number;
|
||||
}
|
||||
|
||||
export namespace PercentLength {
|
||||
export function parse(text: string): PercentLength;
|
||||
export function equals(a: PercentLength, b: PercentLength): boolean;
|
||||
/**
|
||||
* Converts PercentLength unit to device pixels.
|
||||
* @param length The PercentLength to convert.
|
||||
* @param auto Value to use for conversion of "auto".
|
||||
* @param parentAvailableWidth Value to use as base when converting percent unit.
|
||||
*/
|
||||
export function toDevicePixels(length: PercentLength, auto: number, parentAvailableWidth: number): number;
|
||||
export function convertToString(length: PercentLength): string;
|
||||
}
|
||||
|
||||
export const zeroLength: Length;
|
||||
|
||||
export const rotateProperty: CssAnimationProperty<Style, number>;
|
||||
export const scaleXProperty: CssAnimationProperty<Style, number>;
|
||||
export const scaleYProperty: CssAnimationProperty<Style, number>;
|
||||
export const translateXProperty: CssAnimationProperty<Style, Length>;
|
||||
export const translateYProperty: CssAnimationProperty<Style, Length>;
|
||||
|
||||
export const clipPathProperty: CssProperty<Style, string>;
|
||||
export const colorProperty: InheritedCssProperty<Style, Color>;
|
||||
|
||||
export const backgroundColorProperty: CssAnimationProperty<Style, Color>;
|
||||
export const backgroundImageProperty: CssProperty<Style, string>;
|
||||
export const backgroundRepeatProperty: CssProperty<Style, BackgroundRepeat>;
|
||||
export const backgroundSizeProperty: CssProperty<Style, string>;
|
||||
export const backgroundPositionProperty: CssProperty<Style, string>;
|
||||
|
||||
export const borderColorProperty: ShorthandProperty<Style, string | Color>;
|
||||
export const borderTopColorProperty: CssProperty<Style, Color>;
|
||||
export const borderRightColorProperty: CssProperty<Style, Color>;
|
||||
export const borderBottomColorProperty: CssProperty<Style, Color>;
|
||||
export const borderLeftColorProperty: CssProperty<Style, Color>;
|
||||
|
||||
export const borderWidthProperty: ShorthandProperty<Style, string | Length>;
|
||||
export const borderTopWidthProperty: CssProperty<Style, Length>;
|
||||
export const borderRightWidthProperty: CssProperty<Style, Length>;
|
||||
export const borderBottomWidthProperty: CssProperty<Style, Length>;
|
||||
export const borderLeftWidthProperty: CssProperty<Style, Length>;
|
||||
|
||||
export const borderRadiusProperty: ShorthandProperty<Style, string | Length>;
|
||||
export const borderTopLeftRadiusProperty: CssProperty<Style, Length>;
|
||||
export const borderTopRightRadiusProperty: CssProperty<Style, Length>;
|
||||
export const borderBottomRightRadiusProperty: CssProperty<Style, Length>;
|
||||
export const borderBottomLeftRadiusProperty: CssProperty<Style, Length>;
|
||||
|
||||
export const zIndexProperty: CssProperty<Style, number>;
|
||||
export const visibilityProperty: CssProperty<Style, Visibility>;
|
||||
export const opacityProperty: CssAnimationProperty<Style, number>;
|
||||
|
||||
export const minWidthProperty: CssProperty<Style, Length>;
|
||||
export const minHeightProperty: CssProperty<Style, Length>;
|
||||
export const widthProperty: CssProperty<Style, Length>;
|
||||
export const heightProperty: CssProperty<Style, Length>;
|
||||
export const marginProperty: ShorthandProperty<Style, string | PercentLength>;
|
||||
export const marginLeftProperty: CssProperty<Style, PercentLength>;
|
||||
export const marginRightProperty: CssProperty<Style, PercentLength>;
|
||||
export const marginTopProperty: CssProperty<Style, PercentLength>;
|
||||
export const marginBottomProperty: CssProperty<Style, PercentLength>;
|
||||
|
||||
export const paddingProperty: ShorthandProperty<Style, string | Length>;
|
||||
export const paddingLeftProperty: CssProperty<Style, Length>;
|
||||
export const paddingRightProperty: CssProperty<Style, Length>;
|
||||
export const paddingTopProperty: CssProperty<Style, Length>;
|
||||
export const paddingBottomProperty: CssProperty<Style, Length>;
|
||||
|
||||
export const horizontalAlignmentProperty: CssProperty<Style, HorizontalAlignment>;
|
||||
export const verticalAlignmentProperty: CssProperty<Style, VerticalAlignment>;
|
||||
|
||||
export const fontSizeProperty: InheritedCssProperty<Style, number>;
|
||||
export const fontFamilyProperty: InheritedCssProperty<Style, string>;
|
||||
export const fontStyleProperty: InheritedCssProperty<Style, FontStyle>;
|
||||
export const fontWeightProperty: InheritedCssProperty<Style, FontWeight>;
|
||||
|
||||
export const backgroundInternalProperty: CssProperty<Style, Background>;
|
||||
export const fontInternalProperty: InheritedCssProperty<Style, Font>;
|
||||
|
||||
export type BackgroundRepeat = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
||||
export namespace BackgroundRepeat {
|
||||
export const REPEAT: "repeat";
|
||||
export const REPEAT_X: "repeat-x";
|
||||
export const REPEAT_Y: "repeat-y";
|
||||
export const NO_REPEAT: "no-repeat";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): BackgroundRepeat;
|
||||
}
|
||||
|
||||
export type Visibility = "visible" | "hidden" | "collapse";
|
||||
export namespace Visibility {
|
||||
export const VISIBLE: "visible";
|
||||
export const HIDDEN: "hidden";
|
||||
export const COLLAPSE: "collapse";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): Visibility;
|
||||
}
|
||||
|
||||
export type HorizontalAlignment = "left" | "center" | "right" | "stretch";
|
||||
export namespace HorizontalAlignment {
|
||||
export const LEFT: "left";
|
||||
export const CENTER: "center";
|
||||
export const RIGHT: "right";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): HorizontalAlignment;
|
||||
}
|
||||
|
||||
export type VerticalAlignment = "top" | "middle" | "bottom" | "stretch";
|
||||
export namespace VerticalAlignment {
|
||||
export const TOP: "top";
|
||||
export const MIDDLE: "middle";
|
||||
export const BOTTOM: "bottom";
|
||||
export const STRETCH: "stretch";
|
||||
export function isValid(value: any): boolean;
|
||||
export function parse(value: string): VerticalAlignment;
|
||||
}
|
||||
}
|
||||
1054
tns-core-modules/ui/styling/style-properties.ts
Normal file
1054
tns-core-modules/ui/styling/style-properties.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
import { ViewBase, resetCSSProperties } from "ui/core/view-base";
|
||||
import { ViewBase } from "ui/core/view-base";
|
||||
import { resetCSSProperties } from "ui/core/properties";
|
||||
import { SyntaxTree, Keyframes, parse as parseCss, Node } from "css";
|
||||
import { RuleSet, SelectorsMap, SelectorCore, SelectorsMatch, ChangeMap, fromAstNodes } from "ui/styling/css-selector";
|
||||
import { write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
|
||||
|
||||
6
tns-core-modules/ui/styling/style.d.ts
vendored
6
tns-core-modules/ui/styling/style.d.ts
vendored
@@ -1,7 +1,9 @@
|
||||
declare module "ui/styling/style" {
|
||||
import { Length, PercentLength, Color, Background, Font, ViewBase, Observable, BackgroundRepeat, Visibility, HorizontalAlignment, VerticalAlignment} from "ui/core/view";
|
||||
import { Color } from "color";
|
||||
import { Background } from "ui/styling/background";
|
||||
import { Length, PercentLength, ViewBase, Observable, BackgroundRepeat, Visibility, HorizontalAlignment, VerticalAlignment } from "ui/core/view";
|
||||
import { TextAlignment, TextDecoration, TextTransform, WhiteSpace } from "ui/text-base";
|
||||
import { FontStyle, FontWeight } from "ui/styling/font";
|
||||
import { Font, FontStyle, FontWeight } from "ui/styling/font";
|
||||
|
||||
export interface Thickness {
|
||||
left: number;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { Style as StyleDefinition } from "ui/styling/style";
|
||||
import { Length, PercentLength, Color, Background, Font, ViewBase, BackgroundRepeat, Visibility, HorizontalAlignment, VerticalAlignment } from "ui/core/view";
|
||||
import { Color } from "color";
|
||||
import { Font } from "ui/styling/font";
|
||||
import { Background } from "ui/styling/background";
|
||||
import { Length, PercentLength, ViewBase, BackgroundRepeat, Visibility, HorizontalAlignment, VerticalAlignment } from "ui/core/view";
|
||||
import { Observable } from "data/observable";
|
||||
|
||||
import {
|
||||
@@ -298,11 +301,4 @@ Style.prototype.effectivePaddingLeft = 0;
|
||||
Style.prototype.effectiveBorderTopWidth = 0;
|
||||
Style.prototype.effectiveBorderRightWidth = 0;
|
||||
Style.prototype.effectiveBorderBottomWidth = 0;
|
||||
Style.prototype.effectiveBorderLeftWidth = 0;
|
||||
// Property registration
|
||||
|
||||
// register default shorthand callbacks.
|
||||
// styleProperty.registerShorthandCallback("font", onFontChanged);
|
||||
// styleProperty.registerShorthandCallback("margin", onMarginChanged);
|
||||
// styleProperty.registerShorthandCallback("padding", onPaddingChanged);
|
||||
// styleProperty.registerShorthandCallback("transform", onTransformChanged);
|
||||
Style.prototype.effectiveBorderLeftWidth = 0;
|
||||
Reference in New Issue
Block a user