diff --git a/.documentation.json b/.documentation.json index 405c55b2..732d6fa6 100644 --- a/.documentation.json +++ b/.documentation.json @@ -85,11 +85,10 @@ "name": "Types" }, "AnimationProperty", - "ButtonState", "FontFaceConfiguration", "HslColor", "HslaColor", - "InputState", + "InteractionState", "PointingDirection", "RadialGradientConfiguration", "Ratio", diff --git a/.flowconfig b/.flowconfig index e2144cdb..05a68dae 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,10 +1,9 @@ [ignore] .*/node_modules/.* +.*/lib/.* [include] [libs] [options] - -suppress_comment=.*\\$FlowIgnoreNextLine diff --git a/README.md b/README.md index 39eb8755..5a6fca1e 100644 --- a/README.md +++ b/README.md @@ -135,11 +135,10 @@ In the documentation you will see examples using [object spread properties](http Types diff --git a/docs/assets/polished.js b/docs/assets/polished.js index efddb5f3..c98ef6fa 100644 --- a/docs/assets/polished.js +++ b/docs/assets/polished.js @@ -65,7 +65,7 @@ function directionalProperty(property) { values[_key - 1] = arguments[_key]; } - // $FlowIgnoreNextLine doesn't understand destructuring with chained defaults. + // prettier-ignore var firstValue = values[0], _values$ = values[1], secondValue = _values$ === undefined ? firstValue : _values$, @@ -156,7 +156,6 @@ var pxtoFactory$1 = function pxtoFactory$1(to) { }; // - /** * Convert pixel value to ems. The default base value is 16px, but can be changed by passing a * second argument to the function. @@ -437,9 +436,9 @@ function clearFix() { var pseudoSelector = parent + '::after'; return defineProperty({}, pseudoSelector, { - 'clear': 'both', - 'content': '""', - 'display': 'table' + clear: 'both', + content: '""', + display: 'table' }); } @@ -475,12 +474,12 @@ function ellipsis() { var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%'; return { - 'display': 'inline-block', - 'maxWidth': width, - 'overflow': 'hidden', - 'textOverflow': 'ellipsis', - 'whiteSpace': 'nowrap', - 'wordWrap': 'normal' + display: 'inline-block', + maxWidth: width, + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + wordWrap: 'normal' }; } @@ -505,7 +504,9 @@ function generateLocalReferences(localFonts) { function generateSources(fontFilePath, localFonts, fileFormats) { var fontReferences = []; if (localFonts) fontReferences.push(generateLocalReferences(localFonts)); - if (fontFilePath) fontReferences.push(generateFileReferences(fontFilePath, fileFormats)); + if (fontFilePath) { + fontReferences.push(generateFileReferences(fontFilePath, fileFormats)); + } return fontReferences.join(', '); } @@ -551,9 +552,15 @@ function fontFace(_ref) { // Error Handling if (!fontFamily) throw new Error('fontFace expects a name of a font-family.'); - if (!fontFilePath && !localFonts) throw new Error('fontFace expects either the path to the font file(s) or a name of a local copy.'); - if (localFonts && !Array.isArray(localFonts)) throw new Error('fontFace expects localFonts to be an array.'); - if (!Array.isArray(fileFormats)) throw new Error('fontFace expects fileFormats to be an array.'); + if (!fontFilePath && !localFonts) { + throw new Error('fontFace expects either the path to the font file(s) or a name of a local copy.'); + } + if (localFonts && !Array.isArray(localFonts)) { + throw new Error('fontFace expects localFonts to be an array.'); + } + if (!Array.isArray(fileFormats)) { + throw new Error('fontFace expects fileFormats to be an array.'); + } var fontFaceDeclaration = { '@font-face': { @@ -924,7 +931,9 @@ function radialGradient(_ref) { position = _ref.position, shape = _ref.shape; - if (!colorStops || colorStops.length < 2) throw new Error('radialGradient requries at least 2 color-stops to properly render.'); + if (!colorStops || colorStops.length < 2) { + throw new Error('radialGradient requries at least 2 color-stops to properly render.'); + } return { backgroundColor: fallback || parseFallback(colorStops), backgroundImage: constructGradientValue(_templateObject, position, shape, extent, colorStops.join(', ')) @@ -1023,32 +1032,32 @@ function selection(styles) { /* eslint-disable key-spacing */ var functionsMap = { - 'easeInBack': 'cubic-bezier(0.600, -0.280, 0.735, 0.045)', - 'easeInCirc': 'cubic-bezier(0.600, 0.040, 0.980, 0.335)', - 'easeInCubic': 'cubic-bezier(0.550, 0.055, 0.675, 0.190)', - 'easeInExpo': 'cubic-bezier(0.950, 0.050, 0.795, 0.035)', - 'easeInQuad': 'cubic-bezier(0.550, 0.085, 0.680, 0.530)', - 'easeInQuart': 'cubic-bezier(0.895, 0.030, 0.685, 0.220)', - 'easeInQuint': 'cubic-bezier(0.755, 0.050, 0.855, 0.060)', - 'easeInSine': 'cubic-bezier(0.470, 0.000, 0.745, 0.715)', - - 'easeOutBack': 'cubic-bezier(0.175, 0.885, 0.320, 1.275)', - 'easeOutCubic': 'cubic-bezier(0.215, 0.610, 0.355, 1.000)', - 'easeOutCirc': 'cubic-bezier(0.075, 0.820, 0.165, 1.000)', - 'easeOutExpo': 'cubic-bezier(0.190, 1.000, 0.220, 1.000)', - 'easeOutQuad': 'cubic-bezier(0.250, 0.460, 0.450, 0.940)', - 'easeOutQuart': 'cubic-bezier(0.165, 0.840, 0.440, 1.000)', - 'easeOutQuint': 'cubic-bezier(0.230, 1.000, 0.320, 1.000)', - 'easeOutSine': 'cubic-bezier(0.390, 0.575, 0.565, 1.000)', - - 'easeInOutBack': 'cubic-bezier(0.680, -0.550, 0.265, 1.550)', - 'easeInOutCirc': 'cubic-bezier(0.785, 0.135, 0.150, 0.860)', - 'easeInOutCubic': 'cubic-bezier(0.645, 0.045, 0.355, 1.000)', - 'easeInOutExpo': 'cubic-bezier(1.000, 0.000, 0.000, 1.000)', - 'easeInOutQuad': 'cubic-bezier(0.455, 0.030, 0.515, 0.955)', - 'easeInOutQuart': 'cubic-bezier(0.770, 0.000, 0.175, 1.000)', - 'easeInOutQuint': 'cubic-bezier(0.860, 0.000, 0.070, 1.000)', - 'easeInOutSine': 'cubic-bezier(0.445, 0.050, 0.550, 0.950)' + easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.045)', + easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)', + easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)', + easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)', + easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)', + easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)', + easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)', + easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)', + + easeOutBack: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)', + easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)', + easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)', + easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)', + easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)', + easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)', + easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)', + easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)', + + easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)', + easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)', + easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)', + easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)', + easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)', + easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)', + easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)', + easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)' }; /* eslint-enable key-spacing */ @@ -1095,7 +1104,7 @@ var getBorderWidth = function getBorderWidth(pointingDirection, height, width) { return height / 2 + 'px 0 ' + height / 2 + 'px ' + width + 'px'; default: - throw new Error('Passed invalid argument to triangle, please pass correct poitingDirection e.g. \'right\'.'); + throw new Error("Passed invalid argument to triangle, please pass correct poitingDirection e.g. 'right'."); } }; @@ -1166,19 +1175,19 @@ function triangle(_ref) { * @example * // Styles as object usage * const styles = { - * ...wordWrap('break-all') + * ...wordWrap('break-word') * } * * // styled-components usage * const div = styled.div` - * ${wordWrap('break-all')} + * ${wordWrap('break-word')} * ` * * // CSS as JS Output * * const styles = { - * overflowWrap: 'break-all', - * wordWrap: 'break-all', + * overflowWrap: 'break-word', + * wordWrap: 'break-word', * wordBreak: 'break-all', * } */ @@ -1251,154 +1260,154 @@ function hslToRgb(hue, saturation, lightness) { // var namedColorMap = { - 'aliceblue': 'f0f8ff', - 'antiquewhite': 'faebd7', - 'aqua': '00ffff', - 'aquamarine': '7fffd4', - 'azure': 'f0ffff', - 'beige': 'f5f5dc', - 'bisque': 'ffe4c4', - 'black': '000', - 'blanchedalmond': 'ffebcd', - 'blue': '0000ff', - 'blueviolet': '8a2be2', - 'brown': 'a52a2a', - 'burlywood': 'deb887', - 'cadetblue': '5f9ea0', - 'chartreuse': '7fff00', - 'chocolate': 'd2691e', - 'coral': 'ff7f50', - 'cornflowerblue': '6495ed', - 'cornsilk': 'fff8dc', - 'crimson': 'dc143c', - 'cyan': '00ffff', - 'darkblue': '00008b', - 'darkcyan': '008b8b', - 'darkgoldenrod': 'b8860b', - 'darkgray': 'a9a9a9', - 'darkgreen': '006400', - 'darkgrey': 'a9a9a9', - 'darkkhaki': 'bdb76b', - 'darkmagenta': '8b008b', - 'darkolivegreen': '556b2f', - 'darkorange': 'ff8c00', - 'darkorchid': '9932cc', - 'darkred': '8b0000', - 'darksalmon': 'e9967a', - 'darkseagreen': '8fbc8f', - 'darkslateblue': '483d8b', - 'darkslategray': '2f4f4f', - 'darkslategrey': '2f4f4f', - 'darkturquoise': '00ced1', - 'darkviolet': '9400d3', - 'deeppink': 'ff1493', - 'deepskyblue': '00bfff', - 'dimgray': '696969', - 'dimgrey': '696969', - 'dodgerblue': '1e90ff', - 'firebrick': 'b22222', - 'floralwhite': 'fffaf0', - 'forestgreen': '228b22', - 'fuchsia': 'ff00ff', - 'gainsboro': 'dcdcdc', - 'ghostwhite': 'f8f8ff', - 'gold': 'ffd700', - 'goldenrod': 'daa520', - 'gray': '808080', - 'green': '008000', - 'greenyellow': 'adff2f', - 'grey': '808080', - 'honeydew': 'f0fff0', - 'hotpink': 'ff69b4', - 'indianred': 'cd5c5c', - 'indigo': '4b0082', - 'ivory': 'fffff0', - 'khaki': 'f0e68c', - 'lavender': 'e6e6fa', - 'lavenderblush': 'fff0f5', - 'lawngreen': '7cfc00', - 'lemonchiffon': 'fffacd', - 'lightblue': 'add8e6', - 'lightcoral': 'f08080', - 'lightcyan': 'e0ffff', - 'lightgoldenrodyellow': 'fafad2', - 'lightgray': 'd3d3d3', - 'lightgreen': '90ee90', - 'lightgrey': 'd3d3d3', - 'lightpink': 'ffb6c1', - 'lightsalmon': 'ffa07a', - 'lightseagreen': '20b2aa', - 'lightskyblue': '87cefa', - 'lightslategray': '789', - 'lightslategrey': '789', - 'lightsteelblue': 'b0c4de', - 'lightyellow': 'ffffe0', - 'lime': '0f0', - 'limegreen': '32cd32', - 'linen': 'faf0e6', - 'magenta': 'f0f', - 'maroon': '800000', - 'mediumaquamarine': '66cdaa', - 'mediumblue': '0000cd', - 'mediumorchid': 'ba55d3', - 'mediumpurple': '9370db', - 'mediumseagreen': '3cb371', - 'mediumslateblue': '7b68ee', - 'mediumspringgreen': '00fa9a', - 'mediumturquoise': '48d1cc', - 'mediumvioletred': 'c71585', - 'midnightblue': '191970', - 'mintcream': 'f5fffa', - 'mistyrose': 'ffe4e1', - 'moccasin': 'ffe4b5', - 'navajowhite': 'ffdead', - 'navy': '000080', - 'oldlace': 'fdf5e6', - 'olive': '808000', - 'olivedrab': '6b8e23', - 'orange': 'ffa500', - 'orangered': 'ff4500', - 'orchid': 'da70d6', - 'palegoldenrod': 'eee8aa', - 'palegreen': '98fb98', - 'paleturquoise': 'afeeee', - 'palevioletred': 'db7093', - 'papayawhip': 'ffefd5', - 'peachpuff': 'ffdab9', - 'peru': 'cd853f', - 'pink': 'ffc0cb', - 'plum': 'dda0dd', - 'powderblue': 'b0e0e6', - 'purple': '800080', - 'rebeccapurple': '639', - 'red': 'f00', - 'rosybrown': 'bc8f8f', - 'royalblue': '4169e1', - 'saddlebrown': '8b4513', - 'salmon': 'fa8072', - 'sandybrown': 'f4a460', - 'seagreen': '2e8b57', - 'seashell': 'fff5ee', - 'sienna': 'a0522d', - 'silver': 'c0c0c0', - 'skyblue': '87ceeb', - 'slateblue': '6a5acd', - 'slategray': '708090', - 'slategrey': '708090', - 'snow': 'fffafa', - 'springgreen': '00ff7f', - 'steelblue': '4682b4', - 'tan': 'd2b48c', - 'teal': '008080', - 'thistle': 'd8bfd8', - 'tomato': 'ff6347', - 'turquoise': '40e0d0', - 'violet': 'ee82ee', - 'wheat': 'f5deb3', - 'white': 'fff', - 'whitesmoke': 'f5f5f5', - 'yellow': 'ff0', - 'yellowgreen': '9acd32' + aliceblue: 'f0f8ff', + antiquewhite: 'faebd7', + aqua: '00ffff', + aquamarine: '7fffd4', + azure: 'f0ffff', + beige: 'f5f5dc', + bisque: 'ffe4c4', + black: '000', + blanchedalmond: 'ffebcd', + blue: '0000ff', + blueviolet: '8a2be2', + brown: 'a52a2a', + burlywood: 'deb887', + cadetblue: '5f9ea0', + chartreuse: '7fff00', + chocolate: 'd2691e', + coral: 'ff7f50', + cornflowerblue: '6495ed', + cornsilk: 'fff8dc', + crimson: 'dc143c', + cyan: '00ffff', + darkblue: '00008b', + darkcyan: '008b8b', + darkgoldenrod: 'b8860b', + darkgray: 'a9a9a9', + darkgreen: '006400', + darkgrey: 'a9a9a9', + darkkhaki: 'bdb76b', + darkmagenta: '8b008b', + darkolivegreen: '556b2f', + darkorange: 'ff8c00', + darkorchid: '9932cc', + darkred: '8b0000', + darksalmon: 'e9967a', + darkseagreen: '8fbc8f', + darkslateblue: '483d8b', + darkslategray: '2f4f4f', + darkslategrey: '2f4f4f', + darkturquoise: '00ced1', + darkviolet: '9400d3', + deeppink: 'ff1493', + deepskyblue: '00bfff', + dimgray: '696969', + dimgrey: '696969', + dodgerblue: '1e90ff', + firebrick: 'b22222', + floralwhite: 'fffaf0', + forestgreen: '228b22', + fuchsia: 'ff00ff', + gainsboro: 'dcdcdc', + ghostwhite: 'f8f8ff', + gold: 'ffd700', + goldenrod: 'daa520', + gray: '808080', + green: '008000', + greenyellow: 'adff2f', + grey: '808080', + honeydew: 'f0fff0', + hotpink: 'ff69b4', + indianred: 'cd5c5c', + indigo: '4b0082', + ivory: 'fffff0', + khaki: 'f0e68c', + lavender: 'e6e6fa', + lavenderblush: 'fff0f5', + lawngreen: '7cfc00', + lemonchiffon: 'fffacd', + lightblue: 'add8e6', + lightcoral: 'f08080', + lightcyan: 'e0ffff', + lightgoldenrodyellow: 'fafad2', + lightgray: 'd3d3d3', + lightgreen: '90ee90', + lightgrey: 'd3d3d3', + lightpink: 'ffb6c1', + lightsalmon: 'ffa07a', + lightseagreen: '20b2aa', + lightskyblue: '87cefa', + lightslategray: '789', + lightslategrey: '789', + lightsteelblue: 'b0c4de', + lightyellow: 'ffffe0', + lime: '0f0', + limegreen: '32cd32', + linen: 'faf0e6', + magenta: 'f0f', + maroon: '800000', + mediumaquamarine: '66cdaa', + mediumblue: '0000cd', + mediumorchid: 'ba55d3', + mediumpurple: '9370db', + mediumseagreen: '3cb371', + mediumslateblue: '7b68ee', + mediumspringgreen: '00fa9a', + mediumturquoise: '48d1cc', + mediumvioletred: 'c71585', + midnightblue: '191970', + mintcream: 'f5fffa', + mistyrose: 'ffe4e1', + moccasin: 'ffe4b5', + navajowhite: 'ffdead', + navy: '000080', + oldlace: 'fdf5e6', + olive: '808000', + olivedrab: '6b8e23', + orange: 'ffa500', + orangered: 'ff4500', + orchid: 'da70d6', + palegoldenrod: 'eee8aa', + palegreen: '98fb98', + paleturquoise: 'afeeee', + palevioletred: 'db7093', + papayawhip: 'ffefd5', + peachpuff: 'ffdab9', + peru: 'cd853f', + pink: 'ffc0cb', + plum: 'dda0dd', + powderblue: 'b0e0e6', + purple: '800080', + rebeccapurple: '639', + red: 'f00', + rosybrown: 'bc8f8f', + royalblue: '4169e1', + saddlebrown: '8b4513', + salmon: 'fa8072', + sandybrown: 'f4a460', + seagreen: '2e8b57', + seashell: 'fff5ee', + sienna: 'a0522d', + silver: 'c0c0c0', + skyblue: '87ceeb', + slateblue: '6a5acd', + slategray: '708090', + slategrey: '708090', + snow: 'fffafa', + springgreen: '00ff7f', + steelblue: '4682b4', + tan: 'd2b48c', + teal: '008080', + thistle: 'd8bfd8', + tomato: 'ff6347', + turquoise: '40e0d0', + violet: 'ee82ee', + wheat: 'f5deb3', + white: 'fff', + whitesmoke: 'f5f5f5', + yellow: 'ff0', + yellowgreen: '9acd32' }; /** @@ -1412,7 +1421,6 @@ function nameToHex(color) { } // - var hexRegex = /^#[a-fA-F0-9]{6}$/; var reducedHexRegex = /^#[a-fA-F0-9]{3}$/; var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/; @@ -1432,7 +1440,9 @@ var hslaRegex = /^hsla\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*,\s*([- * const color2 = 'hsla(210, 10%, 40%, 0.75)'; */ function parseToRgb(color) { - if (typeof color !== 'string') throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.'); + if (typeof color !== 'string') { + throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.'); + } var normalizedColor = nameToHex(color); if (normalizedColor.match(hexRegex)) { return { @@ -1492,7 +1502,7 @@ function parseToRgb(color) { alpha: parseFloat('' + hslaMatched[4]) }; } - throw new Error('Couldn\'t parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.'); + throw new Error("Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation."); } // @@ -1573,7 +1583,6 @@ var reduceHexValue = function reduceHexValue(value) { }; // - function numberToHex(value) { var hex = value.toString(16); return hex.length === 1 ? "0" + hex : hex; @@ -1664,7 +1673,6 @@ function rgba(firstValue, secondValue, thirdValue, fourthValue) { } // - function colorToHex(color) { return numberToHex(Math.round(color * 255)); } @@ -1751,31 +1759,24 @@ function hsla(value, saturation, lightness, alpha) { } // - var isRgb = function isRgb(color) { - return (typeof color === 'undefined' ? 'undefined' : _typeof(color)) === 'object' && typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && - // $FlowIgnoreNextLine not sure why this complains - typeof color.alpha !== 'number'; + return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined'); }; var isRgba = function isRgba(color) { - return (typeof color === 'undefined' ? 'undefined' : _typeof(color)) === 'object' && typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && - // $FlowIgnoreNextLine not sure why this complains - typeof color.alpha === 'number'; + return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number'; }; var isHsl = function isHsl(color) { - return (typeof color === 'undefined' ? 'undefined' : _typeof(color)) === 'object' && typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && - // $FlowIgnoreNextLine not sure why this complains - typeof color.alpha !== 'number'; + return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined'); }; var isHsla = function isHsla(color) { - return (typeof color === 'undefined' ? 'undefined' : _typeof(color)) === 'object' && typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && - // $FlowIgnoreNextLine not sure why this complains - typeof color.alpha === 'number'; + return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number'; }; +var errMsg = 'Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.'; + /** * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string. * This util is useful in case you only know on runtime which color object is @@ -1806,21 +1807,15 @@ var isHsla = function isHsla(color) { * background: "rgba(179,25,25,0.72)"; * } */ + function toColorString(color) { - if (isRgba(color)) { - // $FlowIgnoreNextLine not sure why this complains - return rgba(color); - } else if (isRgb(color)) { - // $FlowIgnoreNextLine not sure why this complains - return rgb(color); - } else if (isHsla(color)) { - // $FlowIgnoreNextLine not sure why this complains - return hsla(color); - } else if (isHsl(color)) { - // $FlowIgnoreNextLine not sure why this complains - return hsl(color); - } - throw new Error('Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.'); + if ((typeof color === 'undefined' ? 'undefined' : _typeof(color)) !== 'object') throw new Error(errMsg); + if (isRgba(color)) return rgba(color); + if (isRgb(color)) return rgb(color); + if (isHsla(color)) return hsla(color); + if (isHsl(color)) return hsl(color); + + throw new Error(errMsg); } // @@ -1844,6 +1839,7 @@ function curried(f, length, acc) { }; } +// eslint-disable-next-line no-redeclare function curry(f) { // eslint-disable-line no-redeclare return curried(f, f.length, []); @@ -2368,8 +2364,12 @@ var curriedSetSaturation = /*#__PURE__*/curry(setSaturation); // eslint-disable- */ function shade(percentage, color) { - if (typeof percentage !== 'number' || percentage > 1 || percentage < -1) throw new Error('Passed an incorrect argument to shade, please pass a percentage less than or equal to 1 and larger than or equal to -1.'); - if (typeof color !== 'string') throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.'); + if (typeof percentage !== 'number' || percentage > 1 || percentage < -1) { + throw new Error('Passed an incorrect argument to shade, please pass a percentage less than or equal to 1 and larger than or equal to -1.'); + } + if (typeof color !== 'string') { + throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.'); + } return curriedMix(percentage, color, 'rgb(0, 0, 0)'); } @@ -2402,8 +2402,12 @@ var curriedShade = /*#__PURE__*/curry(shade); // eslint-disable-line spaced-comm */ function tint(percentage, color) { - if (typeof percentage !== 'number' || percentage > 1 || percentage < -1) throw new Error('Passed an incorrect argument to tint, please pass a percentage less than or equal to 1 and larger than or equal to -1.'); - if (typeof color !== 'string') throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.'); + if (typeof percentage !== 'number' || percentage > 1 || percentage < -1) { + throw new Error('Passed an incorrect argument to tint, please pass a percentage less than or equal to 1 and larger than or equal to -1.'); + } + if (typeof color !== 'string') { + throw new Error('Passed an incorrect argument to a color function, please pass a string representation of a color.'); + } return curriedMix(percentage, color, 'rgb(255, 255, 255)'); } @@ -2502,7 +2506,7 @@ function animation() { } var code = args.map(function (arg) { if (multiMode && !Array.isArray(arg) || !multiMode && Array.isArray(arg)) { - throw new Error('To pass multiple animations please supply them in arrays, e.g. animation([\'rotate\', \'2s\'], [\'move\', \'1s\'])\nTo pass a single animation please supply them in simple values, e.g. animation(\'rotate\', \'2s\')'); + throw new Error("To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')"); } if (Array.isArray(arg) && arg.length > 8) { throw new Error('The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation'); @@ -2512,7 +2516,7 @@ function animation() { }).join(', '); return { - 'animation': code + animation: code }; } @@ -2575,7 +2579,7 @@ function backgrounds() { } return { - 'background': properties.join(', ') + background: properties.join(', ') }; } @@ -2635,7 +2639,9 @@ function borderColor() { function borderRadius(side, radius) { var uppercaseSide = capitalizeString(side); - if (!radius || typeof radius !== 'string') throw new Error('borderRadius expects a radius value as a string as the second argument.'); + if (!radius || typeof radius !== 'string') { + throw new Error('borderRadius expects a radius value as a string as the second argument.'); + } if (uppercaseSide === 'Top' || uppercaseSide === 'Bottom') { var _ref; @@ -2715,6 +2721,8 @@ function borderWidth() { } // + + function generateSelectors(template, state) { var stateSuffix = state ? ':' + state : ''; return template(stateSuffix); @@ -2729,7 +2737,9 @@ function statefulSelectors(states, template, stateMap) { if (states.length === 0) return generateSelectors(template, null); var selectors = []; for (var i = 0; i < states.length; i += 1) { - if (stateMap && stateMap.indexOf(states[i]) < 0) throw new Error('You passed an unsupported selector state to this method.'); + if (stateMap && stateMap.indexOf(states[i]) < 0) { + throw new Error('You passed an unsupported selector state to this method.'); + } selectors.push(generateSelectors(template, states[i])); } selectors = selectors.join(','); @@ -2743,8 +2753,6 @@ function template(state) { return 'button' + state + ',\n input[type="button"]' + state + ',\n input[type="reset"]' + state + ',\n input[type="submit"]' + state; } -/** */ - /** * Populates selectors that target all buttons. You can pass optional states to append to the selectors. * @example @@ -2944,8 +2952,6 @@ function template$1(state) { return 'input[type="color"]' + state + ',\n input[type="date"]' + state + ',\n input[type="datetime"]' + state + ',\n input[type="datetime-local"]' + state + ',\n input[type="email"]' + state + ',\n input[type="month"]' + state + ',\n input[type="number"]' + state + ',\n input[type="password"]' + state + ',\n input[type="search"]' + state + ',\n input[type="tel"]' + state + ',\n input[type="text"]' + state + ',\n input[type="time"]' + state + ',\n input[type="url"]' + state + ',\n input[type="week"]' + state + ',\n input:not([type])' + state + ',\n textarea' + state; } -/** */ - /** * Populates selectors that target all text inputs. You can pass optional states to append to the selectors. * @example @@ -3021,7 +3027,7 @@ function transitions() { } return { - 'transition': properties.join(', ') + transition: properties.join(', ') }; } diff --git a/docs/docs/index.html b/docs/docs/index.html index 1463d3cd..f0068b91 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -674,16 +674,6 @@

-
  • - ButtonState - - - -
  • - -
  • @@ -715,9 +705,9 @@

  • - InputState + InteractionState @@ -793,6 +783,16 @@

  • + +
  • + ModularScaleRatio + + + +
  • +
    @@ -855,7 +855,7 @@

    - + src/mixins/clearFix.js @@ -865,7 +865,7 @@

    CSS to contain a float (credit to CSSMojo).

    -
    clearFix(parent: string?)
    +
    clearFix(parent: string?): Object
    @@ -894,6 +894,11 @@

    + +
    Returns
    + Object + + @@ -941,7 +946,7 @@

    - + src/mixins/ellipsis.js @@ -951,7 +956,7 @@

    CSS to represent truncated text with an ellipsis.

    -
    ellipsis(width: string?)
    +
    ellipsis(width: string?): Object
    @@ -980,6 +985,11 @@

    + +
    Returns
    + Object + + @@ -1030,7 +1040,7 @@

    - + src/mixins/fontFace.js @@ -1040,7 +1050,7 @@

    CSS for a @font-face declaration.

    -
    fontFace($0: Object)
    +
    fontFace($0: Object): Object
    @@ -1140,6 +1150,11 @@

    + +
    Returns
    + Object + + @@ -1192,7 +1207,7 @@

    - + src/mixins/hiDPI.js @@ -1202,7 +1217,7 @@

    Generates a media query to target HiDPI devices.

    -
    hiDPI(ratio: number?)
    +
    hiDPI(ratio: number?): string
    @@ -1231,6 +1246,11 @@

    + +
    Returns
    + string + + @@ -1284,7 +1304,7 @@

    - + src/mixins/hideText.js @@ -1294,7 +1314,7 @@

    CSS to hide text to show a background image in a SEO-friendly way.

    -
    hideText()
    +
    hideText(): Object
    @@ -1309,6 +1329,11 @@

    + +
    Returns
    + Object + + @@ -1359,7 +1384,7 @@

    - + src/mixins/normalize.js @@ -1369,7 +1394,7 @@

    CSS to normalize abnormalities across browsers (normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css)

    -
    normalize(excludeOpinionated: boolean)
    +
    normalize(excludeOpinionated: boolean): Object
    @@ -1397,6 +1422,11 @@

    + +
    Returns
    + Object + + @@ -1442,7 +1472,7 @@

    - + src/mixins/placeholder.js @@ -1452,7 +1482,7 @@

    CSS to style the selection psuedo-element.

    -
    placeholder(styles: Object, parent: string?)
    +
    placeholder(styles: Object, parent: string?): Object
    @@ -1489,6 +1519,11 @@

    + +
    Returns
    + Object + + @@ -1545,7 +1580,7 @@

    - + src/mixins/radialGradient.js @@ -1685,7 +1720,7 @@

    - + src/mixins/retinaImage.js @@ -1697,7 +1732,7 @@

    a _2x.png filename suffix by default.

    -
    retinaImage(filename: string, backgroundSize: string, extension: string?, retinaFilename: string, retinaSuffix: string?)
    +
    retinaImage(filename: string, backgroundSize: string, extension: string?, retinaFilename: string, retinaSuffix: string?): Object
    @@ -1759,6 +1794,11 @@

    + +
    Returns
    + Object + + @@ -1810,7 +1850,7 @@

    - + src/mixins/selection.js @@ -1820,7 +1860,7 @@

    CSS to style the selection psuedo-element.

    -
    selection(styles: Object, parent: string?)
    +
    selection(styles: Object, parent: string?): Object
    @@ -1857,6 +1897,11 @@

    + +
    Returns
    + Object + + @@ -1909,7 +1954,7 @@

    - + src/mixins/timingFunctions.js @@ -1919,7 +1964,7 @@

    String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).

    -
    timingFunctions(timingFunction: TimingFunction)
    +
    timingFunctions(timingFunction: TimingFunction): string
    @@ -1947,6 +1992,11 @@

    + +
    Returns
    + string + + @@ -1992,7 +2042,7 @@

    - + src/mixins/triangle.js @@ -2130,7 +2180,7 @@

    - + src/mixins/wordWrap.js @@ -2140,7 +2190,7 @@

    Provides an easy way to change the wordWrap property.

    -
    wordWrap(wrap: string?)
    +
    wordWrap(wrap: string?): Object
    @@ -2169,6 +2219,11 @@

    + +
    Returns
    + Object + + @@ -2178,20 +2233,20 @@

    // Styles as object usage
     const styles = {
    -  ...wordWrap('break-all')
    +  ...wordWrap('break-word')
     }
     
     // styled-components usage
    -const div = styled.div`
    -  ${wordWrap('break-all')}
    -`
    +const div = styled.div`
    +  ${wordWrap('break-word')}
    +`
     
     // CSS as JS Output
     
     const styles = {
    -  overflowWrap: 'break-all',
    -  wordWrap: 'break-all',
    -  wordBreak: 'break-all',
    +  overflowWrap: 'break-word',
    +  wordWrap: 'break-word',
    +  wordBreak: 'break-all',
     }
    @@ -2228,7 +2283,7 @@

    - + src/color/adjustHue.js @@ -2328,7 +2383,7 @@

    - + src/color/complement.js @@ -2418,7 +2473,7 @@

    - + src/color/darken.js @@ -2517,7 +2572,7 @@

    - + src/color/desaturate.js @@ -2617,7 +2672,7 @@

    - + src/color/grayscale.js @@ -2707,7 +2762,7 @@

    - + src/color/hsl.js @@ -2814,7 +2869,7 @@

    - + src/color/hsla.js @@ -2932,7 +2987,7 @@

    - + src/color/invert.js @@ -3023,7 +3078,7 @@

    - + src/color/lighten.js @@ -3122,7 +3177,7 @@

    - + src/color/mix.js @@ -3237,7 +3292,7 @@

    - + src/color/opacify.js @@ -3247,7 +3302,7 @@

    Increases the opacity of a color. Its range for the amount is between 0 to 1.

    -
    opacify(amount: number, color: string)
    +
    opacify(amount: number, color: string): string
    @@ -3283,6 +3338,11 @@

    + +
    Returns
    + string + + @@ -3334,7 +3394,7 @@

    - + src/color/parseToHsl.js @@ -3413,7 +3473,7 @@

    - + src/color/parseToRgb.js @@ -3492,7 +3552,7 @@

    - + src/color/readableColor.js @@ -3587,7 +3647,7 @@

    - + src/color/rgb.js @@ -3694,7 +3754,7 @@

    - + src/color/rgba.js @@ -3819,7 +3879,7 @@

    - + src/color/saturate.js @@ -3920,7 +3980,7 @@

    - + src/color/setHue.js @@ -4019,7 +4079,7 @@

    - + src/color/setLightness.js @@ -4118,7 +4178,7 @@

    - + src/color/setSaturation.js @@ -4217,7 +4277,7 @@

    - + src/color/shade.js @@ -4229,7 +4289,7 @@

    doesn't produce hue shifts.

    -
    shade(percentage: number, color: string)
    +
    shade(percentage: number, color: string): string
    @@ -4265,6 +4325,11 @@

    + +
    Returns
    + string + + @@ -4310,7 +4375,7 @@

    - + src/color/tint.js @@ -4322,7 +4387,7 @@

    doesn't produce hue shifts.

    -
    tint(percentage: number, color: string)
    +
    tint(percentage: number, color: string): string
    @@ -4358,6 +4423,11 @@

    + +
    Returns
    + string + + @@ -4403,7 +4473,7 @@

    - + src/color/transparentize.js @@ -4413,7 +4483,7 @@

    Decreases the opacity of a color. Its range for the amount is between 0 to 1.

    -
    transparentize(amount: number, color: string)
    +
    transparentize(amount: number, color: string): string
    @@ -4449,6 +4519,11 @@

    + +
    Returns
    + string + + @@ -4512,7 +4587,7 @@

    - + src/shorthands/animation.js @@ -4523,7 +4598,7 @@

    or a single animation spread over the arguments.

    - + @@ -4551,6 +4626,11 @@

    + +
    Returns
    + Object + + @@ -4613,7 +4693,7 @@

    - + src/shorthands/backgroundImages.js @@ -4623,7 +4703,7 @@

    Shorthand that accepts any number of backgroundImage values as parameters for creating a single background statement.

    -
    backgroundImages(properties: ...Array<string>)
    +
    backgroundImages(properties: ...Array<string>): Object
    @@ -4651,6 +4731,11 @@

    + +
    Returns
    + Object + + @@ -4696,7 +4781,7 @@

    - + src/shorthands/backgrounds.js @@ -4706,7 +4791,7 @@

    Shorthand that accepts any number of background values as parameters for creating a single background statement.

    -
    backgrounds(properties: ...Array<string>)
    +
    backgrounds(properties: ...Array<string>): Object
    @@ -4734,6 +4819,11 @@

    + +
    Returns
    + Object + + @@ -4779,7 +4869,7 @@

    - + src/shorthands/borderColor.js @@ -4789,7 +4879,7 @@

    Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.

    -
    borderColor(values: ...Array<string?>)
    +
    borderColor(values: ...Array<string?>): Object
    @@ -4817,6 +4907,11 @@

    + +
    Returns
    + Object + + @@ -4865,7 +4960,7 @@

    - + src/shorthands/borderRadius.js @@ -4875,7 +4970,7 @@

    Shorthand that accepts a value for side and a value for radius and applies the radius value to both corners of the side.

    -
    borderRadius(side: string, radius: string)
    +
    borderRadius(side: string, radius: string): Object
    @@ -4911,6 +5006,11 @@

    + +
    Returns
    + Object + + @@ -4957,7 +5057,7 @@

    - + src/shorthands/borderStyle.js @@ -4967,7 +5067,7 @@

    Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.

    -
    borderStyle(values: ...Array<string?>)
    +
    borderStyle(values: ...Array<string?>): Object
    @@ -4995,6 +5095,11 @@

    + +
    Returns
    + Object + + @@ -5043,7 +5148,7 @@

    - + src/shorthands/borderWidth.js @@ -5053,7 +5158,7 @@

    Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.

    -
    borderWidth(values: ...Array<string?>)
    +
    borderWidth(values: ...Array<string?>): Object
    @@ -5081,6 +5186,11 @@

    + +
    Returns
    + Object + + @@ -5129,7 +5239,7 @@

    - + src/shorthands/buttons.js @@ -5139,7 +5249,7 @@

    Populates selectors that target all buttons. You can pass optional states to append to the selectors.

    -
    buttons(states: ...Array<ButtonState>)
    +
    buttons(states: ...Array<InteractionState>): string
    @@ -5155,7 +5265,7 @@

    - states (...Array<ButtonState>) + states (...Array<InteractionState>)
    @@ -5167,6 +5277,11 @@

    + +
    Returns
    + string + + @@ -5219,7 +5334,7 @@

    - + src/shorthands/margin.js @@ -5229,7 +5344,7 @@

    Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.

    -
    margin(values: ...Array<string?>)
    +
    margin(values: ...Array<string?>): Object
    @@ -5257,6 +5372,11 @@

    + +
    Returns
    + Object + + @@ -5305,7 +5425,7 @@

    - + src/shorthands/padding.js @@ -5315,7 +5435,7 @@

    Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.

    -
    padding(values: ...Array<string?>)
    +
    padding(values: ...Array<string?>): Object
    @@ -5343,6 +5463,11 @@

    + +
    Returns
    + Object + + @@ -5391,7 +5516,7 @@

    - + src/shorthands/position.js @@ -5401,7 +5526,7 @@

    Shorthand accepts up to five values, including null to skip a value, and maps them to their respective directions. The first value can optionally be a position keyword.

    -
    position(positionKeyword: (string | null), values: ...Array<string?>)
    +
    position(positionKeyword: (string | null), values: ...Array<string?>): Object
    @@ -5437,6 +5562,11 @@

    + +
    Returns
    + Object + + @@ -5505,7 +5635,7 @@

    - + src/shorthands/size.js @@ -5515,7 +5645,7 @@

    Shorthand to set the height and width properties in a single statement.

    -
    size(height: string, width: string?)
    +
    size(height: string, width: string?): Object
    @@ -5552,6 +5682,11 @@

    + +
    Returns
    + Object + + @@ -5598,7 +5733,7 @@

    - + src/shorthands/textInputs.js @@ -5608,7 +5743,7 @@

    Populates selectors that target all text inputs. You can pass optional states to append to the selectors.

    -
    textInputs(states: ...Array<InputState>)
    +
    textInputs(states: ...Array<InteractionState>): string
    @@ -5624,7 +5759,7 @@

    - states (...Array<InputState>) + states (...Array<InteractionState>)
    @@ -5636,6 +5771,11 @@

    + +
    Returns
    + string + + @@ -5700,7 +5840,7 @@

    - + src/shorthands/transitions.js @@ -5710,7 +5850,7 @@

    Shorthand that accepts any number of transition values as parameters for creating a single transition statement.

    -
    transitions(properties: ...Array<string>)
    +
    transitions(properties: ...Array<string>): Object
    @@ -5738,6 +5878,11 @@

    + +
    Returns
    + Object + + @@ -5795,7 +5940,7 @@

    - + src/helpers/directionalProperty.js @@ -5805,7 +5950,7 @@

    A helper that enables shorthand for direction based properties. It accepts a property (hyphenated or camelCased) and up to four values that map to top, right, bottom, and left, respectively. You can optionally pass an empty string to get only the directional values as properties. You can also optionally pass a null argument for a directional value to ignore it.

    -
    directionalProperty(property: string, values: ...Array<string?>)
    +
    directionalProperty(property: string, values: ...Array<string?>): Object
    @@ -5841,6 +5986,11 @@

    + +
    Returns
    + Object + + @@ -5889,7 +6039,7 @@

    - + src/helpers/em.js @@ -5982,7 +6132,7 @@

    - + src/helpers/modularScale.js @@ -5992,7 +6142,7 @@

    Establish consistent measurements and spacial relationships throughout your projects by incrementing up or down a defined scale. We provide a list of commonly used scales as pre-defined variables, see below.

    -
    modularScale(steps: number, base: (number | string)?, ratio: Ratio?)
    +
    modularScale(steps: number, base: (number | string)?, ratio: Ratio?): string
    @@ -6038,6 +6188,11 @@

    + +
    Returns
    + string + + @@ -6085,7 +6240,7 @@

    - + src/helpers/rem.js @@ -6178,7 +6333,7 @@

    - + src/helpers/stripUnit.js @@ -6278,7 +6433,7 @@

    - + src/shorthands/animation.js @@ -6313,60 +6468,6 @@

    - - - - - - - - - -
    - - -
    - -

    - ButtonState -

    - - - - src/shorthands/buttons.js - - -
    - - - - -
    ButtonState
    - -

    - Type: - (any | null | "active" | "focus" | "hover") -

    - - - - - - - - - - - - - - - - - - - - @@ -6386,7 +6487,7 @@

    - + src/mixins/fontFace.js @@ -6499,7 +6600,7 @@

    - + src/types/color.js @@ -6576,7 +6677,7 @@

    - + src/types/color.js @@ -6654,13 +6755,13 @@

    @@ -6668,7 +6769,7 @@

    -
    InputState
    +
    InteractionState

    Type: @@ -6713,7 +6814,7 @@

    - + src/mixins/triangle.js @@ -6767,7 +6868,7 @@

    - + src/mixins/radialGradient.js @@ -6856,7 +6957,7 @@

    - + src/helpers/modularScale.js @@ -6910,7 +7011,7 @@

    - + src/types/color.js @@ -6993,7 +7094,7 @@

    - + src/types/color.js @@ -7070,7 +7171,7 @@

    - + src/mixins/timingFunctions.js @@ -7124,7 +7225,7 @@

    - + src/color/toColorString.js @@ -7136,7 +7237,7 @@

    used. Otherwise we recommend to rely on rgb, rgba, hsl or hsla.

    -
    toColorString(color: (RgbColor | RgbaColor | HslColor | HslaColor)): string
    +
    toColorString(color: Object): string
    @@ -7152,7 +7253,7 @@

    - color ((RgbColor | RgbaColor | HslColor | HslaColor)) + color (Object)
    @@ -7203,6 +7304,60 @@

    + + + + +

    + + + + +
    + + +
    + +

    + ModularScaleRatio +

    + + + + src/types/modularScaleRatio.js + + +
    + + + + +
    ModularScaleRatio
    + +

    + Type: + (number | "minorSecond" | "majorSecond" | "minorThird" | "majorThird" | "perfectFourth" | "augFourth" | "perfectFifth" | "minorSixth" | "goldenSection" | "majorSixth" | "minorSeventh" | "majorSeventh" | "octave" | "majorTenth" | "majorEleventh" | "majorTwelfth" | "doubleOctave") +

    + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json index 1836472e..87d70ec6 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "precommit": "lint-staged --verbose", "postcommit": "validate-commit-msg", "lint": "eslint src", - "flow": "flow check", + "flow": "flow check && flow-coverage-report -i 'src/**/!(*.test).js'", "docs": "pushstate-server docs", "prepublish": "npm run build" }, @@ -78,8 +78,9 @@ "eslint": "^3.9.1", "eslint-config-airbnb-base": "^10.0.1", "eslint-plugin-import": "^2.2.0", - "flow-bin": "^0.36.0", + "flow-bin": "^0.53.1", "flow-copy-source": "^1.1.0", + "flow-coverage-report": "^0.3.0", "github-slugger": "^1.1.1", "highlight.js": "^9.9.0", "husky": "^0.14.3", @@ -112,6 +113,5 @@ "jest": { "coverageDirectory": "./coverage/", "collectCoverage": true - }, - "dependencies": {} + } } diff --git a/src/color/mix.js b/src/color/mix.js index 38f1dd61..aca91e7a 100644 --- a/src/color/mix.js +++ b/src/color/mix.js @@ -35,7 +35,7 @@ import curry from '../internalHelpers/_curry' * background: "rgba(63, 0, 191, 0.75)"; * } */ -function mix(weight: number = 0.5, color: string, otherColor: string): string { +function mix(weight?: number = 0.5, color: string, otherColor: string): string { const parsedColor1 = parseToRgb(color) const color1 = { ...parsedColor1, diff --git a/src/color/opacify.js b/src/color/opacify.js index 42efe6c8..aef4f620 100644 --- a/src/color/opacify.js +++ b/src/color/opacify.js @@ -31,7 +31,7 @@ import curry from '../internalHelpers/_curry' * background: "rgba(255,0,0,0.7)"; * } */ -function opacify(amount: number, color: string) { +function opacify(amount: number, color: string): string { const parsedColor = parseToRgb(color) const alpha: number = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1 diff --git a/src/color/parseToRgb.js b/src/color/parseToRgb.js index c91591b5..dabde965 100644 --- a/src/color/parseToRgb.js +++ b/src/color/parseToRgb.js @@ -1,5 +1,4 @@ // @flow - import hslToRgb from '../internalHelpers/_hslToRgb' import nameToHex from '../internalHelpers/_nameToHex' import type { RgbColor, RgbaColor } from '../types/color' diff --git a/src/color/shade.js b/src/color/shade.js index 18091dd5..cb054ef8 100644 --- a/src/color/shade.js +++ b/src/color/shade.js @@ -26,7 +26,7 @@ import curry from '../internalHelpers/_curry' * } */ -function shade(percentage: number, color: string) { +function shade(percentage: number, color: string): string { if (typeof percentage !== 'number' || percentage > 1 || percentage < -1) { throw new Error( 'Passed an incorrect argument to shade, please pass a percentage less than or equal to 1 and larger than or equal to -1.', diff --git a/src/color/test/toColorString.test.js b/src/color/test/toColorString.test.js index 94058213..f946ef79 100644 --- a/src/color/test/toColorString.test.js +++ b/src/color/test/toColorString.test.js @@ -49,7 +49,6 @@ describe('toColorString', () => { }) it('should throw an error if anything else than a RgbColor, RgbaColor, HslColor or HslaColor is provided', () => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains expect(() => toColorString({ red: 255, green: 1, hue: 240 })).toThrow( 'Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.', ) diff --git a/src/color/tint.js b/src/color/tint.js index 23c4a159..2ba97638 100644 --- a/src/color/tint.js +++ b/src/color/tint.js @@ -26,7 +26,7 @@ import curry from '../internalHelpers/_curry' * } */ -function tint(percentage: number, color: string) { +function tint(percentage: number, color: string): string { if (typeof percentage !== 'number' || percentage > 1 || percentage < -1) { throw new Error( 'Passed an incorrect argument to tint, please pass a percentage less than or equal to 1 and larger than or equal to -1.', diff --git a/src/color/toColorString.js b/src/color/toColorString.js index 3da2b5c9..c6874e66 100644 --- a/src/color/toColorString.js +++ b/src/color/toColorString.js @@ -1,43 +1,36 @@ // @flow - import rgb from './rgb' import rgba from './rgba' import hsl from './hsl' import hsla from './hsla' -import type { RgbColor, RgbaColor, HslColor, HslaColor } from '../types/color' -const isRgb = (color): boolean => - typeof color === 'object' && +const isRgb = (color: Object): boolean => typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && - // $FlowIgnoreNextLine not sure why this complains - typeof color.alpha !== 'number' + (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined') -const isRgba = (color): boolean => - typeof color === 'object' && +const isRgba = (color: Object): boolean => typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && - // $FlowIgnoreNextLine not sure why this complains typeof color.alpha === 'number' -const isHsl = (color): boolean => - typeof color === 'object' && +const isHsl = (color: Object): boolean => typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && - // $FlowIgnoreNextLine not sure why this complains - typeof color.alpha !== 'number' + (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined') -const isHsla = (color): boolean => - typeof color === 'object' && +const isHsla = (color: Object): boolean => typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && - // $FlowIgnoreNextLine not sure why this complains typeof color.alpha === 'number' +const errMsg = + 'Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.' + /** * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string. * This util is useful in case you only know on runtime which color object is @@ -68,25 +61,15 @@ const isHsla = (color): boolean => * background: "rgba(179,25,25,0.72)"; * } */ -function toColorString( - color: RgbColor | RgbaColor | HslColor | HslaColor, -): string { - if (isRgba(color)) { - // $FlowIgnoreNextLine not sure why this complains - return rgba(color) - } else if (isRgb(color)) { - // $FlowIgnoreNextLine not sure why this complains - return rgb(color) - } else if (isHsla(color)) { - // $FlowIgnoreNextLine not sure why this complains - return hsla(color) - } else if (isHsl(color)) { - // $FlowIgnoreNextLine not sure why this complains - return hsl(color) - } - throw new Error( - 'Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.', - ) + +function toColorString(color: Object): string { + if (typeof color !== 'object') throw new Error(errMsg) + if (isRgba(color)) return rgba(color) + if (isRgb(color)) return rgb(color) + if (isHsla(color)) return hsla(color) + if (isHsl(color)) return hsl(color) + + throw new Error(errMsg) } export default toColorString diff --git a/src/color/transparentize.js b/src/color/transparentize.js index 40e68547..6b7468c7 100644 --- a/src/color/transparentize.js +++ b/src/color/transparentize.js @@ -31,7 +31,7 @@ import curry from '../internalHelpers/_curry' * background: "rgba(255,0,0,0.3)"; * } */ -function transparentize(amount: number, color: string) { +function transparentize(amount: number, color: string): string { const parsedColor = parseToRgb(color) const alpha: number = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1 diff --git a/src/helpers/directionalProperty.js b/src/helpers/directionalProperty.js index 62ca9191..549a008d 100644 --- a/src/helpers/directionalProperty.js +++ b/src/helpers/directionalProperty.js @@ -47,9 +47,11 @@ function generateStyles(property: string, valuesWithDefaults: Array) { * } */ -function directionalProperty(property: string, ...values: Array) { +function directionalProperty( + property: string, + ...values: Array +): Object { // prettier-ignore - // $FlowIgnoreNextLine doesn't understand destructuring with chained defaults. const [firstValue, secondValue = firstValue, thirdValue = firstValue, fourthValue = secondValue] = values const valuesWithDefaults = [firstValue, secondValue, thirdValue, fourthValue] return generateStyles(property, valuesWithDefaults) diff --git a/src/helpers/em.js b/src/helpers/em.js index df469ecc..2f89abbf 100644 --- a/src/helpers/em.js +++ b/src/helpers/em.js @@ -1,5 +1,4 @@ // @flow - import pixelsto from '../internalHelpers/_pxto' /** diff --git a/src/helpers/modularScale.js b/src/helpers/modularScale.js index f51f8f97..73e14814 100644 --- a/src/helpers/modularScale.js +++ b/src/helpers/modularScale.js @@ -68,7 +68,7 @@ function modularScale( steps: number, base?: number | string = '1em', ratio?: Ratio = 'perfectFourth', -) { +): string { if (typeof steps !== 'number') { throw new Error( 'Please provide a number of steps to the modularScale helper.', diff --git a/src/helpers/test/modularScale.test.js b/src/helpers/test/modularScale.test.js index 0dc4331f..05b8498c 100644 --- a/src/helpers/test/modularScale.test.js +++ b/src/helpers/test/modularScale.test.js @@ -3,7 +3,7 @@ import modularScale, { ratioNames } from '../modularScale' describe('modularScale', () => { it('should throw an error if no steps are provided', () => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe expect(() => ({ 'font-size': modularScale() })).toThrow() }) @@ -37,7 +37,7 @@ describe('modularScale', () => { it('should throw an error if an invalid ratio is provided', () => { expect(() => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe modularScale(2, '1em', 'invalid') }).toThrow() }) diff --git a/src/internalHelpers/_capitalizeString.js b/src/internalHelpers/_capitalizeString.js index a39da0b5..7c3760dc 100644 --- a/src/internalHelpers/_capitalizeString.js +++ b/src/internalHelpers/_capitalizeString.js @@ -1,7 +1,7 @@ // @flow // @private -function capitalizeString(string: string) { +function capitalizeString(string: string): string { return string.charAt(0).toUpperCase() + string.slice(1) } diff --git a/src/internalHelpers/_curry.js b/src/internalHelpers/_curry.js index a8673ae4..bf13731e 100644 --- a/src/internalHelpers/_curry.js +++ b/src/internalHelpers/_curry.js @@ -16,7 +16,7 @@ declare function curry(f: Fn2): CurriedFn2 // eslint-disable-next-line no-redeclare declare function curry(f: Fn3): CurriedFn3 -function curried(f, length, acc) { +function curried(f: Function, length: number, acc: Array): Function { return function fn() { // eslint-disable-next-line prefer-rest-params const combined = acc.concat(Array.prototype.slice.call(arguments)) @@ -27,7 +27,7 @@ function curried(f, length, acc) { } // eslint-disable-next-line no-redeclare -export default function curry(f: Function) { +export default function curry(f: Function): Function { // eslint-disable-line no-redeclare return curried(f, f.length, []) } diff --git a/src/internalHelpers/_hslToHex.js b/src/internalHelpers/_hslToHex.js index 5e8efbcc..1e882e67 100644 --- a/src/internalHelpers/_hslToHex.js +++ b/src/internalHelpers/_hslToHex.js @@ -1,5 +1,4 @@ // @flow - import hslToRgb from './_hslToRgb' import reduceHexValue from './_reduceHexValue' import toHex from './_numberToHex' @@ -8,7 +7,7 @@ function colorToHex(color: number): string { return toHex(Math.round(color * 255)) } -function convertToHex(red, green, blue) { +function convertToHex(red: number, green: number, blue: number): string { return reduceHexValue( `#${colorToHex(red)}${colorToHex(green)}${colorToHex(blue)}`, ) diff --git a/src/internalHelpers/_hslToRgb.js b/src/internalHelpers/_hslToRgb.js index 9d806735..0a07ffa5 100644 --- a/src/internalHelpers/_hslToRgb.js +++ b/src/internalHelpers/_hslToRgb.js @@ -6,7 +6,7 @@ function colorToInt(color: number): number { return Math.round(color * 255) } -function convertToInt(red, green, blue) { +function convertToInt(red: number, green: number, blue: number): string { return `${colorToInt(red)},${colorToInt(green)},${colorToInt(blue)}` } diff --git a/src/internalHelpers/_isValidDimensionValue.js b/src/internalHelpers/_isValidDimensionValue.js deleted file mode 100644 index 4e56131c..00000000 --- a/src/internalHelpers/_isValidDimensionValue.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function() { - return true -} diff --git a/src/internalHelpers/_nameToHex.js b/src/internalHelpers/_nameToHex.js index 611cecc4..854b6f27 100644 --- a/src/internalHelpers/_nameToHex.js +++ b/src/internalHelpers/_nameToHex.js @@ -154,7 +154,7 @@ const namedColorMap = { * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color. * @private */ -function nameToHex(color: string) { +function nameToHex(color: string): string { if (typeof color !== 'string') return color const normalizedColorName = color.toLowerCase() return namedColorMap[normalizedColorName] diff --git a/src/internalHelpers/_numberToHex.js b/src/internalHelpers/_numberToHex.js index db1e0abb..4d8ee827 100644 --- a/src/internalHelpers/_numberToHex.js +++ b/src/internalHelpers/_numberToHex.js @@ -1,5 +1,4 @@ // @flow - function numberToHex(value: number): string { const hex = value.toString(16) return hex.length === 1 ? `0${hex}` : hex diff --git a/src/internalHelpers/_polishedLogs.js b/src/internalHelpers/_polishedLogs.js deleted file mode 100644 index 047d85b3..00000000 --- a/src/internalHelpers/_polishedLogs.js +++ /dev/null @@ -1,22 +0,0 @@ -function logError(message) { - // eslint-disable-next-line no-console - console.error(message) -} - -function logInfo(message) { - // eslint-disable-next-line no-console - console.info(message) -} - -function logWarning(message) { - // eslint-disable-next-line no-console - console.warning(message) -} - -function determineLogType(type, message) { - if (type === 'error') logError(message) - if (type === 'info') logInfo(message) - if (type === 'warning') logWarning(message) -} - -export default determineLogType diff --git a/src/internalHelpers/_pxto.js b/src/internalHelpers/_pxto.js index 775b6710..7948dbca 100644 --- a/src/internalHelpers/_pxto.js +++ b/src/internalHelpers/_pxto.js @@ -10,7 +10,7 @@ import stripUnit from '../helpers/stripUnit' const pxtoFactory = (to: string) => ( pxval: string | number, base?: string | number = '16px', -) => { +): string => { let newPxval = pxval let newBase = base if (typeof pxval === 'string') { diff --git a/src/internalHelpers/_statefulSelectors.js b/src/internalHelpers/_statefulSelectors.js index 9f05440e..5c5361f8 100644 --- a/src/internalHelpers/_statefulSelectors.js +++ b/src/internalHelpers/_statefulSelectors.js @@ -1,20 +1,23 @@ // @flow -function generateSelectors(template: Function, state: string | null) { +import type { InteractionState } from '../types/interactionState' + +function generateSelectors( + template: Function, + state: InteractionState, +): string { const stateSuffix = state ? `:${state}` : '' return template(stateSuffix) } -type State = typeof undefined | null | string - /** * Function helper that adds an array of states to a template of selectors. Used in textInputs and buttons. * @private */ function statefulSelectors( - states: Array, + states: Array, template: Function, - stateMap: ?Array, -) { + stateMap?: Array, +): string { if (!template) throw new Error('You must provide a template to this method.') if (states.length === 0) return generateSelectors(template, null) let selectors = [] diff --git a/src/internalHelpers/test/_nameToHex.test.js b/src/internalHelpers/test/_nameToHex.test.js index 510d0222..8045543a 100644 --- a/src/internalHelpers/test/_nameToHex.test.js +++ b/src/internalHelpers/test/_nameToHex.test.js @@ -19,7 +19,7 @@ describe('nameToHex', () => { expect({ background: nameToHex('hsl(180, 50%, 50%)') }).toMatchSnapshot() }) it('should return a non-string value without mutation', () => { - // $FlowIgnoreNextLine since this is invalid code, flow complains + // $FlowFixMe expect({ background: nameToHex(2) }).toMatchSnapshot() }) }) diff --git a/src/mixins/clearFix.js b/src/mixins/clearFix.js index a7e5f224..5bfc8ade 100644 --- a/src/mixins/clearFix.js +++ b/src/mixins/clearFix.js @@ -23,7 +23,7 @@ * } */ -function clearFix(parent: string = '&') { +function clearFix(parent?: string = '&'): Object { const pseudoSelector = `${parent}::after` return { [pseudoSelector]: { diff --git a/src/mixins/ellipsis.js b/src/mixins/ellipsis.js index 2d4dcd2f..53a66dc3 100644 --- a/src/mixins/ellipsis.js +++ b/src/mixins/ellipsis.js @@ -26,7 +26,7 @@ * } */ -function ellipsis(width: string = '100%') { +function ellipsis(width?: string = '100%'): Object { return { display: 'inline-block', maxWidth: width, diff --git a/src/mixins/fontFace.js b/src/mixins/fontFace.js index 32270de2..9d0bcf54 100644 --- a/src/mixins/fontFace.js +++ b/src/mixins/fontFace.js @@ -16,14 +16,14 @@ type FontFaceConfiguration = { function generateFileReferences( fontFilePath: string, fileFormats: Array, -) { +): string { const fileFontReferences = fileFormats.map( format => `url("${fontFilePath}.${format}")`, ) return fileFontReferences.join(', ') } -function generateLocalReferences(localFonts: Array) { +function generateLocalReferences(localFonts: Array): string { const localFontReferences = localFonts.map(font => `local("${font}")`) return localFontReferences.join(', ') } @@ -32,7 +32,7 @@ function generateSources( fontFilePath?: string, localFonts?: Array, fileFormats: Array, -) { +): string { const fontReferences = [] if (localFonts) fontReferences.push(generateLocalReferences(localFonts)) if (fontFilePath) { @@ -79,7 +79,7 @@ function fontFace({ fileFormats = ['eot', 'woff2', 'woff', 'ttf', 'svg'], localFonts, unicodeRange, -}: FontFaceConfiguration) { +}: FontFaceConfiguration): Object { // Error Handling if (!fontFamily) throw new Error('fontFace expects a name of a font-family.') if (!fontFilePath && !localFonts) { diff --git a/src/mixins/hiDPI.js b/src/mixins/hiDPI.js index 6fd06364..18ecc9f2 100644 --- a/src/mixins/hiDPI.js +++ b/src/mixins/hiDPI.js @@ -29,7 +29,7 @@ * } */ -function hiDPI(ratio: number = 1.3) { +function hiDPI(ratio?: number = 1.3): string { return ` @media only screen and (-webkit-min-device-pixel-ratio: ${ratio}), only screen and (min--moz-device-pixel-ratio: ${ratio}), diff --git a/src/mixins/hideText.js b/src/mixins/hideText.js index 30e0c0ac..5ed8a690 100644 --- a/src/mixins/hideText.js +++ b/src/mixins/hideText.js @@ -26,7 +26,7 @@ * } */ -function hideText() { +function hideText(): Object { return { textIndent: '101%', overflow: 'hidden', diff --git a/src/mixins/normalize.js b/src/mixins/normalize.js index 376b8da9..ee9b98af 100644 --- a/src/mixins/normalize.js +++ b/src/mixins/normalize.js @@ -248,7 +248,7 @@ const unopinionatedRules = { }, } -function mergeRules(baseRules: Object, additionalRules: Object) { +function mergeRules(baseRules: Object, additionalRules: Object): Object { const mergedRules = { ...baseRules } Object.keys(additionalRules).forEach(key => { if (mergedRules[key]) { @@ -285,7 +285,7 @@ function mergeRules(baseRules: Object, additionalRules: Object) { * textSizeAdjust: 100%, * } ... */ -function normalize(excludeOpinionated?: boolean) { +function normalize(excludeOpinionated?: boolean): Object { if (excludeOpinionated) return unopinionatedRules return mergeRules(unopinionatedRules, opinionatedRules) } diff --git a/src/mixins/placeholder.js b/src/mixins/placeholder.js index b9723407..ad734e4b 100644 --- a/src/mixins/placeholder.js +++ b/src/mixins/placeholder.js @@ -32,7 +32,7 @@ * }, */ -function placeholder(styles: Object, parent: string = '&') { +function placeholder(styles: Object, parent?: string = '&'): Object { return { [`${parent}::-webkit-input-placeholder`]: { ...styles, diff --git a/src/mixins/radialGradient.js b/src/mixins/radialGradient.js index b2aa7c17..eaae8384 100644 --- a/src/mixins/radialGradient.js +++ b/src/mixins/radialGradient.js @@ -9,14 +9,14 @@ type RadialGradientConfiguration = { shape?: string, } -function parseFallback(colorStops: Array) { +function parseFallback(colorStops: Array): string { return colorStops[0].split(' ')[0] } function constructGradientValue( literals: Array, ...substitutions: Array -) { +): string { let template = '' for (let i = 0; i < literals.length; i += 1) { template += literals[i] diff --git a/src/mixins/retinaImage.js b/src/mixins/retinaImage.js index 6948a671..18dddc4a 100644 --- a/src/mixins/retinaImage.js +++ b/src/mixins/retinaImage.js @@ -36,7 +36,7 @@ function retinaImage( extension?: string = 'png', retinaFilename?: string, retinaSuffix?: string = '_2x', -) { +): Object { if (!filename) { throw new Error( 'Please supply a filename to retinaImage() as the first argument.', diff --git a/src/mixins/selection.js b/src/mixins/selection.js index f6cd4186..c4fc8c00 100644 --- a/src/mixins/selection.js +++ b/src/mixins/selection.js @@ -28,7 +28,7 @@ * } */ -function selection(styles: Object, parent: string = '') { +function selection(styles: Object, parent?: string = ''): Object { return { [`${parent}::-moz-selection`]: { ...styles, diff --git a/src/mixins/test/fontFace.test.js b/src/mixins/test/fontFace.test.js index a80d4ae4..2941102b 100644 --- a/src/mixins/test/fontFace.test.js +++ b/src/mixins/test/fontFace.test.js @@ -66,7 +66,7 @@ describe('fontFace', () => { it('should throw an error when not passed a fontfamily', () => { expect(() => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe fontFace({ fontFilePath: 'path/to/file', }) @@ -88,7 +88,7 @@ describe('fontFace', () => { fontFace({ fontFamily: 'Sans Pro', fontFilePath: 'path/to/file', - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe localFonts: 'Helvetica', }) }).toThrow('fontFace expects localFonts to be an array.') @@ -99,7 +99,7 @@ describe('fontFace', () => { fontFace({ fontFamily: 'Sans Pro', fontFilePath: 'path/to/file', - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe fileFormats: 'svg', }) }).toThrow('fontFace expects fileFormats to be an array.') diff --git a/src/mixins/test/retinaImage.test.js b/src/mixins/test/retinaImage.test.js index 1b244743..f992d583 100644 --- a/src/mixins/test/retinaImage.test.js +++ b/src/mixins/test/retinaImage.test.js @@ -3,7 +3,7 @@ import retinaImage from '../retinaImage' describe('retinaImage', () => { it('should throw an error if no filename is passed', () => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe expect(() => ({ ...retinaImage() })).toThrow() }) diff --git a/src/mixins/test/triangle.test.js b/src/mixins/test/triangle.test.js index 800c69c9..08fe3fbc 100644 --- a/src/mixins/test/triangle.test.js +++ b/src/mixins/test/triangle.test.js @@ -95,7 +95,7 @@ describe('triangle', () => { it('should throw an error when pointingDirection is not provided or does not match corresponding options', () => { expect(() => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe triangle({ foregroundColor: 'blue', height: 20, @@ -109,7 +109,7 @@ describe('triangle', () => { it('should throw an error when height or width is not a unit based value.', () => { expect(() => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe triangle({ foregroundColor: 'blue', height: 'inherit', diff --git a/src/mixins/timingFunctions.js b/src/mixins/timingFunctions.js index 6136ac91..8fb3b20b 100644 --- a/src/mixins/timingFunctions.js +++ b/src/mixins/timingFunctions.js @@ -79,7 +79,7 @@ type TimingFunction = * } */ -function timingFunctions(timingFunction: TimingFunction) { +function timingFunctions(timingFunction: TimingFunction): string { return functionsMap[timingFunction] } diff --git a/src/mixins/triangle.js b/src/mixins/triangle.js index 4bcb0e8c..e109e08d 100644 --- a/src/mixins/triangle.js +++ b/src/mixins/triangle.js @@ -15,7 +15,7 @@ const getBorderWidth = ( pointingDirection: PointingDirection, height: number, width: number, -) => { +): string => { switch (pointingDirection) { case 'top': return `0 ${width / 2}px ${height}px ${width / 2}px` diff --git a/src/mixins/wordWrap.js b/src/mixins/wordWrap.js index 14de4be6..340be3a3 100644 --- a/src/mixins/wordWrap.js +++ b/src/mixins/wordWrap.js @@ -23,7 +23,7 @@ * } */ -function wordWrap(wrap: string = 'break-word') { +function wordWrap(wrap?: string = 'break-word'): Object { const wordBreak = wrap === 'break-word' ? 'break-all' : wrap return { overflowWrap: wrap, diff --git a/src/shorthands/animation.js b/src/shorthands/animation.js index 8e2ed877..b611118f 100644 --- a/src/shorthands/animation.js +++ b/src/shorthands/animation.js @@ -41,7 +41,7 @@ type AnimationProperty = string | number */ function animation( ...args: Array | AnimationProperty> -) { +): Object { // Allow single or multiple animations passed const multiMode = Array.isArray(args[0]) if (!multiMode && args.length > 8) { diff --git a/src/shorthands/backgroundImages.js b/src/shorthands/backgroundImages.js index f6e3c963..07359ea2 100644 --- a/src/shorthands/backgroundImages.js +++ b/src/shorthands/backgroundImages.js @@ -20,7 +20,7 @@ * } */ -function backgroundImages(...properties: Array) { +function backgroundImages(...properties: Array): Object { return { backgroundImage: properties.join(', '), } diff --git a/src/shorthands/backgrounds.js b/src/shorthands/backgrounds.js index ba085f35..912db029 100644 --- a/src/shorthands/backgrounds.js +++ b/src/shorthands/backgrounds.js @@ -19,7 +19,7 @@ * 'background': 'url("/image/background.jpg"), linear-gradient(red, green), center no-repeat' * } */ -function backgrounds(...properties: Array) { +function backgrounds(...properties: Array): Object { return { background: properties.join(', '), } diff --git a/src/shorthands/borderColor.js b/src/shorthands/borderColor.js index b05c4ec5..f66dbc5b 100644 --- a/src/shorthands/borderColor.js +++ b/src/shorthands/borderColor.js @@ -24,7 +24,7 @@ import directionalProperty from '../helpers/directionalProperty' * } */ -function borderColor(...values: Array) { +function borderColor(...values: Array): Object { return directionalProperty('borderColor', ...values) } diff --git a/src/shorthands/borderRadius.js b/src/shorthands/borderRadius.js index 6a6b803c..cb99fb7d 100644 --- a/src/shorthands/borderRadius.js +++ b/src/shorthands/borderRadius.js @@ -22,7 +22,7 @@ import capitalizeString from '../internalHelpers/_capitalizeString' * } */ -function borderRadius(side: string, radius: string) { +function borderRadius(side: string, radius: string): Object { const uppercaseSide = capitalizeString(side) if (!radius || typeof radius !== 'string') { throw new Error( diff --git a/src/shorthands/borderStyle.js b/src/shorthands/borderStyle.js index c52373af..880f3674 100644 --- a/src/shorthands/borderStyle.js +++ b/src/shorthands/borderStyle.js @@ -24,7 +24,7 @@ import directionalProperty from '../helpers/directionalProperty' * } */ -function borderStyle(...values: Array) { +function borderStyle(...values: Array): Object { return directionalProperty('borderStyle', ...values) } diff --git a/src/shorthands/borderWidth.js b/src/shorthands/borderWidth.js index e0a8a69e..d16f3d2e 100644 --- a/src/shorthands/borderWidth.js +++ b/src/shorthands/borderWidth.js @@ -23,7 +23,7 @@ import directionalProperty from '../helpers/directionalProperty' * 'borderLeftWidth': '48px' * } */ -function borderWidth(...values: Array) { +function borderWidth(...values: Array): Object { return directionalProperty('borderWidth', ...values) } diff --git a/src/shorthands/buttons.js b/src/shorthands/buttons.js index bcf3bfc0..4299a50f 100644 --- a/src/shorthands/buttons.js +++ b/src/shorthands/buttons.js @@ -1,18 +1,17 @@ // @flow import statefulSelectors from '../internalHelpers/_statefulSelectors' +import type { InteractionState } from '../types/interactionState' + const stateMap = [undefined, null, 'active', 'focus', 'hover'] -function template(state) { +function template(state: string): string { return `button${state}, input[type="button"]${state}, input[type="reset"]${state}, input[type="submit"]${state}` } -/** */ -type ButtonState = typeof undefined | null | 'active' | 'focus' | 'hover' - /** * Populates selectors that target all buttons. You can pass optional states to append to the selectors. * @example @@ -40,7 +39,7 @@ type ButtonState = typeof undefined | null | 'active' | 'focus' | 'hover' * } */ -function buttons(...states: Array) { +function buttons(...states: Array): string { return statefulSelectors(states, template, stateMap) } diff --git a/src/shorthands/margin.js b/src/shorthands/margin.js index 57824736..a93a5b7a 100644 --- a/src/shorthands/margin.js +++ b/src/shorthands/margin.js @@ -24,7 +24,7 @@ import directionalProperty from '../helpers/directionalProperty' * } */ -function margin(...values: Array) { +function margin(...values: Array): Object { return directionalProperty('margin', ...values) } diff --git a/src/shorthands/padding.js b/src/shorthands/padding.js index c4fbc48c..d9645904 100644 --- a/src/shorthands/padding.js +++ b/src/shorthands/padding.js @@ -24,7 +24,7 @@ import directionalProperty from '../helpers/directionalProperty' * } */ -function padding(...values: Array) { +function padding(...values: Array): Object { return directionalProperty('padding', ...values) } diff --git a/src/shorthands/position.js b/src/shorthands/position.js index bbcb000e..41f883c2 100644 --- a/src/shorthands/position.js +++ b/src/shorthands/position.js @@ -46,7 +46,10 @@ const positionMap = ['absolute', 'fixed', 'relative', 'static', 'sticky'] * } */ -function position(positionKeyword: string | null, ...values: Array) { +function position( + positionKeyword: string | null, + ...values: Array +): Object { if (positionMap.indexOf(positionKeyword) >= 0) { return { position: positionKeyword, diff --git a/src/shorthands/size.js b/src/shorthands/size.js index 8a8d3d82..628d0bb2 100644 --- a/src/shorthands/size.js +++ b/src/shorthands/size.js @@ -21,7 +21,7 @@ * } */ -function size(height: string, width: string = height) { +function size(height: string, width?: string = height): Object { return { height, width, diff --git a/src/shorthands/test/borderRadius.test.js b/src/shorthands/test/borderRadius.test.js index 249cc313..f597cee9 100644 --- a/src/shorthands/test/borderRadius.test.js +++ b/src/shorthands/test/borderRadius.test.js @@ -16,7 +16,7 @@ describe('borderRadius', () => { }) it('should throw an error when an invalid radius value is provided', () => { expect(() => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe borderRadius('top') }).toThrow( 'borderRadius expects a radius value as a string as the second argument.', @@ -24,7 +24,7 @@ describe('borderRadius', () => { }) it('should throw an error when no radius value is provided', () => { expect(() => { - // $FlowIgnoreNextLine since the coming is invalid code, flow complains + // $FlowFixMe borderRadius('top', 100) }).toThrow( 'borderRadius expects a radius value as a string as the second argument.', diff --git a/src/shorthands/test/buttons.test.js b/src/shorthands/test/buttons.test.js index 4f7dce1b..6ce007eb 100644 --- a/src/shorthands/test/buttons.test.js +++ b/src/shorthands/test/buttons.test.js @@ -22,6 +22,7 @@ describe('buttons', () => { }) it('throws an error when passed a state it does not recognize', () => { expect(() => ({ + // $FlowFixMe [buttons('clicked')]: { 'border-color': 'black' }, })).toThrow('You passed an unsupported selector state to this method') }) diff --git a/src/shorthands/test/textInputs.test.js b/src/shorthands/test/textInputs.test.js index 00faecea..595a82e2 100644 --- a/src/shorthands/test/textInputs.test.js +++ b/src/shorthands/test/textInputs.test.js @@ -22,6 +22,7 @@ describe('textInputs', () => { }) it('throws an error when passed a state it does not recognize', () => { expect(() => ({ + // $FlowFixMe [textInputs('clicked')]: { 'border-color': 'black' }, })).toThrow('You passed an unsupported selector state to this method') }) diff --git a/src/shorthands/textInputs.js b/src/shorthands/textInputs.js index 665cdb6e..784802a1 100644 --- a/src/shorthands/textInputs.js +++ b/src/shorthands/textInputs.js @@ -1,9 +1,11 @@ // @flow import statefulSelectors from '../internalHelpers/_statefulSelectors' +import type { InteractionState } from '../types/interactionState' + const stateMap = [undefined, null, 'active', 'focus', 'hover'] -function template(state) { +function template(state: string): string { return `input[type="color"]${state}, input[type="date"]${state}, input[type="datetime"]${state}, @@ -22,9 +24,6 @@ function template(state) { textarea${state}` } -/** */ -type InputState = typeof undefined | null | 'active' | 'focus' | 'hover' - /** * Populates selectors that target all text inputs. You can pass optional states to append to the selectors. * @example @@ -64,7 +63,7 @@ type InputState = typeof undefined | null | 'active' | 'focus' | 'hover' * } */ -function textInputs(...states: Array) { +function textInputs(...states: Array): string { return statefulSelectors(states, template, stateMap) } diff --git a/src/shorthands/transitions.js b/src/shorthands/transitions.js index 927aec1c..78b15fe4 100644 --- a/src/shorthands/transitions.js +++ b/src/shorthands/transitions.js @@ -20,7 +20,7 @@ * } */ -function transitions(...properties: Array) { +function transitions(...properties: Array): Object { return { transition: properties.join(', '), } diff --git a/src/types/interactionState.js b/src/types/interactionState.js new file mode 100644 index 00000000..a7bd06ca --- /dev/null +++ b/src/types/interactionState.js @@ -0,0 +1,14 @@ +// @flow + +// Note: we define properties with JSdoc since documentation.js doesn't recognize +// exported types yet. See https://github.com/documentationjs/documentation/issues/680 + +/** + * @property {undefined, null, 'active', 'focus', 'hover'} interactionState + */ +export type InteractionState = + | typeof undefined + | null + | 'active' + | 'focus' + | 'hover' diff --git a/src/types/modularScaleRatio.js b/src/types/modularScaleRatio.js new file mode 100644 index 00000000..866d74b2 --- /dev/null +++ b/src/types/modularScaleRatio.js @@ -0,0 +1,27 @@ +// @flow + +// Note: we define properties with JSdoc since documentation.js doesn't recognize +// exported types yet. See https://github.com/documentationjs/documentation/issues/680 + +/** + * @property {number, 'minorSecond', 'majorSecond', 'minorThird', 'majorThird', 'perfectFourth', 'augFourth', 'perfectFifth', 'minorSixth', 'goldenSection', 'majorSixth', 'minorSeventh', 'majorSeventh', 'octave', 'majorTenth', 'majorEleventh', 'majorTwelfth', 'doubleOctave'} ModularScaleRatio + */ +export type ModularScaleRatio = + | number + | 'minorSecond' + | 'majorSecond' + | 'minorThird' + | 'majorThird' + | 'perfectFourth' + | 'augFourth' + | 'perfectFifth' + | 'minorSixth' + | 'goldenSection' + | 'majorSixth' + | 'minorSeventh' + | 'majorSeventh' + | 'octave' + | 'majorTenth' + | 'majorEleventh' + | 'majorTwelfth' + | 'doubleOctave' diff --git a/yarn.lock b/yarn.lock index 99375be5..4d865f4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -161,10 +161,21 @@ array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" +array.prototype.find@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.0.0.tgz#56a9ab1edde2a7701ed6d9166acec338919d8430" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.0" + arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + asn1@~0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" @@ -990,6 +1001,13 @@ babel-register@^6.24.0: mkdirp "^0.5.1" source-map-support "^0.4.2" +babel-runtime@6.11.6: + version "6.11.6" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.11.6.tgz#6db707fef2d49c49bfa3cb64efdb436b518b8222" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.9.5" + babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0, babel-runtime@^6.9.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" @@ -1362,6 +1380,10 @@ colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" +colors@^1.0.3: + version "1.1.2" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" + colors@~0.6.0-1: version "0.6.2" resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.2.tgz#2423fe6678ac0c5dae8852e5d0e5be08c997abcc" @@ -1487,6 +1509,10 @@ convert-source-map@^1.1.0, convert-source-map@^1.1.1: version "1.4.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.4.0.tgz#e3dad195bf61bfe13a7a3c73e9876ec14a0268f3" +core-js@^1.0.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" + core-js@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" @@ -1615,6 +1641,13 @@ default-require-extensions@^1.0.0: dependencies: strip-bom "^2.0.0" +define-properties@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" + dependencies: + foreach "^2.0.5" + object-keys "^1.0.8" + defined@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" @@ -1776,6 +1809,10 @@ duplexify@^3.2.0: readable-stream "^2.0.0" stream-shift "^1.0.0" +eastasianwidth@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.1.1.tgz#44d656de9da415694467335365fb3147b8572b7c" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1810,6 +1847,12 @@ encodeurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20" +encoding@^0.1.11: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + dependencies: + iconv-lite "~0.4.13" + end-of-stream@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.0.0.tgz#d4596e702734a93e40e9af864319eabd99ff2f0e" @@ -1835,6 +1878,24 @@ error@^7.0.0: string-template "~0.2.1" xtend "~4.0.0" +es-abstract@^1.5.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.8.0.tgz#3b00385e85729932beffa9163bbea1234e932914" + dependencies: + es-to-primitive "^1.1.1" + function-bind "^1.1.0" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" + +es-to-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" + dependencies: + is-callable "^1.1.1" + is-date-object "^1.0.1" + is-symbol "^1.0.1" + es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: version "0.10.15" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" @@ -2156,6 +2217,18 @@ fb-watchman@^1.8.0, fb-watchman@^1.9.0: dependencies: bser "1.0.2" +fbjs@^0.8.4: + version "0.8.14" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.14.tgz#d1dbe2be254c35a91e09f31f9cd50a40b2a0ed1c" + dependencies: + core-js "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.9" + figures@^1.3.5, figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" @@ -2238,9 +2311,9 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@^0.36.0: - version "0.36.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.36.0.tgz#557907bd9c2ab0670cfad9e7e906a74b0631e39a" +flow-bin@^0.53.1: + version "0.53.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.53.1.tgz#9b22b63a23c99763ae533ebbab07f88c88c97d84" flow-copy-source@^1.1.0: version "1.1.0" @@ -2251,6 +2324,23 @@ flow-copy-source@^1.1.0: kefir "^3.2.0" yargs "^3.32.0" +flow-coverage-report@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/flow-coverage-report/-/flow-coverage-report-0.3.0.tgz#a22d52fc9fa9c24ae0be02712a6fe1ac156f0d93" + dependencies: + array.prototype.find "2.0.0" + babel-runtime "6.11.6" + glob "7.0.5" + minimatch "3.0.3" + mkdirp "0.5.1" + parse-json "2.2.0" + react "15.3.1" + react-dom "15.3.1" + strip-json-comments "2.0.1" + temp "0.8.3" + terminal-table "0.0.12" + yargs "5.0.0" + flow-remove-types@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-1.2.0.tgz#c285516eabba72177a1b10bfb58f6ffb675a8877" @@ -2268,6 +2358,10 @@ for-own@^0.1.4: dependencies: for-in "^1.0.1" +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -2334,7 +2428,7 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" -function-bind@^1.0.2: +function-bind@^1.0.2, function-bind@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" @@ -2431,6 +2525,17 @@ glob-stream@^5.3.2: to-absolute-glob "^0.1.1" unique-stream "^2.0.2" +glob@7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^5.0.15, glob@^5.0.3: version "5.0.15" resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" @@ -2647,6 +2752,10 @@ iconv-lite@0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" +iconv-lite@~0.4.13: + version "0.4.18" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" + ignore-by-default@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" @@ -2766,12 +2875,20 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" +is-callable@^1.1.1, is-callable@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" + is-ci@^1.0.10, is-ci@^1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" dependencies: ci-info "^1.0.0" +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + is-decimal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-1.0.0.tgz#940579b6ea63c628080a69e62bda88c8470b4fe0" @@ -2885,6 +3002,12 @@ is-redirect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + dependencies: + has "^1.0.1" + is-relative@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-0.2.1.tgz#d27f4c7d516d175fb610db84bbeef23c3bc97aa5" @@ -2907,6 +3030,10 @@ is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" +is-symbol@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" + is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -2955,6 +3082,13 @@ isobject@^2.0.0: dependencies: isarray "1.0.0" +isomorphic-fetch@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -3615,7 +3749,7 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0: +loose-envify@^1.0.0, loose-envify@^1.1.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -3768,7 +3902,7 @@ mime@1.3.4, mime@^1.3.4: version "1.3.4" resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" -"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: +"minimatch@2 || 3", minimatch@3.0.3, minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: @@ -3782,7 +3916,7 @@ minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -3856,6 +3990,13 @@ node-emoji@^1.4.1: dependencies: string.prototype.codepointat "^0.2.0" +node-fetch@^1.0.1: + version "1.7.2" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.2.tgz#c54e9aac57e432875233525f3c891c4159ffefd7" + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -4005,6 +4146,10 @@ object-assign@^4.0.0, object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +object-keys@^1.0.8: + version "1.0.11" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -4167,7 +4312,7 @@ parse-glob@^3.0.4: is-extglob "^1.0.0" is-glob "^2.0.0" -parse-json@^2.2.0: +parse-json@2.2.0, parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" dependencies: @@ -4304,6 +4449,12 @@ progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + dependencies: + asap "~2.0.3" + property-information@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/property-information/-/property-information-3.2.0.tgz#fd1483c8fbac61808f5fe359e7693a1f48a58331" @@ -4378,6 +4529,18 @@ rc@^1.0.1, rc@^1.1.0, rc@^1.1.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +react-dom@15.3.1: + version "15.3.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.3.1.tgz#6d42cd2b64c8c5e0b693f3ffaec301e6e627e24e" + +react@15.3.1: + version "15.3.1" + resolved "https://registry.yarnpkg.com/react/-/react-15.3.1.tgz#f78501ed8c2ec6e6e31c3223652e97f1369d2bd6" + dependencies: + fbjs "^0.8.4" + loose-envify "^1.1.0" + object-assign "^4.1.0" + read-all-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" @@ -4481,6 +4644,10 @@ regenerator-runtime@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" +regenerator-runtime@^0.9.5: + version "0.9.6" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.9.6.tgz#d33eb95d0d2001a4be39659707c51b0cb71ce029" + regenerator-transform@0.9.8: version "0.9.8" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.8.tgz#0f88bb2bc03932ddb7b6b7312e68078f01026d6c" @@ -4718,6 +4885,10 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.4.4, rimraf@^2.5.1, rimraf@^2.6.1: dependencies: glob "^7.0.5" +rimraf@~2.2.6: + version "2.2.8" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" + rollup-plugin-babel@^2.6.1: version "2.7.1" resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-2.7.1.tgz#16528197b0f938a1536f44683c7a93d573182f57" @@ -4897,6 +5068,10 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + setprototypeof@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" @@ -5140,7 +5315,7 @@ strip-indent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" -strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: +strip-json-comments@2.0.1, strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -5200,6 +5375,20 @@ tar@^2.2.1: fstream "^1.0.2" inherits "2" +temp@0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.3.tgz#e0c6bc4d26b903124410e4fed81103014dfc1f59" + dependencies: + os-tmpdir "^1.0.0" + rimraf "~2.2.6" + +terminal-table@0.0.12: + version "0.0.12" + resolved "https://registry.yarnpkg.com/terminal-table/-/terminal-table-0.0.12.tgz#7b56d009aa6828dfdd10f11b654e79c062965fa2" + dependencies: + colors "^1.0.3" + eastasianwidth "^0.1.0" + test-exclude@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-2.1.3.tgz#a8d8968e1da83266f9864f2852c55e220f06434a" @@ -5336,6 +5525,10 @@ typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +ua-parser-js@^0.7.9: + version "0.7.14" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.14.tgz#110d53fa4c3f326c121292bbeac904d2e03387ca" + uglify-js@^2.6, uglify-js@^2.6.1: version "2.8.16" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.16.tgz#d286190b6eefc6fd65eb0ecac6551e0b0e8839a4" @@ -5614,6 +5807,10 @@ whatwg-encoding@^1.0.1: dependencies: iconv-lite "0.4.13" +whatwg-fetch@>=0.10.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" + whatwg-url@^4.3.0: version "4.6.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.6.0.tgz#ef98da442273be04cf9632e176f257d2395a1ae4" @@ -5738,19 +5935,7 @@ yargs-parser@^4.2.0: dependencies: camelcase "^3.0.0" -yargs@^3.32.0: - version "3.32.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995" - dependencies: - camelcase "^2.0.1" - cliui "^3.0.3" - decamelize "^1.1.1" - os-locale "^1.4.0" - string-width "^1.0.1" - window-size "^0.1.4" - y18n "^3.2.0" - -yargs@^5.0.0: +yargs@5.0.0, yargs@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-5.0.0.tgz#3355144977d05757dbb86d6e38ec056123b3a66e" dependencies: @@ -5769,6 +5954,18 @@ yargs@^5.0.0: y18n "^3.2.1" yargs-parser "^3.2.0" +yargs@^3.32.0: + version "3.32.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995" + dependencies: + camelcase "^2.0.1" + cliui "^3.0.3" + decamelize "^1.1.1" + os-locale "^1.4.0" + string-width "^1.0.1" + window-size "^0.1.4" + y18n "^3.2.0" + yargs@^6.0.0: version "6.6.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"