Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,18 +3,16 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
import { focusBorder, inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectListBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listFocusForeground, listActiveSelectionBackground, listActiveSelectionForeground, listInactiveSelectionForeground, listInactiveSelectionBackground, listInactiveFocusBackground, listHoverBackground, listHoverForeground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground, ColorFunction, badgeBackground, badgeForeground, progressBarBackground, breadcrumbsForeground, breadcrumbsFocusForeground, breadcrumbsActiveSelectionForeground } from 'vs/platform/theme/common/colorRegistry';
import { focusBorder, inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectListBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listFocusForeground, listActiveSelectionBackground, listActiveSelectionForeground, listInactiveSelectionForeground, listInactiveSelectionBackground, listInactiveFocusBackground, listHoverBackground, listHoverForeground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground, ColorFunction, badgeBackground, badgeForeground, progressBarBackground, breadcrumbsForeground, breadcrumbsFocusForeground, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, editorWidgetBorder, inputValidationInfoForeground, inputValidationWarningForeground, inputValidationErrorForeground, menuForeground, menuBackground, menuSelectionForeground, menuSelectionBackground, menuSelectionBorder, menuBorder, menuSeparatorBackground } from 'vs/platform/theme/common/colorRegistry';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
export type styleFn = (colors: { [name: string]: Color }) => void;
export type styleFn = (colors: { [name: string]: Color | null }) => void;
export interface IStyleOverrides {
[color: string]: ColorIdentifier;
[color: string]: ColorIdentifier | undefined;
}
export interface IThemable {
@@ -26,7 +24,7 @@ export interface IColorMapping {
}
export interface IComputedStyles {
[color: string]: Color;
[color: string]: Color | null;
}
export function computeStyles(theme: ITheme, styleMap: IColorMapping): IComputedStyles {
@@ -89,10 +87,13 @@ export interface IInputBoxStyleOverrides extends IStyleOverrides {
inputActiveOptionBorder?: ColorIdentifier;
inputValidationInfoBorder?: ColorIdentifier;
inputValidationInfoBackground?: ColorIdentifier;
inputValidationInfoForeground?: ColorIdentifier;
inputValidationWarningBorder?: ColorIdentifier;
inputValidationWarningBackground?: ColorIdentifier;
inputValidationWarningForeground?: ColorIdentifier;
inputValidationErrorBorder?: ColorIdentifier;
inputValidationErrorBackground?: ColorIdentifier;
inputValidationErrorForeground?: ColorIdentifier;
}
export function attachInputBoxStyler(widget: IThemable, themeService: IThemeService, style?: IInputBoxStyleOverrides): IDisposable {
@@ -102,10 +103,13 @@ export function attachInputBoxStyler(widget: IThemable, themeService: IThemeServ
inputBorder: (style && style.inputBorder) || inputBorder,
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || inputValidationInfoBorder,
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || inputValidationInfoBackground,
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || inputValidationInfoForeground,
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || inputValidationWarningBorder,
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || inputValidationWarningBackground,
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || inputValidationWarningForeground,
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || inputValidationErrorBorder,
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground,
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || inputValidationErrorForeground
} as IInputBoxStyleOverrides, widget);
}
@@ -129,7 +133,8 @@ export function attachSelectBoxStyler(widget: IThemable, themeService: IThemeSer
listFocusOutline: (style && style.listFocusOutline) || activeContrastBorder,
listHoverBackground: (style && style.listHoverBackground) || listHoverBackground,
listHoverForeground: (style && style.listHoverForeground) || listHoverForeground,
listHoverOutline: (style && style.listFocusOutline) || activeContrastBorder
listHoverOutline: (style && style.listFocusOutline) || activeContrastBorder,
selectListBorder: (style && style.selectListBorder) || editorWidgetBorder
} as ISelectBoxStyleOverrides, widget);
}
@@ -141,10 +146,13 @@ export function attachFindInputBoxStyler(widget: IThemable, themeService: ITheme
inputActiveOptionBorder: (style && style.inputActiveOptionBorder) || inputActiveOptionBorder,
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || inputValidationInfoBorder,
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || inputValidationInfoBackground,
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || inputValidationInfoForeground,
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || inputValidationWarningBorder,
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || inputValidationWarningBackground,
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || inputValidationWarningForeground,
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || inputValidationErrorBorder,
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground,
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || inputValidationErrorForeground
} as IInputBoxStyleOverrides, widget);
}
@@ -171,10 +179,13 @@ export function attachQuickOpenStyler(widget: IThemable, themeService: IThemeSer
inputBorder: (style && style.inputBorder) || inputBorder,
inputValidationInfoBorder: (style && style.inputValidationInfoBorder) || inputValidationInfoBorder,
inputValidationInfoBackground: (style && style.inputValidationInfoBackground) || inputValidationInfoBackground,
inputValidationInfoForeground: (style && style.inputValidationInfoForeground) || inputValidationInfoForeground,
inputValidationWarningBorder: (style && style.inputValidationWarningBorder) || inputValidationWarningBorder,
inputValidationWarningBackground: (style && style.inputValidationWarningBackground) || inputValidationWarningBackground,
inputValidationWarningForeground: (style && style.inputValidationWarningForeground) || inputValidationWarningForeground,
inputValidationErrorBorder: (style && style.inputValidationErrorBorder) || inputValidationErrorBorder,
inputValidationErrorBackground: (style && style.inputValidationErrorBackground) || inputValidationErrorBackground,
inputValidationErrorForeground: (style && style.inputValidationErrorForeground) || inputValidationErrorForeground,
listFocusBackground: (style && style.listFocusBackground) || listFocusBackground,
listFocusForeground: (style && style.listFocusForeground) || listFocusForeground,
listActiveSelectionBackground: (style && style.listActiveSelectionBackground) || listActiveSelectionBackground,
@@ -263,8 +274,8 @@ export function attachStylerCallback(themeService: IThemeService, colors: { [nam
return attachStyler(themeService, colors, callback);
}
export interface IBreadcrumbsWidgetStyleOverrides extends IStyleOverrides {
breadcrumbsBackground?: ColorIdentifier;
export interface IBreadcrumbsWidgetStyleOverrides extends IColorMapping {
breadcrumbsBackground?: ColorIdentifier | ColorFunction;
breadcrumbsForeground?: ColorIdentifier;
breadcrumbsHoverForeground?: ColorIdentifier;
breadcrumbsFocusForeground?: ColorIdentifier;
@@ -272,7 +283,7 @@ export interface IBreadcrumbsWidgetStyleOverrides extends IStyleOverrides {
}
export const defaultBreadcrumbsStyles = <IBreadcrumbsWidgetStyleOverrides>{
breadcrumbsBackground: editorBackground,
breadcrumbsBackground: breadcrumbsBackground,
breadcrumbsForeground: breadcrumbsForeground,
breadcrumbsHoverForeground: breadcrumbsFocusForeground,
breadcrumbsFocusForeground: breadcrumbsFocusForeground,
@@ -282,3 +293,34 @@ export const defaultBreadcrumbsStyles = <IBreadcrumbsWidgetStyleOverrides>{
export function attachBreadcrumbsStyler(widget: IThemable, themeService: IThemeService, style?: IBreadcrumbsWidgetStyleOverrides): IDisposable {
return attachStyler(themeService, { ...defaultBreadcrumbsStyles, ...style }, widget);
}
export interface IMenuStyleOverrides extends IColorMapping {
shadowColor?: ColorIdentifier;
borderColor?: ColorIdentifier;
foregroundColor?: ColorIdentifier;
backgroundColor?: ColorIdentifier;
selectionForegroundColor?: ColorIdentifier;
selectionBackgroundColor?: ColorIdentifier;
selectionBorderColor?: ColorIdentifier;
separatorColor?: ColorIdentifier;
}
export const defaultMenuStyles = <IMenuStyleOverrides>{
shadowColor: widgetShadow,
borderColor: menuBorder,
foregroundColor: menuForeground,
backgroundColor: menuBackground,
selectionForegroundColor: menuSelectionForeground,
selectionBackgroundColor: menuSelectionBackground,
selectionBorderColor: menuSelectionBorder,
separatorColor: menuSeparatorBackground
};
export function attachMenuStyler(widget: IThemable, themeService, style?: IMenuStyleOverrides): IDisposable {
const styles = { ...defaultMenuStyles, ...style };
const fallback: IMenuStyleOverrides = {
foregroundColor: !!styles.foregroundColor && !!themeService && !!themeService.getTheme().getColor(styles.foregroundColor) ? styles.foregroundColor : foreground
};
return attachStyler(themeService, { ...styles, ...fallback }, widget);
}