glamor
Version:
inline css for component systems
2,901 lines • 91.6 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Glamor"] = factory();
else
root["Glamor"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isPrefixedValue;
var regex = /-webkit-|-moz-|-ms-/;
function isPrefixedValue(value) {
return typeof value === 'string' && regex.test(value);
}
module.exports = exports['default'];
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
var emptyFunction = __webpack_require__(7);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (true) {
(function () {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
})();
}
module.exports = warning;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = capitalizeString;
function capitalizeString(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
module.exports = exports["default"];
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
// CONCATENATED MODULE: ./src/sheet.js
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_object_assign__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_object_assign__);
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
/*
high performance StyleSheet for css-in-js systems
- uses multiple style tags behind the scenes for millions of rules
- uses `insertRule` for appending in production for *much* faster performance
- 'polyfills' on server side
// usage
import StyleSheet from 'glamor/lib/sheet'
let styleSheet = new StyleSheet()
styleSheet.inject()
- 'injects' the stylesheet into the page (or into memory if on server)
styleSheet.insert('#box { border: 1px solid red; }')
- appends a css rule into the stylesheet
styleSheet.flush()
- empties the stylesheet of all its contents
*/
function last(arr) {
return arr[arr.length - 1];
}
function sheetForTag(tag) {
if (tag.sheet) {
return tag.sheet;
}
// this weirdness brought to you by firefox
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
return document.styleSheets[i];
}
}
}
var isBrowser = typeof window !== 'undefined';
var isDev = "development" === 'development' || !"development"; //(x => (x === 'development') || !x)(process.env.NODE_ENV)
var isTest = "development" === 'test';
var oldIE = function () {
if (isBrowser) {
var div = document.createElement('div');
div.innerHTML = '<!--[if lt IE 10]><i></i><![endif]-->';
return div.getElementsByTagName('i').length === 1;
}
}();
function makeStyleTag() {
var tag = document.createElement('style');
tag.type = 'text/css';
tag.setAttribute('data-glamor', '');
tag.appendChild(document.createTextNode(''));
(document.head || document.getElementsByTagName('head')[0]).appendChild(tag);
return tag;
}
function StyleSheet() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$speedy = _ref.speedy,
speedy = _ref$speedy === undefined ? !isDev && !isTest : _ref$speedy,
_ref$maxLength = _ref.maxLength,
maxLength = _ref$maxLength === undefined ? isBrowser && oldIE ? 4000 : 65000 : _ref$maxLength;
this.isSpeedy = speedy; // the big drawback here is that the css won't be editable in devtools
this.sheet = undefined;
this.tags = [];
this.maxLength = maxLength;
this.ctr = 0;
}
__WEBPACK_IMPORTED_MODULE_0_object_assign___default()(StyleSheet.prototype, {
getSheet: function getSheet() {
return sheetForTag(last(this.tags));
},
inject: function inject() {
var _this = this;
if (this.injected) {
throw new Error('already injected stylesheet!');
}
if (isBrowser) {
this.tags[0] = makeStyleTag();
} else {
// server side 'polyfill'. just enough behavior to be useful.
this.sheet = {
cssRules: [],
insertRule: function insertRule(rule) {
// enough 'spec compliance' to be able to extract the rules later
// in other words, just the cssText field
_this.sheet.cssRules.push({ cssText: rule });
}
};
}
this.injected = true;
},
speedy: function speedy(bool) {
if (this.ctr !== 0) {
throw new Error('cannot change speedy mode after inserting any rule to sheet. Either call speedy(' + bool + ') earlier in your app, or call flush() before speedy(' + bool + ')');
}
this.isSpeedy = !!bool;
},
_insert: function _insert(rule) {
// this weirdness for perf, and chrome's weird bug
// https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
try {
var sheet = this.getSheet();
sheet.insertRule(rule, rule.indexOf('@import') !== -1 ? 0 : sheet.cssRules.length);
} catch (e) {
if (isDev) {
// might need beter dx for this
console.warn('whoops, illegal rule inserted', rule); //eslint-disable-line no-console
}
}
},
insert: function insert(rule) {
if (isBrowser) {
// this is the ultrafast version, works across browsers
if (this.isSpeedy && this.getSheet().insertRule) {
this._insert(rule);
}
// more browser weirdness. I don't even know
// else if(this.tags.length > 0 && this.tags::last().styleSheet) {
// this.tags::last().styleSheet.cssText+= rule
// }
else {
if (rule.indexOf('@import') !== -1) {
var tag = last(this.tags);
tag.insertBefore(document.createTextNode(rule), tag.firstChild);
} else {
last(this.tags).appendChild(document.createTextNode(rule));
}
}
} else {
// server side is pretty simple
this.sheet.insertRule(rule, rule.indexOf('@import') !== -1 ? 0 : this.sheet.cssRules.length);
}
this.ctr++;
if (isBrowser && this.ctr % this.maxLength === 0) {
this.tags.push(makeStyleTag());
}
return this.ctr - 1;
},
// commenting this out till we decide on v3's decision
// _replace(index, rule) {
// // this weirdness for perf, and chrome's weird bug
// // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
// try {
// let sheet = this.getSheet()
// sheet.deleteRule(index) // todo - correct index here
// sheet.insertRule(rule, index)
// }
// catch(e) {
// if(isDev) {
// // might need beter dx for this
// console.warn('whoops, problem replacing rule', rule) //eslint-disable-line no-console
// }
// }
// }
// replace(index, rule) {
// if(isBrowser) {
// if(this.isSpeedy && this.getSheet().insertRule) {
// this._replace(index, rule)
// }
// else {
// let _slot = Math.floor((index + this.maxLength) / this.maxLength) - 1
// let _index = (index % this.maxLength) + 1
// let tag = this.tags[_slot]
// tag.replaceChild(document.createTextNode(rule), tag.childNodes[_index])
// }
// }
// else {
// let rules = this.sheet.cssRules
// this.sheet.cssRules = [ ...rules.slice(0, index), { cssText: rule }, ...rules.slice(index + 1) ]
// }
// }
delete: function _delete(index) {
// we insert a blank rule when 'deleting' so previously returned indexes remain stable
return this.replace(index, '');
},
flush: function flush() {
if (isBrowser) {
this.tags.forEach(function (tag) {
return tag.parentNode.removeChild(tag);
});
this.tags = [];
this.sheet = null;
this.ctr = 0;
// todo - look for remnants in document.styleSheets
} else {
// simpler on server
this.sheet.cssRules = [];
}
this.injected = false;
},
rules: function rules() {
if (!isBrowser) {
return this.sheet.cssRules;
}
var arr = [];
this.tags.forEach(function (tag) {
return arr.splice.apply(arr, [arr.length, 0].concat(_toConsumableArray(Array.from(sheetForTag(tag).cssRules))));
});
return arr;
}
});
// CONCATENATED MODULE: ./src/CSSPropertyOperations/CSSProperty.js
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSProperty
*/
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
borderImageOutset: true,
borderImageSlice: true,
borderImageWidth: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
gridRow: true,
gridRowStart: true,
gridRowEnd: true,
gridColumn: true,
gridColumnStart: true,
gridColumnEnd: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeDasharray: true,
strokeDashoffset: true,
strokeMiterlimit: true,
strokeOpacity: true,
strokeWidth: true
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
};function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
/* harmony default export */ var CSSProperty_defaultExport = (CSSProperty);
// CONCATENATED MODULE: ./src/CSSPropertyOperations/dangerousStyleValue.js
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_fbjs_lib_warning__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_fbjs_lib_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_fbjs_lib_warning__);
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule dangerousStyleValue
*/
var dangerousStyleValue_isUnitlessNumber = CSSProperty_defaultExport.isUnitlessNumber;
var styleWarnings = {};
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @param {ReactDOMComponent} component
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value, component) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || dangerousStyleValue_isUnitlessNumber.hasOwnProperty(name) && dangerousStyleValue_isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
if (true) {
// Allow '0' to pass through without warning. 0 is already special and
// doesn't require units, so we don't need to warn about it.
if (component && value !== '0') {
var owner = component._currentElement._owner;
var ownerName = owner ? owner.getName() : null;
if (ownerName && !styleWarnings[ownerName]) {
styleWarnings[ownerName] = {};
}
var warned = false;
if (ownerName) {
var warnings = styleWarnings[ownerName];
warned = warnings[name];
if (!warned) {
warnings[name] = true;
}
}
if (!warned) {
true ? __WEBPACK_IMPORTED_MODULE_1_fbjs_lib_warning___default()(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
}
}
}
value = value.trim();
}
return value + 'px';
}
/* harmony default export */ var dangerousStyleValue_defaultExport = (dangerousStyleValue);
// CONCATENATED MODULE: ./src/CSSPropertyOperations/index.js
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_fbjs_lib_camelizeStyleName__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_fbjs_lib_camelizeStyleName___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_fbjs_lib_camelizeStyleName__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_fbjs_lib_hyphenateStyleName__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_fbjs_lib_hyphenateStyleName___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_fbjs_lib_hyphenateStyleName__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_fbjs_lib_memoizeStringOnly__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_fbjs_lib_memoizeStringOnly___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_fbjs_lib_memoizeStringOnly__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning__);
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSPropertyOperations
*/
var processStyleName = __WEBPACK_IMPORTED_MODULE_3_fbjs_lib_memoizeStringOnly___default()(__WEBPACK_IMPORTED_MODULE_2_fbjs_lib_hyphenateStyleName___default.a);
if (true) {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnedForNaNValue = false;
var warnHyphenatedStyleName = function warnHyphenatedStyleName(name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
true ? __WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning___default()(false, 'Unsupported style property %s. Did you mean %s?%s', name, __WEBPACK_IMPORTED_MODULE_0_fbjs_lib_camelizeStyleName___default()(name), checkRenderMessage(owner)) : void 0;
};
var warnBadVendoredStyleName = function warnBadVendoredStyleName(name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
true ? __WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning___default()(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
};
var warnStyleValueWithSemicolon = function warnStyleValueWithSemicolon(name, value, owner) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
true ? __WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning___default()(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
};
var warnStyleValueIsNaN = function warnStyleValueIsNaN(name, value, owner) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
true ? __WEBPACK_IMPORTED_MODULE_4_fbjs_lib_warning___default()(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
};
var checkRenderMessage = function checkRenderMessage(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
};
/**
* @param {string} name
* @param {*} value
* @param {ReactDOMComponent} component
*/
var warnValidStyle = function warnValidStyle(name, value, component) {
//eslint-disable-line no-var
var owner = void 0;
if (component) {
owner = component._currentElement._owner;
}
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name, owner);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name, owner);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value, owner);
}
if (typeof value === 'number' && isNaN(value)) {
warnStyleValueIsNaN(name, value, owner);
}
};
}
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @param {ReactDOMComponent} component
* @return {?string}
*/
function createMarkupForStyles(styles, component) {
var serialized = '';
for (var styleName in styles) {
var isCustomProp = styleName.indexOf('--') === 0;
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (styleName === 'label') {
continue;
}
var styleValue = styles[styleName];
if ("development" !== 'production' && !isCustomProp) {
warnValidStyle(styleName, styleValue, component);
}
if (styleValue != null) {
if (isCustomProp) {
serialized += styleName + ':' + styleValue + ';';
} else {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue_defaultExport(styleName, styleValue, component) + ';';
}
}
}
return serialized || null;
}
// CONCATENATED MODULE: ./src/clean.js
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
// Returns true for null, false, undefined and {}
function isFalsy(value) {
return value === null || value === undefined || value === false || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && Object.keys(value).length === 0;
}
function cleanObject(object) {
if (isFalsy(object)) return null;
if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) !== 'object') return object;
var acc = {},
keys = Object.keys(object),
hasFalsy = false;
for (var i = 0; i < keys.length; i++) {
var value = object[keys[i]];
var filteredValue = clean(value);
if (filteredValue === null || filteredValue !== value) {
hasFalsy = true;
}
if (filteredValue !== null) {
acc[keys[i]] = filteredValue;
}
}
return Object.keys(acc).length === 0 ? null : hasFalsy ? acc : object;
}
function cleanArray(rules) {
var hasFalsy = false;
var filtered = [];
rules.forEach(function (rule) {
var filteredRule = clean(rule);
if (filteredRule === null || filteredRule !== rule) {
hasFalsy = true;
}
if (filteredRule !== null) {
filtered.push(filteredRule);
}
});
return filtered.length == 0 ? null : hasFalsy ? filtered : rules;
}
// Takes style array or object provided by user and clears all the falsy data
// If there is no styles left after filtration returns null
function clean(input) {
return Array.isArray(input) ? cleanArray(input) : cleanObject(input);
}
// CONCATENATED MODULE: ./src/prefixer.js
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_inline_style_prefixer_static_staticData__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_inline_style_prefixer_static_staticData___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_inline_style_prefixer_static_staticData__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_inline_style_prefixer_utils_prefixProperty__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_inline_style_prefixer_utils_prefixProperty___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_inline_style_prefixer_utils_prefixProperty__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_inline_style_prefixer_utils_prefixValue__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_inline_style_prefixer_utils_prefixValue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_inline_style_prefixer_utils_prefixValue__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_inline_style_prefixer_static_plugins_cursor__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_inline_style_prefixer_static_plugins_cursor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_inline_style_prefixer_static_plugins_cursor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_inline_style_prefixer_static_plugins_crossFade__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_inline_style_prefixer_static_plugins_crossFade___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_inline_style_prefixer_static_plugins_crossFade__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_inline_style_prefixer_static_plugins_filter__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_inline_style_prefixer_static_plugins_filter___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_inline_style_prefixer_static_plugins_filter__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_inline_style_prefixer_static_plugins_flex__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_inline_style_prefixer_static_plugins_flex___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_inline_style_prefixer_static_plugins_flex__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_inline_style_prefixer_static_plugins_flexboxOld__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_inline_style_prefixer_static_plugins_flexboxOld___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_inline_style_prefixer_static_plugins_flexboxOld__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_inline_style_prefixer_static_plugins_gradient__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_inline_style_prefixer_static_plugins_gradient___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_inline_style_prefixer_static_plugins_gradient__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_inline_style_prefixer_static_plugins_imageSet__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_inline_style_prefixer_static_plugins_imageSet___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_inline_style_prefixer_static_plugins_imageSet__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_inline_style_prefixer_static_plugins_position__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_inline_style_prefixer_static_plugins_position___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_inline_style_prefixer_static_plugins_position__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_inline_style_prefixer_static_plugins_sizing__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_inline_style_prefixer_static_plugins_sizing___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_inline_style_prefixer_static_plugins_sizing__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_inline_style_prefixer_static_plugins_transition__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_inline_style_prefixer_static_plugins_transition___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12_inline_style_prefixer_static_plugins_transition__);
// custom facade for inline-style-prefixer
var plugins = [__WEBPACK_IMPORTED_MODULE_4_inline_style_prefixer_static_plugins_crossFade___default.a, __WEBPACK_IMPORTED_MODULE_3_inline_style_prefixer_static_plugins_cursor___default.a, __WEBPACK_IMPORTED_MODULE_5_inline_style_prefixer_static_plugins_filter___default.a, __WEBPACK_IMPORTED_MODULE_7_inline_style_prefixer_static_plugins_flexboxOld___default.a, __WEBPACK_IMPORTED_MODULE_8_inline_style_prefixer_static_plugins_gradient___default.a, __WEBPACK_IMPORTED_MODULE_9_inline_style_prefixer_static_plugins_imageSet___default.a, __WEBPACK_IMPORTED_MODULE_10_inline_style_prefixer_static_plugins_position___default.a, __WEBPACK_IMPORTED_MODULE_11_inline_style_prefixer_static_plugins_sizing___default.a, __WEBPACK_IMPORTED_MODULE_12_inline_style_prefixer_static_plugins_transition___default.a, __WEBPACK_IMPORTED_MODULE_6_inline_style_prefixer_static_plugins_flex___default.a];
var prefixMap = __WEBPACK_IMPORTED_MODULE_0_inline_style_prefixer_static_staticData___default.a.prefixMap;
function prefixer(style) {
for (var property in style) {
var value = style[property];
var processedValue = __WEBPACK_IMPORTED_MODULE_2_inline_style_prefixer_utils_prefixValue___default()(plugins, property, value, style, prefixMap);
// only modify the value if it was touched
// by any plugin to prevent unnecessary mutations
if (processedValue) {
style[property] = processedValue;
}
__WEBPACK_IMPORTED_MODULE_1_inline_style_prefixer_utils_prefixProperty___default()(prefixMap, property, style);
}
return style;
}
// CONCATENATED MODULE: ./src/plugins.js
/* harmony import */ var plugins___WEBPACK_IMPORTED_MODULE_0_object_assign__ = __webpack_require__(1);
/* harmony import */ var plugins___WEBPACK_IMPORTED_MODULE_0_object_assign___default = __webpack_require__.n(plugins___WEBPACK_IMPORTED_MODULE_0_object_assign__);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var plugins_isDev = function (x) {
return x === 'development' || !x;
}("development");
function PluginSet(initial) {
this.fns = initial || [];
}
plugins___WEBPACK_IMPORTED_MODULE_0_object_assign___default()(PluginSet.prototype, {
add: function add() {
var _this = this;
for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) {
fns[_key] = arguments[_key];
}
fns.forEach(function (fn) {
if (_this.fns.indexOf(fn) >= 0) {
if (plugins_isDev) {
console.warn('adding the same plugin again, ignoring'); //eslint-disable-line no-console
}
} else {
_this.fns = [fn].concat(_this.fns);
}
});
},
remove: function remove(fn) {
this.fns = this.fns.filter(function (x) {
return x !== fn;
});
},
clear: function clear() {
this.fns = [];
},
transform: function transform(o) {
return this.fns.reduce(function (o, fn) {
return fn(o);
}, o);
}
});
function fallbacks(node) {
var hasArray = Object.keys(node.style).map(function (x) {
return Array.isArray(node.style[x]);
}).indexOf(true) >= 0;
if (hasArray) {
var style = node.style;
var flattened = Object.keys(style).reduce(function (o, key) {
o[key] = Array.isArray(style[key]) ? style[key].join('; ' + processStyleName(key) + ': ') : style[key];
return o;
}, {});
// todo -
// flatten arrays which haven't been flattened yet
return plugins___WEBPACK_IMPORTED_MODULE_0_object_assign___default()({}, node, { style: flattened });
}
return node;
}
var contentValues = ['normal', 'none', 'counter', 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', 'initial', 'inherit'];
function contentWrap(node) {
if (node.style.content) {
var cont = node.style.content;
if (contentValues.indexOf(cont) >= 0) {
return node;
}
if (/^(attr|calc|counters?|url)\(/.test(cont)) {
return node;
}
if (cont.charAt(0) === cont.charAt(cont.length - 1) && (cont.charAt(0) === '"' || cont.charAt(0) === "'")) {
return node;
}
return _extends({}, node, { style: _extends({}, node.style, { content: '"' + cont + '"' }) });
}
return node;
}
function plugins_prefixes(node) {
return plugins___WEBPACK_IMPORTED_MODULE_0_object_assign___default()({}, node, { style: prefixer(_extends({}, node.style)) });
}
// CONCATENATED MODULE: ./src/hash.js
// murmurhash2 via https://gist.github.com/raycmorgan/588423
function doHash(str, seed) {
var m = 0x5bd1e995;
var r = 24;
var h = seed ^ str.length;
var length = str.length;
var currentIndex = 0;
while (length >= 4) {
var k = UInt32(str, currentIndex);
k = Umul32(k, m);
k ^= k >>> r;
k = Umul32(k, m);
h = Umul32(h, m);
h ^= k;
currentIndex += 4;
length -= 4;
}
switch (length) {
case 3:
h ^= UInt16(str, currentIndex);
h ^= str.charCodeAt(currentIndex + 2) << 16;
h = Umul32(h, m);
break;
case 2:
h ^= UInt16(str, currentIndex);
h = Umul32(h, m);
break;
case 1:
h ^= str.charCodeAt(currentIndex);
h = Umul32(h, m);
break;
}
h ^= h >>> 13;
h = Umul32(h, m);
h ^= h >>> 15;
return h >>> 0;
}
function UInt32(str, pos) {
return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8) + (str.charCodeAt(pos++) << 16) + (str.charCodeAt(pos) << 24);
}
function UInt16(str, pos) {
return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8);
}
function Umul32(n, m) {
n = n | 0;
m = m | 0;
var nlo = n & 0xffff;
var nhi = n >>> 16;
var res = nlo * m + ((nhi * m & 0xffff) << 16) | 0;
return res;
}
// CONCATENATED MODULE: ./src/index.js
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "styleSheet", function() { return styleSheet; });
/* harmony export (immutable) */ __webpack_exports__["speedy"] = speedy;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "plugins", function() { return src_plugins; });
/* harmony export (immutable) */ __webpack_exports__["simulations"] = simulations;
/* harmony export (immutable) */ __webpack_exports__["simulate"] = simulate;
/* harmony export (immutable) */ __webpack_exports__["cssLabels"] = cssLabels;
/* harmony export (immutable) */ __webpack_exports__["isLikeRule"] = isLikeRule;
/* harmony export (immutable) */ __webpack_exports__["idFor"] = idFor;
/* harmony export (immutable) */ __webpack_exports__["css"] = css;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertRule", function() { return insertRule; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertGlobal", function() { return insertGlobal; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fontFace", function() { return fontFace; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes; });
/* harmony export (immutable) */ __webpack_exports__["rehydrate"] = rehydrate;
/* harmony export (immutable) */ __webpack_exports__["flush"] = flush;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "presets", function() { return presets; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return src_style; });
/* harmony export (immutable) */ __webpack_exports__["select"] = select;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$", function() { return $; });
/* harmony export (immutable) */ __webpack_exports__["parent"] = parent;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return merge; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
/* harmony export (immutable) */ __webpack_exports__["media"] = media;
/* harmony export (immutable) */ __webpack_exports__["pseudo"] = pseudo;
/* harmony export (immutable) */ __webpack_exports__["active"] = active;
/* harmony export (immutable) */ __webpack_exports__["any"] = any;
/* harmony export (immutable) */ __webpack_exports__["checked"] = checked;
/* harmony export (immutable) */ __webpack_exports__["disabled"] = disabled;
/* harmony export (immutable) */ __webpack_exports__["empty"] = empty;
/* harmony export (immutable) */ __webpack_exports__["enabled"] = enabled;
/* harmony export (immutable) */ __webpack_exports__["_default"] = _default;
/* harmony export (immutable) */ __webpack_exports__["first"] = first;
/* harmony export (immutable) */ __webpack_exports__["firstChild"] = firstChild;
/* harmony export (immutable) */ __webpack_exports__["firstOfType"] = firstOfType;
/* harmony export (immutable) */ __webpack_exports__["fullscreen"] = fullscreen;
/* harmony export (immutable) */ __webpack_exports__["focus"] = focus;
/* harmony export (immutable) */ __webpack_exports__["hover"] = hover;
/* harmony export (immutable) */ __webpack_exports__["indeterminate"] = indeterminate;
/* harmony export (immutable) */ __webpack_exports__["inRange"] = inRange;
/* harmony export (immutable) */ __webpack_exports__["invalid"] = invalid;
/* harmony export (immutable) */ __webpack_exports__["lastChild"] = lastChild;
/* harmony export (immutable) */ __webpack_exports__["lastOfType"] = lastOfType;
/* harmony export (immutable) */ __webpack_exports__["left"] = left;
/* harmony export (immutable) */ __webpack_exports__["link"] = link;
/* harmony export (immutable) */ __webpack_exports__["onlyChild"] = onlyChild;
/* harmony export (immutable) */ __webpack_exports__["onlyOfType"] = onlyOfType;
/* harmony export (immutable) */ __webpack_exports__["optional"] = optional;
/* harmony export (immutable) */ __webpack_exports__["outOfRange"] = outOfRange;
/* harmony export (immutable) */ __webpack_exports__["readOnly"] = readOnly;
/* harmony export (immutable) */ __webpack_exports__["readWrite"] = readWrite;
/* harmony export (immutable) */ __webpack_exports__["required"] = required;
/* harmony export (immutable) */ __webpack_exports__["right"] = right;
/* harmony export (immutable) */ __webpack_exports__["root"] = root;
/* harmony export (immutable) */ __webpack_exports__["scope"] = scope;
/* harmony export (immutable) */ __webpack_exports__["target"] = target;
/* harmony export (immutable) */ __webpack_exports__["valid"] = valid;
/* harmony export (immutable) */ __webpack_exports__["visited"] = visited;
/* harmony export (immutable) */ __webpack_exports__["dir"] = dir;
/* harmony export (immutable) */ __webpack_exports__["lang"] = lang;
/* harmony export (immutable) */ __webpack_exports__["not"] = not;
/* harmony export (immutable) */ __webpack_exports__["nthChild"] = nthChild;
/* harmony export (immutable) */ __webpack_exports__["nthLastChild"] = nthLastChild;
/* harmony export (immutable) */ __webpack_exports__["nthLastOfType"] = nthLastOfType;
/* harmony export (immutable) */ __webpack_exports__["nthOfType"] = nthOfType;
/* harmony export (immutable) */ __webpack_exports__["after"] = after;
/* harmony export (immutable) */ __webpack_exports__["before"] = before;
/* harmony export (immutable) */ __webpack_exports__["firstLetter"] = firstLetter;
/* harmony export (immutable) */ __webpack_exports__["firstLine"] = firstLine;
/* harmony export (immutable) */ __webpack_exports__["selection"] = selection;
/* harmony export (immutable) */ __webpack_exports__["backdrop"] = backdrop;
/* harmony export (immutable) */ __webpack_exports__["placeholder"] = placeholder;
/* harmony export (immutable) */ __webpack_exports__["cssFor"] = cssFor;
/* harmony export (immutable) */ __webpack_exports__["attribsFor"] = attribsFor;
/* harmony import */ var src___WEBPACK_IMPORTED_MODULE_0_object_assign__ = __webpack_require__(1);
/* harmony import */ var src___WEBPACK_IMPORTED_MODULE_0_object_assign___default = __webpack_require__.n(src___WEBPACK_IMPORTED_MODULE_0_object_assign__);
function src__toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* stylesheet */
var styleSheet = new StyleSheet();
// an isomorphic StyleSheet shim. hides all the nitty gritty.
// /**************** LIFTOFF IN 3... 2... 1... ****************/
styleSheet.inject(); //eslint-disable-line indent
// /**************** TO THE MOOOOOOON ****************/
// convenience function to toggle speedy
function speedy(bool) {
return styleSheet.speedy(bool);
}
// plugins
// we include these by default
var src_plugins = styleSheet.plugins = new PluginSet([plugins_prefixes, contentWrap, fallbacks]);
src_plugins.media = new PluginSet(); // neat! media, font-face, keyframes
src_plugins.fontFace = new PluginSet();
src_plugins.keyframes = new PluginSet([plugins_prefixes, fallbacks]);
// define some constants
var src_isDev = "development" === 'development' || !"development";
var src_isTest = "development" === 'test';
var src_isBrowser = typeof window !== 'undefined';
/**** simulations ****/
// a flag to enable simulation meta tags on dom nodes
// defaults to true in dev mode. recommend *not* to
// toggle often.
var canSimulate = src_isDev;
// we use these flags for issuing warnings when simulate is called
// in prod / in incorrect order
var warned1 = false,
warned2 = false;
// toggles simulation activity. shouldn't be needed in most cases
function simulations() {
var bool = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
canSimulate = !!bool;
}
// use this on dom nodes to 'simulate' pseudoclasses
// <div {...hover({ color: 'red' })} {...simulate('hover', 'visited')}>...</div>
// you can even send in some weird ones, as long as it's in simple format
// and matches an existing rule on the element
// eg simulate('nthChild2', ':hover:active') etc
function simulate() {
for (var _len = arguments.length, pseudos = Array(_len), _key = 0; _key < _len; _key++) {
pseudos[_key] = arguments[_key];
}
pseudos = clean(pseudos);
if (!pseudos) return {};
if (!canSimulate) {
if (!warned1) {
console.warn('can\'t simulate without once calling simulations(true)'); //eslint-disable-line no-console
warned1 = true;
}
if (!src_isDev && !src_isTest && !warned2) {
console.warn('don\'t use simulation outside dev'); //eslint-disable-line no-console
warned2 = true;
}
return {};
}
return pseudos.reduce(function (o, p) {
return o['data-simulate-' + simple(p)] = '', o;
}, {});
}
/**** labels ****/
// toggle for debug labels.
// *shouldn't* have to mess with this manually
var hasLabels = src_isDev;
function cssLabels(bool) {
hasLabels = !!bool;
}
// takes a string, converts to lowercase, strips out nonalphanumeric.
function simple(str) {
var char = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return str.toLowerCase().replace(/[^a-z0-9]/g, char);
}
// hashes a string to something 'unique'
// we use this to generate ids for styles
function hashify(obj) {
var str = JSON.stringify(obj);
var toRet = doHash(str).toString(36);
if (obj.label && obj.label.length > 0 && src_isDev) {
return simple(obj.label.join('.'), '-') + '-' + toRet;
}
return toRet;
}
// of shape { 'data-css-<id>': '' }
function isLikeRule(rule) {
var keys = Object.keys(rule).filter(function (x) {
return x !== 'toString';
});
if (keys.length !== 1) {
return false;
}
return !!/data\-css\-([a-zA-Z0-9\-_]+)/.exec(keys[0]);
}
// extracts id from a { 'data-css-<id>': ''} like object
function idFor(rule) {
var keys = Object.keys(rule).filter(function (x) {
return x !== 'toString';
});
if (keys.length !== 1) throw new Error('not a rule');
var regex = /data\-css\-([a-zA-Z0-9\-_]+)/;
var match = regex.exec(keys[0]);
if (!match) throw new Error('not a rule');
return match[1];
}
// from https://github.com/j2css/j2c/blob/5d381c2d721d04b54fabe6a165d587247c3087cb/src/helpers.js#L28-L61
// "Tokenizes" the selectors into parts relevant for the next function.
// Strings and comments are matched, but ignored afterwards.
// This is not a full tokenizers. It only recognizes comas, parentheses,
// strings and comments.
// regexp generated by scripts/regexps.js then trimmed by hand
var selectorTokenizer = /[(),]|"(?:\\.|[^"\n])*"|'(?:\\.|[^'\n])*'|\/\*[\s\S]*?\*\//g;
/**
* This will split a coma-separated selector list into individual selectors,
* ignoring comas in strings, comments and in :pseudo-selectors(parameter, lists).
*
* @param {string} selector
* @return {string[]}
*/
function splitSelector(selector) {
if (selector.indexOf(',') === -1) {
return [selector];
}
var indices = [],
res = [],
inParen = 0,
o;
/*eslint-disable no-cond-assign*/
while (o = selectorTokenizer.exec(selector)) {
/*eslint-enable no-cond-assign*/
switch (o[0]) {
case '(':
inParen++;break;
case ')':
inParen--;break;
case ',':
if (inParen) break;indices.push(o.index);
}
}
for (o = indices.length; o--;) {
res.unshift(selector.slice(indices[o] + 1));
selector = selector.slice(0, indices[o]);
}
res.unshift(selector);
return res;
}
function src_selector(id, path) {
if (!id) {
return path.replace(/\&/g, '');
}
if (!path) return '.css-' + id + ',[data-css-' + id + ']';
var x = splitSelector(path).map(function (x) {
return x.indexOf('&') >= 0 ? [x.replace(/\&/mg, '.css-' + id), x.replace(/\&/mg, '[data-css-' + id + ']')].join(',') // todo - make sure each sub selector has an &
: '.css-' + id + x + ',[data-css-' + id + ']' + x;
}).join(',');
if (canSimulate && /^\&\:/.exec(path) && !/\s/.exec(path)) {
x += ',.css-' + id + '[data-simulate-' + simple(path) + '],[data-css-' + id + '][data-simulate-' + simple(path) + ']';
}
return x;
}
// end https://github.com/j2css/j2c/blob/5d381c2d721d04b54fabe6a165d587247c3087cb/src/helpers.js#L28-L61
function toCSS(_ref) {
var selector = _ref.selector,
style = _ref.style;
var result = src_plugins.transform({ selector: selector, style: style });
return result.selector + '{' + createMarkupForStyles(result.style) + '}';
}
function deconstruct(style) {
// we can be sure it's not infinitely nested here
var plain = void 0,
selects = void 0,
medias = void 0,
supports = void 0;
Object.keys(style).forEach(function (key) {
if (key.indexOf('&') >= 0) {
selects = selects || {};
selects[key] = style[key];
} else if (key.indexOf('@media') === 0) {
medias = medias || {};
medias[key] = deconstruct(style[key]);
} else if (key.indexOf('@supports') === 0) {
supports = supports || {};
supports[key] = deconstruct(style[key]);
} else if (key === 'label') {
if (style.label.length > 0) {
plain = plain || {};
plain.label = hasLabels ? style.label.join('.') : '';
}
} else {
plain = plain || {};
plain[key] = style[key];
}
});
return { plain: plain, selects: selects, medias: medias, supports: supports };
}
function deconstructedStyleToCSS(id, style) {
var css = [];
// plugins here
var plain = style.plain,
selects = style.selects,
medias = style.medias,
supports = style.supports;
if (plain) {
css.push(toCSS({ style: plain, selector: src_selector(id) }));
}
if (selects) {
Object.keys(selects).forEach(function (key) {
return css.push(toCSS({ style: selects[key], selector: src_selector(id, key) }));
});
}
if (medias) {
Object.keys(medias).forEach(function (key) {
return css.push(key + '{' + deconstructedStyleToCSS(id, medias[key]).join('') + '}');
});
}
if (supports) {
Object.keys(supports).forEach(function (key) {
return css.push(key + '{' + deconstructedStyleToCSS(id, supports[key]).join('') + '}');
});
}
return css;
}
// this cache to track which rules have
// been inserted into the stylesheet
var inserted = styleSheet.inserted = {};
// and helpers to insert rules into said styleSheet
function insert(spec) {
if (!inserted[spec.id]) {
inserted[spec.id] = true;
var deconstructed = deconstruct(spec.style);
var rules = deconstructedStyleToCSS(spec.id, deconstructed);
inserted[spec.id] = src_isBrowser ? true : rules;
rules.forEach(function (cssRule) {
return styleSheet.insert(cssRule);
});
}
}
// a simple cache to store generated rules
var registered = styleSheet.registered = {};
function register(spec) {
if (!registered[spec.id]) {
registered[spec.id] = spec;
}
}
function _getRegistered(rule) {
if (isLikeRule(rule)) {
var ret = registered[idFor(rule)];
if (ret == null) {
throw new Error('[glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79');
}
return ret;
}
return rule;
}
// todo - perf
var ruleCache = {};
function toRule(spec) {
register(spec);
insert(spec);
if (ruleCache[spec.id]) {
return ruleCache[spec.id];
}
var ret = _defineProperty({}, 'data-css-' + spec.id, hasLabels ? spec.label || '' : '');
Object.defineProperty(ret, 'toString', {
enumerable: false, value: function value() {
return 'css-' + spec.id;
}
});
ruleCache[spec.id] = ret;
return ret;
}
function log() {
//eslint-disable-line no-unused-vars
console.log(this); //eslint-disable-line no-console
return this;
}
function isSelector(key) {
var possibles = [':', '.', '[', '>', ' '],
found = false,
ch = key.charAt(0);
for (var i = 0; i < possibles.length; i++) {
if (ch === possibles[i]) {
found = true;
break;
}
}
return found || key.indexOf('&') >= 0;
}
function joinSelectors(a, b) {
var as = splitSelector(a).map(function (a) {
return !(a.indexOf('&') >= 0) ? '&' + a : a;
});
var bs = splitSelector(b).map(function (b) {
return !(b.indexOf('&') >= 0) ? '&' + b : b;
});
return bs.reduce(function (arr, b) {
return arr.concat(as.map(function (a) {
return b.replace(/\&/g, a);
}));
}, []).join(',');
}
function joinMediaQueries(a, b) {
return a ? '@media ' + a.substring(6) + ' and ' + b.substring(6) : b;
}
function isMediaQuery(key) {
return key.indexOf('@media') === 0;
}
function isSupports(key) {
return key.indexOf('@supports') === 0;
}
function joinSupports(a, b) {
return a ? '@supports ' + a.substring(9) + ' and ' + b.substring(9) : b;
}
// flatten a nested array
function flatten(inArr) {
var arr = [];
for (var i = 0; i < inArr.length; i++) {
if (Array.isArray(inArr[i])) arr = arr.concat(flatten(inArr[i]));else arr = arr.concat(inArr[i]);
}
return arr;
}
var prefixedPseudoSelectors = {
'::placeholder': ['::-webkit-input-placeholder', '::-moz-placeholder', '::-ms-input-placeholder'],
':fullscreen': [':-webkit-full-screen', ':-moz-full-screen', ':-ms-fullscreen']
// mutable! modifies dest.
};function build(dest, _ref2) {
var _ref2$selector = _ref2.selector,
selector = _ref2$selector === undefined ? '' : _ref2$selector,
_ref2$mq = _ref2.mq,
mq = _ref2$mq === undefined ? '' : _ref2$mq,
_ref2$supp = _ref2.supp,
supp = _ref2$supp === undefined ? '' : _ref2$supp,
_ref2$src = _ref2.src,
src = _ref2$src === undefined ? {} : _ref2$src;
if (!Array.isArray(src)) {
src = [src];
}
src = flatten(src);
src.forEach(function (_src) {
if (isLikeRule(_src)) {
var reg = _getRegistered(_src);
if (reg.type !== 'css') {
throw new Error('cannot merge this rule');
}
_src = reg.style;
}
_src = clean(_src);
if (_src && _src.composes) {
build(dest, { selector: selector, mq: mq, supp: supp, src: _src.composes });
}
Object.keys(_src || {}).forEach(function (key) {
if (isSelector(key)) {
if (prefixedPseudoSelectors[key]) {
prefixedPseudoSelectors[key].forEach(function (p) {
return build(dest, { selector: joinSelectors(selector, p), mq: mq, supp: supp, src: _src[key] });
});
}
build(dest, { selector: joinSelectors(selector, key), mq: mq, supp: supp, src: _src[key] });
} else if (isMediaQuery(key)) {
build(dest, { selector: selector, mq: joinMediaQueries(mq, key), supp: supp, src: _src[key] });
} else if (isSupports(key)) {
build(dest, { selector: selector, mq: mq, supp: joinSupports(supp, key), src: _src[key] });
} else if (key === 'composes') {
// ignore, we already dealth with it
} else {
var _dest = dest;
if (supp) {
_dest[supp] = _dest[supp] || {};
_dest = _dest[supp];
}
if (mq) {
_dest[mq] = _dest[mq] || {};
_dest = _dest[mq];
}
if (selector) {
_dest[selector] = _dest[selector] || {};
_dest = _dest[selector];
}
if (key === 'label') {
if (hasLabels) {
dest.label = dest.label.concat(_src.label);
}
} else {
_dest[key] = _src[key];
}
}
});
});
}
function _css(rules) {
var style = { label: [] };
build(style, { src: rules }); // mutative! but worth it.
var spec = {
id: hashify(style),
style: style, label: hasLabels ? style.label.join('.') : '',
type: 'css'
};
return toRule(spec);
}
var nullrule = {
// 'data-css-nil': ''
};
Object.defineProperty(nullrule, 'toString', {
enumerable: false, value: function value() {
return 'css-nil';
}
});
var inputCaches = typeof WeakMap !== 'undefined' ? [nullrule, new WeakMap(), new WeakMap(), new WeakMap()] : [nullrule];
var warnedWeakMapError = false;
function multiIndexCache(fn) {
return function (args) {
if (inputCaches[args.length]) {
var coi = inputCaches[args.length];
var ctr = 0;
while (ctr < args.length - 1) {
if (!coi.has(args[ctr])) {
coi.set(args[ctr], new WeakMap());
}
coi = coi.get(args[ctr]);
ctr++;
}
if (coi.has(args[args.length - 1])) {
var ret = coi.get(args[ctr]);
if (registered[ret.toString().substring(4)]) {
// make sure it hasn't been flushed
return ret;
}
}
}
var value = fn(args);
if (inputCaches[args.length]) {
var _ctr = 0,
_coi = inputCaches[args.length];
while (_ctr < args.length - 1) {
_coi = _coi.get(args[_ctr]);
_ctr++;
}
try {
_coi.set(args[_ctr], value);
} catch (err) {
if (src_isDev && !warnedWeakMapError) {
var _console;
warnedWeakMapError = true;
(_console = console).warn.apply(_console, ['failed setting the WeakMap cache for args:'].concat(src__toConsumableArray(args))); // eslint-disable-line no-console
console.warn('this should NOT happen, please file a bug on the github repo.'); // eslint-disable-line no-console
}
}
}
return value;
};
}
var cachedCss = typeof WeakMap !== 'undefined' ? multiIndexCache(_css) : _css;
function css() {
for (var _len2 = arguments.length, rules = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
rules[_key2] = arguments[_key2];
}
if (rules[0] && rules[0].length && rules[0].raw) {
throw new Error('you forgot to include glamor/babel in your babel plugins.');
}
rules = clean(rules);
if (!rules) {
return nullrule;
}
return cachedCss(rules);
}
css.insert = function (css) {
var spec = {
id: hashify(css),
css: css,
type: 'raw'
};
register(spec);
if (!inserted[spec.id]) {
styleSheet.insert(spec.css);
inserted[spec.id] = src_isBrowser ? true : [spec.css];
}
};
var insertRule = css.insert;
css.global = function (selector, style) {
style = clean(style);
if (style) {
return css.insert(toCSS({ selector: selector, style: style }));
}
};
var insertGlobal = css.global;
function insertKeyframe(spec) {
if (!inserted[spec.id]) {
var inner = Object.keys(spec.keyframes).map(function (kf) {
var result = src_plugins.keyframes.transform({ id: spec.id, name: kf, style: spec.keyframes[kf] });
return result.name + '{' + createMarkupForStyles(result.style) + '}';
}).join('');
var rules = ['-webkit-', '-moz-', '-o-', ''].map(function (prefix) {
return '@' + prefix + 'keyframes ' + (spec.name + '_' + spec.id) + '{' + inner + '}';
});
rules.forEach(function (rule) {
return styleSheet.insert(rule);
});
inserted[spec.id] = src_isBrowser ? true : rules;
}
}
css.keyframes = function (name, kfs) {
if (!kfs) {
kfs = name, name = 'animation';
}
// do not ignore empty keyframe definitions for now.
kfs = clean(kfs) || {};
var spec = {
id: hashify({ name: name, kfs: kfs }),
type: 'keyframes',
name: name,
keyframes: kfs
};
register(spec);
insertKeyframe(spec);
return name + '_' + spec.id;
};
// we don't go all out for fonts as much, giving a simple font loading strategy
// use a fancier lib if you need moar power
css.fontFace = function (font) {
font = clean(font);
var spec = {
id: hashify(font),
type: 'font-face',
font: font
};
register(spec);
insertFontFace(spec);
return font.fontFamily;
};
var fontFace = css.fontFace;
var keyframes = css.keyframes;
function insertFontFace(spec) {
if (!inserted[spec.id]) {
var rule = '@font-face{' + createMarkupForStyles(spec.font) + '}';
styleSheet.insert(rule);
inserted[spec.id] = src_isBrowser ? true : [rule];
}
}
// rehydrate the insertion cache with ids sent from
// renderStatic / renderStaticOptimized
function rehydrate(ids) {
// load up ids
src___WEBPACK_IMPORTED_MODULE_0_object_assign___default()(inserted, ids.reduce(function (o, i) {
return o[i] = true, o;
}, {}));
// assume css loaded separately
}
// clears out the cache and empties the stylesheet
// best for tests, though there might be some value for SSR.
function flush() {
inserted = styleSheet.inserted = {};
registered = styleSheet.registered = {};
ruleCache = {};
styleSheet.flush();
styleSheet.inject();
}
var presets = {
mobile: '(min-width: 400px)',
Mobile: '@media (min-width: 400px)',
phablet: '(min-width: 550px)',
Phablet: '@media (min-width: 550px)',
tablet: '(min-width: 750px)',
Tablet: '@media (min-width: 750px)',
desktop: '(min-width: 1000px)',
Desktop: '@media (min-width: 1000px)',
hd: '(min-width: 1200px)',
Hd: '@media (min-width: 1200px)'
};
var src_style = css;
function select(selector) {
for (var _len3 = arguments.length, styles = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
styles[_key3 - 1] = arguments[_key3];
}
if (!selector) {
return src_style(styles);
}
return css(_defineProperty({}, selector, styles));
}
var $ = select;
function parent(selector) {
for (var _len4 = arguments.length, styles = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
styles[_key4 - 1] = arguments[_key4];
}
return css(_defineProperty({}, selector + ' &', styles));
}
var merge = css;
var compose = css;
function media(query) {
for (var _len5 = arguments.length, rules = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
rules[_key5 - 1] = arguments[_key5];
}
return css(_defineProperty({}, '@media ' + query, rules));
}
function pseudo(selector) {
for (var _len6 = arguments.length, styles = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
styles[_key6 - 1] = arguments[_key6];
}
return css(_defineProperty({}, selector, styles));
}
// allllll the pseudoclasses
function active(x) {
return pseudo(':active', x);
}
function any(x) {
return pseudo(':any', x);
}
function checked(x) {
return pseudo(':checked', x);
}
function disabled(x) {
return pseudo(':disabled', x);
}
function empty(x) {
return pseudo(':empty', x);
}
function enabled(x) {
return pseudo(':enabled', x);
}
function _default(x) {
return pseudo(':default', x); // note '_default' name
}
function first(x) {
return pseudo(':first', x);
}
function firstChild(x) {
return pseudo(':first-child', x);
}
function firstOfType(x) {
return pseudo(':first-of-type', x);
}
function fullscreen(x) {
return pseudo(':fullscreen', x);
}
function focus(x) {
return pseudo(':focus', x);
}
function hover(x) {
return pseudo(':hover', x);
}
function indeterminate(x) {
return pseudo(':indeterminate', x);
}
function inRange(x) {
return pseudo(':in-range', x);
}
function invalid(x) {
return pseudo(':invalid', x);
}
function lastChild(x) {
return pseudo(':last-child', x);
}
function lastOfType(x) {
return pseudo(':last-of-type', x);
}
function left(x) {
return pseudo(':left', x);
}
function link(x) {
return pseudo(':link', x);
}
function onlyChild(x) {
return pseudo(':only-child', x);
}
function onlyOfType(x) {
return pseudo(':only-of-type', x);
}
function optional(x) {
return pseudo(':optional', x);
}
function outOfRange(x) {
return pseudo(':out-of-range', x);
}
function readOnly(x) {
return pseudo(':read-only', x);
}
function readWrite(x) {
return pseudo(':read-write', x);
}
function required(x) {
return pseudo(':required', x);
}
function right(x) {
return pseudo(':right', x);
}
function root(x) {
return pseudo(':root', x);
}
function scope(x) {
return pseudo(':scope', x);
}
function target(x) {
return pseudo(':target', x);
}
function valid(x) {
return pseudo(':valid', x);
}
function visited(x) {
return pseudo(':visited', x);
}
// parameterized pseudoclasses
function dir(p, x) {
return pseudo(':dir(' + p + ')', x);
}
function lang(p, x) {
return pseudo(':lang(' + p + ')', x);
}
function not(p, x) {
// should this be a plugin?
var selector = p.split(',').map(function (x) {
return x.trim();
}).map(function (x) {
return ':not(' + x + ')';
});
if (selector.length === 1) {
return pseudo(':not(' + p + ')', x);
}
return select(selector.join(''), x);
}
function nthChild(p, x) {
return pseudo(':nth-child(' + p + ')', x);
}
function nthLastChild(p, x) {
return pseudo(':nth-last-child(' + p + ')', x);
}
function nthLastOfType(p, x) {
return pseudo(':nth-last-of-type(' + p + ')', x);
}
function nthOfType(p, x) {
return pseudo(':nth-of-type(' + p + ')', x);
}
// pseudoelements
function after(x) {
return pseudo('::after', x);
}
function before(x) {
return pseudo('::before', x);
}
function firstLetter(x) {
return pseudo('::first-letter', x);
}
function firstLine(x) {
return pseudo('::first-line', x);
}
function selection(x) {
return pseudo('::selection', x);
}
function backdrop(x) {
return pseudo('::backdrop', x);
}
function placeholder(x) {
// https://github.com/threepointone/glamor/issues/14
return css({ '::placeholder': x });
}
/*** helpers for web components ***/
// https://github.com/threepointone/glamor/issues/16
function cssFor() {
for (var _len7 = arguments.length, rules = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
rules[_key7] = arguments[_key7];
}
rules = clean(rules);
return rules ? rules.map(function (r) {
var style = { label: [] };
build(style, { src: r }); // mutative! but worth it.
return deconstructedStyleToCSS(hashify(style), deconstruct(style)).join('');
}).join('') : '';
}
function attribsFor() {
for (var _len8 = arguments.length, rules = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
rules[_key8] = arguments[_key8];
}
rules = clean(rules);
var htmlAttributes = rules ? rules.map(function (rule) {
idFor(rule); // throwaway check for rule
var key = Object.keys(rule)[0],
value = rule[key];
return key + '="' + (value || '') + '"';
}).join(' ') : '';
return htmlAttributes;
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
*/
var camelize = __webpack_require__(6);
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
*/
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
*/
var hyphenate = __webpack_require__(9);
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
*/
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
* @typechecks static-only
*/
/**
* Memoizes the return value of a function that accepts one string argument.
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var w = ["Webkit"];
var m = ["Moz"];
var ms = ["ms"];
var wm = ["Webkit", "Moz"];
var wms = ["Webkit", "ms"];
var wmms = ["Webkit", "Moz", "ms"];
exports.default = {
plugins: [],
prefixMap: { "appearance": wm, "userSelect": wmms, "textEmphasisPosition": w, "textEmphasis": w, "textEmphasisStyle": w, "textEmphasisColor": w, "boxDecorationBreak": w, "clipPath": w, "maskImage": w, "maskMode": w, "maskRepeat": w, "maskPosition": w, "maskClip": w, "maskOrigin": w, "maskSize": w, "maskComposite": w, "mask": w, "maskBorderSource": w, "maskBorderMode": w, "maskBorderSlice": w, "maskBorderWidth": w, "maskBorderOutset": w, "maskBorderRepeat": w, "maskBorder": w, "maskType": w, "textDecorationStyle": w, "textDecorationSkip": w, "textDecorationLine": w, "textDecorationColor": w, "filter": w, "fontFeatureSettings": w, "breakAfter": wmms, "breakBefore": wmms, "breakInside": wmms, "columnCount": wm, "columnFill": wm, "columnGap": wm, "columnRule": wm, "columnRuleColor": wm, "columnRuleStyle": wm, "columnRuleWidth": wm, "columns": wm, "columnSpan": wm, "columnWidth": wm, "flex": w, "flexBasis": w, "flexDirection": w, "flexGrow": w, "flexFlow": w, "flexShrink": w, "flexWrap": w, "alignContent": w, "alignItems": w, "alignSelf": w, "justifyContent": w, "order": w, "transform": w, "transformOrigin": w, "transformOriginX": w, "transformOriginY": w, "backfaceVisibility": w, "perspective": w, "perspectiveOrigin": w, "transformStyle": w, "transformOriginZ": w, "animation": w, "animationDelay": w, "animationDirection": w, "animationFillMode": w, "animationDuration": w, "animationIterationCount": w, "animationName": w, "animationPlayState": w, "animationTimingFunction": w, "backdropFilter": w, "fontKerning": w, "scrollSnapType": wms, "scrollSnapPointsX": wms, "scrollSnapPointsY": wms, "scrollSnapDestination": wms, "scrollSnapCoordinate": wms, "shapeImageThreshold": w, "shapeImageMargin": w, "shapeImageOutside": w, "hyphens": wmms, "flowInto": wms, "flowFrom": wms, "regionFragment": wms, "textAlignLast": m, "tabSize": m, "wrapFlow": ms, "wrapThrough": ms, "wrapMargin": ms, "gridTemplateColumns": ms, "gridTemplateRows": ms, "gridTemplateAreas": ms, "gridTemplate": ms, "gridAutoColumns": ms, "gridAutoRows": ms, "gridAutoFlow": ms, "grid": ms, "gridRowStart": ms, "gridColumnStart": ms, "gridRowEnd": ms, "gridRow": ms, "gridColumn": ms, "gridColumnEnd": ms, "gridColumnGap": ms, "gridRowGap": ms, "gridArea": ms, "gridGap": ms, "textSizeAdjust": wms, "borderImage": w, "borderImageOutset": w, "borderImageRepeat": w, "borderImageSlice": w, "borderImageSource": w, "borderImageWidth": w, "transitionDelay": w, "transitionDuration": w, "transitionProperty": w, "transitionTimingFunction": w }
};
module.exports = exports["default"];
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = prefixProperty;
var _capitalizeString = __webpack_require__(3);
var _capitalizeString2 = _interopRequireDefault(_capitalizeString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function prefixProperty(prefixProperties, property, style) {
if (prefixProperties.hasOwnProperty(property)) {
var requiredPrefixes = prefixProperties[property];
for (var i = 0, len = requiredPrefixes.length; i < len; ++i) {
style[requiredPrefixes[i] + (0, _capitalizeString2.default)(property)] = style[property];
}
}
}
module.exports = exports['default'];
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = prefixValue;
function prefixValue(plugins, property, value, style, metaData) {
for (var i = 0, len = plugins.length; i < len; ++i) {
var processedValue = plugins[i](property, value, style, metaData
// we can stop processing if a value is returned
// as all plugin criteria are unique
);if (processedValue) {
return processedValue;
}
}
}
module.exports = exports["default"];
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cursor;
var prefixes = ['-webkit-', '-moz-', ''];
var values = {
'zoom-in': true,
'zoom-out': true,
grab: true,
grabbing: true
};
function cursor(property, value) {
if (property === 'cursor' && values.hasOwnProperty(value)) {
return prefixes.map(function (prefix) {
return prefix + value;
});
}
}
module.exports = exports['default'];
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = crossFade;
var _isPrefixedValue = __webpack_require__(0);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// http://caniuse.com/#search=cross-fade
var prefixes = ['-webkit-', ''];
function crossFade(property, value) {
if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('cross-fade(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/cross-fade\(/g, prefix + 'cross-fade(');
});
}
}
module.exports = exports['default'];
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = filter;
var _isPrefixedValue = __webpack_require__(0);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// http://caniuse.com/#feat=css-filter-function
var prefixes = ['-webkit-', ''];
function filter(property, value) {
if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('filter(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/filter\(/g, prefix + 'filter(');
});
}
}
module.exports = exports['default'];
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = flex;
var values = {
flex: ['-webkit-box', '-moz-box', '-ms-flexbox', '-webkit-flex', 'flex'],
'inline-flex': ['-webkit-inline-box', '-moz-inline-box', '-ms-inline-flexbox', '-webkit-inline-flex', 'inline-flex']
};
function flex(property, value) {
if (property === 'display' && values.hasOwnProperty(value)) {
return values[value];
}
}
module.exports = exports['default'];
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = flexboxOld;
var alternativeValues = {
'space-around': 'justify',
'space-between': 'justify',
'flex-start': 'start',
'flex-end': 'end',
'wrap-reverse': 'multiple',
wrap: 'multiple'
};
var alternativeProps = {
alignItems: 'WebkitBoxAlign',
justifyContent: 'WebkitBoxPack',
flexWrap: 'WebkitBoxLines'
};
function flexboxOld(property, value, style) {
if (property === 'flexDirection' && typeof value === 'string') {
if (value.indexOf('column') > -1) {
style.WebkitBoxOrient = 'vertical';
} else {
style.WebkitBoxOrient = 'horizontal';
}
if (value.indexOf('reverse') > -1) {
style.WebkitBoxDirection = 'reverse';
} else {
style.WebkitBoxDirection = 'normal';
}
}
if (alternativeProps.hasOwnProperty(property)) {
style[alternativeProps[property]] = alternativeValues[value] || value;
}
}
module.exports = exports['default'];
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = gradient;
var _isPrefixedValue = __webpack_require__(0);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var prefixes = ['-webkit-', '-moz-', ''];
var values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;
function gradient(property, value) {
if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && values.test(value)) {
return prefixes.map(function (prefix) {
return prefix + value;
});
}
}
module.exports = exports['default'];
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = imageSet;
var _isPrefixedValue = __webpack_require__(0);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// http://caniuse.com/#feat=css-image-set
var prefixes = ['-webkit-', ''];
function imageSet(property, value) {
if (typeof value === 'string' && !(0, _isPrefixedValue2.default)(value) && value.indexOf('image-set(') > -1) {
return prefixes.map(function (prefix) {
return value.replace(/image-set\(/g, prefix + 'image-set(');
});
}
}
module.exports = exports['default'];
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = position;
function position(property, value) {
if (property === 'position' && value === 'sticky') {
return ['-webkit-sticky', 'sticky'];
}
}
module.exports = exports['default'];
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = sizing;
var prefixes = ['-webkit-', '-moz-', ''];
var properties = {
maxHeight: true,
maxWidth: true,
width: true,
height: true,
columnWidth: true,
minWidth: true,
minHeight: true
};
var values = {
'min-content': true,
'max-content': true,
'fill-available': true,
'fit-content': true,
'contain-floats': true
};
function sizing(property, value) {
if (properties.hasOwnProperty(property) && values.hasOwnProperty(value)) {
return prefixes.map(function (prefix) {
return prefix + value;
});
}
}
module.exports = exports['default'];
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = transition;
var _hyphenateProperty = __webpack_require__(24);
var _hyphenateProperty2 = _interopRequireDefault(_hyphenateProperty);
var _isPrefixedValue = __webpack_require__(0);
var _isPrefixedValue2 = _interopRequireDefault(_isPrefixedValue);
var _capitalizeString = __webpack_require__(3);
var _capitalizeString2 = _interopRequireDefault(_capitalizeString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var properties = {
transition: true,
transitionProperty: true,
WebkitTransition: true,
WebkitTransitionProperty: true,
MozTransition: true,
MozTransitionProperty: true
};
var prefixMapping = {
Webkit: '-webkit-',
Moz: '-moz-',
ms: '-ms-'
};
function prefixValue(value, propertyPrefixMap) {
if ((0, _isPrefixedValue2.default)(value)) {
return value;
}
// only split multi values, not cubic beziers
var multipleValues = value.split(/,(?![^()]*(?:\([^()]*\))?\))/g);
for (var i = 0, len = multipleValues.length; i < len; ++i) {
var singleValue = multipleValues[i];
var values = [singleValue];
for (var property in propertyPrefixMap) {
var dashCaseProperty = (0, _hyphenateProperty2.default)(property);
if (singleValue.indexOf(dashCaseProperty) > -1 && dashCaseProperty !== 'order') {
var prefixes = propertyPrefixMap[property];
for (var j = 0, pLen = prefixes.length; j < pLen; ++j) {
// join all prefixes and create a new value
values.unshift(singleValue.replace(dashCaseProperty, prefixMapping[prefixes[j]] + dashCaseProperty));
}
}
}
multipleValues[i] = values.join(',');
}
return multipleValues.join(',');
}
function transition(property, value, style, propertyPrefixMap) {
// also check for already prefixed transitions
if (typeof value === 'string' && properties.hasOwnProperty(property)) {
var outputValue = prefixValue(value, propertyPrefixMap
// if the property is already prefixed
);var webkitOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (val) {
return !/-moz-|-ms-/.test(val);
}).join(',');
if (property.indexOf('Webkit') > -1) {
return webkitOutput;
}
var mozOutput = outputValue.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function (val) {
return !/-webkit-|-ms-/.test(val);
}).join(',');
if (property.indexOf('Moz') > -1) {
return mozOutput;
}
style['Webkit' + (0, _capitalizeString2.default)(property)] = webkitOutput;
style['Moz' + (0, _capitalizeString2.default)(property)] = mozOutput;
return outputValue;
}
}
module.exports = exports['default'];
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = hyphenateProperty;
var _hyphenateStyleName = __webpack_require__(25);
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hyphenateProperty(property) {
return (0, _hyphenateStyleName2.default)(property);
}
module.exports = exports['default'];
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var uppercasePattern = /[A-Z]/g;
var msPattern = /^ms-/;
var cache = {};
function hyphenateStyleName(string) {
return string in cache
? cache[string]
: cache[string] = string
.replace(uppercasePattern, '-$&')
.toLowerCase()
.replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
/***/ })
/******/ ]);
});
//# sourceMappingURL=index.js.map