mirror of
				https://github.com/NativeScript/NativeScript.git
				synced 2025-11-04 21:06:45 +08:00 
			
		
		
		
	chore: cleanup background styling handling
This commit is contained in:
		@ -13,8 +13,7 @@ import { EventData } from '../../../data/observable';
 | 
				
			|||||||
import { perspectiveProperty, visibilityProperty, opacityProperty, horizontalAlignmentProperty, verticalAlignmentProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty, marginLeftProperty, marginTopProperty, marginRightProperty, marginBottomProperty, rotateProperty, rotateXProperty, rotateYProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty, androidElevationProperty, androidDynamicElevationOffsetProperty } from '../../styling/style-properties';
 | 
					import { perspectiveProperty, visibilityProperty, opacityProperty, horizontalAlignmentProperty, verticalAlignmentProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty, marginLeftProperty, marginTopProperty, marginRightProperty, marginBottomProperty, rotateProperty, rotateXProperty, rotateYProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty, androidElevationProperty, androidDynamicElevationOffsetProperty } from '../../styling/style-properties';
 | 
				
			||||||
import { CoreTypes } from '../../../core-types';
 | 
					import { CoreTypes } from '../../../core-types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Background, ad as androidBackground } from '../../styling/background';
 | 
					import { Background, BackgroundClearFlags, refreshBorderDrawable } from '../../styling/background';
 | 
				
			||||||
import { BackgroundClearFlags, refreshBorderDrawable } from '../../styling/background.android';
 | 
					 | 
				
			||||||
import { profile } from '../../../profiling';
 | 
					import { profile } from '../../../profiling';
 | 
				
			||||||
import { topmost } from '../../frame/frame-stack';
 | 
					import { topmost } from '../../frame/frame-stack';
 | 
				
			||||||
import { Screen } from '../../../platform';
 | 
					import { Screen } from '../../../platform';
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,3 @@
 | 
				
			|||||||
// Deifinitions.
 | 
					 | 
				
			||||||
import { Background as BackgroundDefinition } from './background';
 | 
					 | 
				
			||||||
import { CoreTypes } from '../../core-types';
 | 
					import { CoreTypes } from '../../core-types';
 | 
				
			||||||
import { LinearGradient } from './linear-gradient';
 | 
					import { LinearGradient } from './linear-gradient';
 | 
				
			||||||
// Types.
 | 
					// Types.
 | 
				
			||||||
@ -21,7 +19,7 @@ export const enum BackgroundClearFlags {
 | 
				
			|||||||
	CLEAR_BOX_SHADOW = 2 << 0,
 | 
						CLEAR_BOX_SHADOW = 2 << 0,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class Background implements BackgroundDefinition {
 | 
					export class Background {
 | 
				
			||||||
	public static default = new Background();
 | 
						public static default = new Background();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public color: Color;
 | 
						public color: Color;
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,7 @@ function fromGradient(gradient: LinearGradient): org.nativescript.widgets.Linear
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const pattern = /url\(('|")(.*?)\1\)/;
 | 
					const pattern = /url\(('|")(.*?)\1\)/;
 | 
				
			||||||
function refreshBorderDrawable(this: void, view: View, borderDrawable: org.nativescript.widgets.BorderDrawable) {
 | 
					export function refreshBorderDrawable(view: View, borderDrawable: org.nativescript.widgets.BorderDrawable) {
 | 
				
			||||||
	const nativeView = <android.view.View>view.nativeViewProtected;
 | 
						const nativeView = <android.view.View>view.nativeViewProtected;
 | 
				
			||||||
	const context = nativeView.getContext();
 | 
						const context = nativeView.getContext();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										116
									
								
								packages/core/ui/styling/background.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										116
									
								
								packages/core/ui/styling/background.d.ts
									
									
									
									
										vendored
									
									
								
							@ -4,72 +4,74 @@ import { BackgroundRepeat } from '../../css/parser';
 | 
				
			|||||||
import { LinearGradient } from '../styling/linear-gradient';
 | 
					import { LinearGradient } from '../styling/linear-gradient';
 | 
				
			||||||
import { CSSShadow } from './css-shadow';
 | 
					import { CSSShadow } from './css-shadow';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export * from './background-common';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export enum CacheMode {
 | 
					export enum CacheMode {
 | 
				
			||||||
	none,
 | 
						none,
 | 
				
			||||||
	memory,
 | 
						memory,
 | 
				
			||||||
	diskAndMemory,
 | 
						diskAndMemory,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export declare class Background {
 | 
					// export declare class Background {
 | 
				
			||||||
	public static default: Background;
 | 
					// 	public static default: Background;
 | 
				
			||||||
	public color: Color;
 | 
					// 	public color: Color;
 | 
				
			||||||
	public image: string | LinearGradient;
 | 
					// 	public image: string | LinearGradient;
 | 
				
			||||||
	public repeat: BackgroundRepeat;
 | 
					// 	public repeat: BackgroundRepeat;
 | 
				
			||||||
	public position: string;
 | 
					// 	public position: string;
 | 
				
			||||||
	public size: string;
 | 
					// 	public size: string;
 | 
				
			||||||
	public borderTopColor: Color;
 | 
					// 	public borderTopColor: Color;
 | 
				
			||||||
	public borderRightColor: Color;
 | 
					// 	public borderRightColor: Color;
 | 
				
			||||||
	public borderBottomColor: Color;
 | 
					// 	public borderBottomColor: Color;
 | 
				
			||||||
	public borderLeftColor: Color;
 | 
					// 	public borderLeftColor: Color;
 | 
				
			||||||
	public borderTopWidth: number;
 | 
					// 	public borderTopWidth: number;
 | 
				
			||||||
	public borderRightWidth: number;
 | 
					// 	public borderRightWidth: number;
 | 
				
			||||||
	public borderBottomWidth: number;
 | 
					// 	public borderBottomWidth: number;
 | 
				
			||||||
	public borderLeftWidth: number;
 | 
					// 	public borderLeftWidth: number;
 | 
				
			||||||
	public borderTopLeftRadius: number;
 | 
					// 	public borderTopLeftRadius: number;
 | 
				
			||||||
	public borderTopRightRadius: number;
 | 
					// 	public borderTopRightRadius: number;
 | 
				
			||||||
	public borderBottomRightRadius: number;
 | 
					// 	public borderBottomRightRadius: number;
 | 
				
			||||||
	public borderBottomLeftRadius: number;
 | 
					// 	public borderBottomLeftRadius: number;
 | 
				
			||||||
	public clipPath: string;
 | 
					// 	public clipPath: string;
 | 
				
			||||||
	public boxShadow: string | CSSShadow;
 | 
					// 	public boxShadow: string | CSSShadow;
 | 
				
			||||||
	public clearFlags: number;
 | 
					// 	public clearFlags: number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public withColor(value: Color): Background;
 | 
					// 	public withColor(value: Color): Background;
 | 
				
			||||||
	public withImage(value: string | LinearGradient): Background;
 | 
					// 	public withImage(value: string | LinearGradient): Background;
 | 
				
			||||||
	public withRepeat(value: BackgroundRepeat): Background;
 | 
					// 	public withRepeat(value: BackgroundRepeat): Background;
 | 
				
			||||||
	public withPosition(value: string): Background;
 | 
					// 	public withPosition(value: string): Background;
 | 
				
			||||||
	public withSize(value: string): Background;
 | 
					// 	public withSize(value: string): Background;
 | 
				
			||||||
	public withBorderTopColor(value: Color): Background;
 | 
					// 	public withBorderTopColor(value: Color): Background;
 | 
				
			||||||
	public withBorderRightColor(value: Color): Background;
 | 
					// 	public withBorderRightColor(value: Color): Background;
 | 
				
			||||||
	public withBorderBottomColor(value: Color): Background;
 | 
					// 	public withBorderBottomColor(value: Color): Background;
 | 
				
			||||||
	public withBorderLeftColor(value: Color): Background;
 | 
					// 	public withBorderLeftColor(value: Color): Background;
 | 
				
			||||||
	public withBorderTopWidth(value: number): Background;
 | 
					// 	public withBorderTopWidth(value: number): Background;
 | 
				
			||||||
	public withBorderRightWidth(value: number): Background;
 | 
					// 	public withBorderRightWidth(value: number): Background;
 | 
				
			||||||
	public withBorderBottomWidth(value: number): Background;
 | 
					// 	public withBorderBottomWidth(value: number): Background;
 | 
				
			||||||
	public withBorderLeftWidth(value: number): Background;
 | 
					// 	public withBorderLeftWidth(value: number): Background;
 | 
				
			||||||
	public withBorderTopLeftRadius(value: number): Background;
 | 
					// 	public withBorderTopLeftRadius(value: number): Background;
 | 
				
			||||||
	public withBorderTopRightRadius(value: number): Background;
 | 
					// 	public withBorderTopRightRadius(value: number): Background;
 | 
				
			||||||
	public withBorderBottomRightRadius(value: number): Background;
 | 
					// 	public withBorderBottomRightRadius(value: number): Background;
 | 
				
			||||||
	public withBorderBottomLeftRadius(value: number): Background;
 | 
					// 	public withBorderBottomLeftRadius(value: number): Background;
 | 
				
			||||||
	public withClipPath(value: string): Background;
 | 
					// 	public withClipPath(value: string): Background;
 | 
				
			||||||
	public withBoxShadow(value: CSSShadow): Background;
 | 
					// 	public withBoxShadow(value: CSSShadow): Background;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public isEmpty(): boolean;
 | 
					// 	public isEmpty(): boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static equals(value1: Background, value2: Background): boolean;
 | 
					// 	public static equals(value1: Background, value2: Background): boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public hasBorderColor(): boolean;
 | 
					// 	public hasBorderColor(): boolean;
 | 
				
			||||||
	public hasBorderWidth(): boolean;
 | 
					// 	public hasBorderWidth(): boolean;
 | 
				
			||||||
	public hasBorderRadius(): boolean;
 | 
					// 	public hasBorderRadius(): boolean;
 | 
				
			||||||
	public hasUniformBorderColor(): boolean;
 | 
					// 	public hasUniformBorderColor(): boolean;
 | 
				
			||||||
	public hasUniformBorderWidth(): boolean;
 | 
					// 	public hasUniformBorderWidth(): boolean;
 | 
				
			||||||
	public hasUniformBorderRadius(): boolean;
 | 
					// 	public hasUniformBorderRadius(): boolean;
 | 
				
			||||||
	public hasUniformBorder(): boolean;
 | 
					// 	public hasUniformBorder(): boolean;
 | 
				
			||||||
	public getUniformBorderColor(): Color;
 | 
					// 	public getUniformBorderColor(): Color;
 | 
				
			||||||
	public getUniformBorderWidth(): number;
 | 
					// 	public getUniformBorderWidth(): number;
 | 
				
			||||||
	public getUniformBorderRadius(): number;
 | 
					// 	public getUniformBorderRadius(): number;
 | 
				
			||||||
	public hasBoxShadow(): boolean;
 | 
					// 	public hasBoxShadow(): boolean;
 | 
				
			||||||
	public getBoxShadow(): CSSShadow;
 | 
					// 	public getBoxShadow(): CSSShadow;
 | 
				
			||||||
}
 | 
					// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export namespace ios {
 | 
					export namespace ios {
 | 
				
			||||||
	export function createBackgroundUIColor(view: View, callback: (uiColor: any /* UIColor */) => void, flip?: boolean): void;
 | 
						export function createBackgroundUIColor(view: View, callback: (uiColor: any /* UIColor */) => void, flip?: boolean): void;
 | 
				
			||||||
@ -78,3 +80,5 @@ export namespace ios {
 | 
				
			|||||||
export namespace ad {
 | 
					export namespace ad {
 | 
				
			||||||
	export function onBackgroundOrBorderPropertyChanged(v: View);
 | 
						export function onBackgroundOrBorderPropertyChanged(v: View);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function refreshBorderDrawable(view: View, borderDrawable: any /* org.nativescript.widgets.BorderDrawable */): void;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user