Completely updated React, fixed #11, (hopefully)
This commit is contained in:
194
goTorrentWebUI/node_modules/material-ui/styles/createPalette.js
generated
vendored
194
goTorrentWebUI/node_modules/material-ui/styles/createPalette.js
generated
vendored
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.dark = exports.light = undefined;
|
||||
|
||||
var _keys = require('babel-runtime/core-js/object/keys');
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _keys2 = _interopRequireDefault(_keys);
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
@@ -49,124 +49,160 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
// < 1kb payload overhead when lodash/merge is > 3kb.
|
||||
var light = exports.light = {
|
||||
// The colors used to style the text.
|
||||
text: {
|
||||
// The most important text.
|
||||
primary: 'rgba(0, 0, 0, 0.87)',
|
||||
// Secondary text.
|
||||
secondary: 'rgba(0, 0, 0, 0.54)',
|
||||
// Disabled text have even lower visual prominence.
|
||||
disabled: 'rgba(0, 0, 0, 0.38)',
|
||||
hint: 'rgba(0, 0, 0, 0.38)',
|
||||
icon: 'rgba(0, 0, 0, 0.38)',
|
||||
divider: 'rgba(0, 0, 0, 0.12)',
|
||||
lightDivider: 'rgba(0, 0, 0, 0.075)'
|
||||
},
|
||||
input: {
|
||||
bottomLine: 'rgba(0, 0, 0, 0.42)',
|
||||
helperText: 'rgba(0, 0, 0, 0.54)',
|
||||
labelText: 'rgba(0, 0, 0, 0.54)',
|
||||
inputText: 'rgba(0, 0, 0, 0.87)',
|
||||
disabled: 'rgba(0, 0, 0, 0.42)'
|
||||
},
|
||||
action: {
|
||||
active: 'rgba(0, 0, 0, 0.54)',
|
||||
disabled: 'rgba(0, 0, 0, 0.26)'
|
||||
// Text hints.
|
||||
hint: 'rgba(0, 0, 0, 0.38)'
|
||||
},
|
||||
// The color used to divide different elements.
|
||||
divider: 'rgba(0, 0, 0, 0.12)',
|
||||
// The background colors used to style the surfaces.
|
||||
// Consistency between these values is important.
|
||||
background: {
|
||||
default: _grey2.default[50],
|
||||
paper: _common2.default.white,
|
||||
appBar: _grey2.default[100],
|
||||
contentFrame: _grey2.default[200]
|
||||
default: _grey2.default[50]
|
||||
},
|
||||
// The colors used to style the action elements.
|
||||
action: {
|
||||
// The color of an active action like an icon button.
|
||||
active: 'rgba(0, 0, 0, 0.54)',
|
||||
// The color of an hovered action.
|
||||
hover: 'rgba(0, 0, 0, 0.08)',
|
||||
// The color of a selected action.
|
||||
selected: 'rgba(0, 0, 0, 0.14)',
|
||||
// The color of a disabled action.
|
||||
disabled: 'rgba(0, 0, 0, 0.26)',
|
||||
// The background color of a disabled action.
|
||||
disabledBackground: 'rgba(0, 0, 0, 0.12)'
|
||||
}
|
||||
};
|
||||
|
||||
var dark = exports.dark = {
|
||||
text: {
|
||||
primary: 'rgba(255, 255, 255, 1)',
|
||||
primary: _common2.default.white,
|
||||
secondary: 'rgba(255, 255, 255, 0.7)',
|
||||
disabled: 'rgba(255, 255, 255, 0.5)',
|
||||
hint: 'rgba(255, 255, 255, 0.5)',
|
||||
icon: 'rgba(255, 255, 255, 0.5)',
|
||||
divider: 'rgba(255, 255, 255, 0.12)',
|
||||
lightDivider: 'rgba(255, 255, 255, 0.075)'
|
||||
icon: 'rgba(255, 255, 255, 0.5)'
|
||||
},
|
||||
input: {
|
||||
bottomLine: 'rgba(255, 255, 255, 0.7)',
|
||||
helperText: 'rgba(255, 255, 255, 0.7)',
|
||||
labelText: 'rgba(255, 255, 255, 0.7)',
|
||||
inputText: 'rgba(255, 255, 255, 1)',
|
||||
disabled: 'rgba(255, 255, 255, 0.5)'
|
||||
divider: 'rgba(255, 255, 255, 0.12)',
|
||||
background: {
|
||||
paper: _grey2.default[800],
|
||||
default: '#303030'
|
||||
},
|
||||
action: {
|
||||
active: 'rgba(255, 255, 255, 1)',
|
||||
disabled: 'rgba(255, 255, 255, 0.3)'
|
||||
},
|
||||
background: {
|
||||
default: '#303030',
|
||||
paper: _grey2.default[800],
|
||||
appBar: _grey2.default[900],
|
||||
contentFrame: _grey2.default[900]
|
||||
active: _common2.default.white,
|
||||
hover: 'rgba(255, 255, 255, 0.1)',
|
||||
selected: 'rgba(255, 255, 255, 0.2)',
|
||||
disabled: 'rgba(255, 255, 255, 0.3)',
|
||||
disabledBackground: 'rgba(255, 255, 255, 0.12)'
|
||||
}
|
||||
};
|
||||
|
||||
function getContrastText(color) {
|
||||
if ((0, _colorManipulator.getContrastRatio)(color, _common2.default.black) < 7) {
|
||||
return dark.text.primary;
|
||||
function addLightOrDark(intent, direction, shade, tonalOffset) {
|
||||
if (!intent[direction]) {
|
||||
if (intent.hasOwnProperty(shade)) {
|
||||
intent[direction] = intent[shade];
|
||||
} else if (direction === 'light') {
|
||||
intent.light = (0, _colorManipulator.lighten)(intent.main, tonalOffset);
|
||||
} else if (direction === 'dark') {
|
||||
intent.dark = (0, _colorManipulator.darken)(intent.main, tonalOffset * 1.5);
|
||||
}
|
||||
}
|
||||
return light.text.primary;
|
||||
}
|
||||
|
||||
function createPalette(palette) {
|
||||
var _palette$primary = palette.primary,
|
||||
primary = _palette$primary === undefined ? _indigo2.default : _palette$primary,
|
||||
primary = _palette$primary === undefined ? {
|
||||
light: _indigo2.default[300],
|
||||
main: _indigo2.default[500],
|
||||
dark: _indigo2.default[700]
|
||||
} : _palette$primary,
|
||||
_palette$secondary = palette.secondary,
|
||||
secondary = _palette$secondary === undefined ? _pink2.default : _palette$secondary,
|
||||
secondary = _palette$secondary === undefined ? {
|
||||
light: _pink2.default.A200,
|
||||
main: _pink2.default.A400,
|
||||
dark: _pink2.default.A700
|
||||
} : _palette$secondary,
|
||||
_palette$error = palette.error,
|
||||
error = _palette$error === undefined ? _red2.default : _palette$error,
|
||||
error = _palette$error === undefined ? {
|
||||
light: _red2.default[300],
|
||||
main: _red2.default[500],
|
||||
dark: _red2.default[700]
|
||||
} : _palette$error,
|
||||
_palette$type = palette.type,
|
||||
type = _palette$type === undefined ? 'light' : _palette$type,
|
||||
other = (0, _objectWithoutProperties3.default)(palette, ['primary', 'secondary', 'error', 'type']);
|
||||
_palette$contrastThre = palette.contrastThreshold,
|
||||
contrastThreshold = _palette$contrastThre === undefined ? 3 : _palette$contrastThre,
|
||||
_palette$tonalOffset = palette.tonalOffset,
|
||||
tonalOffset = _palette$tonalOffset === undefined ? 0.2 : _palette$tonalOffset,
|
||||
other = (0, _objectWithoutProperties3.default)(palette, ['primary', 'secondary', 'error', 'type', 'contrastThreshold', 'tonalOffset']);
|
||||
|
||||
var shades = { dark: dark, light: light };
|
||||
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(Boolean(shades[type]), 'Material-UI: the palette type `' + type + '` is not supported.') : void 0;
|
||||
function getContrastText(background) {
|
||||
// Use the same logic as
|
||||
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
|
||||
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
|
||||
var contrastText = (0, _colorManipulator.getContrastRatio)(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
||||
|
||||
var paletteOutput = (0, _deepmerge2.default)({
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var contrast = (0, _colorManipulator.getContrastRatio)(background, contrastText);
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(contrast >= 3, ['Material-UI: the contrast ratio of ' + contrast + ':1 for ' + contrastText + ' on ' + background, 'falls below the WACG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\n')) : void 0;
|
||||
}
|
||||
|
||||
return contrastText;
|
||||
}
|
||||
|
||||
function augmentColor(color, mainShade, lightShade, darkShade) {
|
||||
if (!color.main && color[mainShade]) {
|
||||
color.main = color[mainShade];
|
||||
}
|
||||
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
||||
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
||||
if (!color.contrastText) {
|
||||
color.contrastText = getContrastText(color.main);
|
||||
}
|
||||
}
|
||||
|
||||
augmentColor(primary, 500, 300, 700);
|
||||
augmentColor(secondary, 'A400', 'A200', 'A700');
|
||||
augmentColor(error, 500, 300, 700);
|
||||
|
||||
var types = { dark: dark, light: light };
|
||||
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(types[type], 'Material-UI: the palette type `' + type + '` is not supported.') : void 0;
|
||||
|
||||
var paletteOutput = (0, _deepmerge2.default)((0, _extends3.default)({
|
||||
// A collection of common colors.
|
||||
common: _common2.default,
|
||||
// The palette type, can be light or dark.
|
||||
type: type,
|
||||
// The colors used to represent primary interface elements for a user.
|
||||
primary: primary,
|
||||
// The colors used to represent secondary interface elements for a user.
|
||||
secondary: secondary,
|
||||
// The colors used to represent interface elements that the user should be made aware of.
|
||||
error: error,
|
||||
// The grey colors.
|
||||
grey: _grey2.default,
|
||||
shades: shades,
|
||||
text: shades[type].text,
|
||||
input: shades[type].input,
|
||||
action: shades[type].action,
|
||||
background: shades[type].background,
|
||||
getContrastText: getContrastText
|
||||
}, other, {
|
||||
// Used by `getContrastText()` to maximize the contrast between the background and
|
||||
// the text.
|
||||
contrastThreshold: contrastThreshold,
|
||||
// Take a background color and return the color of the text to maximize the contrast.
|
||||
getContrastText: getContrastText,
|
||||
// Used by the functions below to shift a color's luminance by approximately
|
||||
// two indexes within its tonal palette.
|
||||
// E.g., shift from Red 500 to Red 300 or Red 700.
|
||||
tonalOffset: tonalOffset
|
||||
}, types[type]), other, {
|
||||
clone: false // No need to clone deep
|
||||
});
|
||||
|
||||
// Dev warnings
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var difference = function difference(base, compare) {
|
||||
if (!compare) {
|
||||
compare = {};
|
||||
}
|
||||
|
||||
return (0, _keys2.default)(base).filter(function (hue) {
|
||||
return !compare[hue];
|
||||
});
|
||||
};
|
||||
|
||||
var paletteColorError = function paletteColorError(name, base, compare) {
|
||||
var missing = difference(base, compare);
|
||||
process.env.NODE_ENV !== "production" ? (0, _warning2.default)(missing.length === 0, ['Material-UI: ' + name + ' color is missing the following hues: ' + missing.join(','), 'See the default colors, indigo, or pink, as exported from material-ui/colors.'].join('\n')) : void 0;
|
||||
};
|
||||
|
||||
paletteColorError('primary', _indigo2.default, paletteOutput.primary);
|
||||
paletteColorError('secondary', _pink2.default, paletteOutput.secondary);
|
||||
paletteColorError('error', _red2.default, paletteOutput.error);
|
||||
paletteColorError('grey', _red2.default, paletteOutput.grey);
|
||||
}
|
||||
|
||||
return paletteOutput;
|
||||
}
|
Reference in New Issue
Block a user