tac-play
Version:
My Webpack tac-play
1,760 lines (1,454 loc) • 222 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["MyWebpackWidget"] = factory(require("react"), require("react-dom"));
else
root["MyWebpackWidget"] = factory(root["React"], root["ReactDOM"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__4__) {
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, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // 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 = 11);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (false) { var throwOnDirectAccess, ReactIs; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(7)();
}
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]'
|| stringValue === '[object Date]'
|| isReactElement(value)
}
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneUnlessOtherwiseSpecified(value, options) {
return (options.clone !== false && options.isMergeableObject(value))
? deepmerge(emptyTarget(value), value, options)
: value
}
function defaultArrayMerge(target, source, options) {
return target.concat(source).map(function(element) {
return cloneUnlessOtherwiseSpecified(element, options)
})
}
function getMergeFunction(key, options) {
if (!options.customMerge) {
return deepmerge
}
var customMerge = options.customMerge(key);
return typeof customMerge === 'function' ? customMerge : deepmerge
}
function getEnumerableOwnPropertySymbols(target) {
return Object.getOwnPropertySymbols
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
return target.propertyIsEnumerable(symbol)
})
: []
}
function getKeys(target) {
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
}
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
});
}
getKeys(source).forEach(function(key) {
if (!options.isMergeableObject(source[key]) || !target[key]) {
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
} else {
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
}
});
return destination
}
function deepmerge(target, source, options) {
options = Object.assign({
arrayMerge: defaultArrayMerge,
isMergeableObject: isMergeableObject
}, options, {
cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified
});
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneUnlessOtherwiseSpecified(source, options)
} else if (sourceIsArray) {
return options.arrayMerge(target, source, options)
} else {
return mergeObject(target, source, options)
}
}
deepmerge.all = function deepmergeAll(array, options) {
if (!Array.isArray(array)) {
throw new Error('first argument should be an array')
}
return array.reduce(function(prev, next) {
return deepmerge(prev, next, options)
}, {})
};
var deepmerge_1 = deepmerge;
module.exports = deepmerge_1;
/***/ }),
/* 3 */,
/* 4 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var ReactIs = __webpack_require__(9);
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
function getStatics(component) {
if (ReactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
return targetComponent;
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
/***/ }),
/* 6 */,
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = __webpack_require__(8);
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module.exports = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
};
shim.isRequired = shim;
function getShim() {
return shim;
};
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(10);
} else {}
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.10.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports,"__esModule",{value:!0});
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"):
60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118,x=b?Symbol.for("react.scope"):60119;function y(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case t:case r:case d:return u}}}function z(a){return y(a)===m}
exports.typeOf=y;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===v||a.$$typeof===w||a.$$typeof===x)};exports.isAsyncMode=function(a){return z(a)||y(a)===l};exports.isConcurrentMode=z;exports.isContextConsumer=function(a){return y(a)===k};exports.isContextProvider=function(a){return y(a)===h};
exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return y(a)===n};exports.isFragment=function(a){return y(a)===e};exports.isLazy=function(a){return y(a)===t};exports.isMemo=function(a){return y(a)===r};exports.isPortal=function(a){return y(a)===d};exports.isProfiler=function(a){return y(a)===g};exports.isStrictMode=function(a){return y(a)===f};exports.isSuspense=function(a){return y(a)===p};
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react","amd":"react","root":"React"}
var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_require__(0);
var external_commonjs_react_commonjs2_react_amd_react_root_React_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_react_commonjs2_react_amd_react_root_React_);
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
var prop_types = __webpack_require__(1);
// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.m.js
function toVal(mix) {
var k, y, str='';
if (mix) {
if (typeof mix === 'object') {
if (!!mix.push) {
for (k=0; k < mix.length; k++) {
if (mix[k] && (y = toVal(mix[k]))) {
str && (str += ' ');
str += y;
}
}
} else {
for (k in mix) {
if (mix[k] && (y = toVal(k))) {
str && (str += ' ');
str += y;
}
}
}
} else if (typeof mix !== 'boolean' && !mix.call) {
str && (str += ' ');
str += mix;
}
}
return str;
}
/* harmony default export */ var clsx_m = (function () {
var i=0, x, str='';
while (i < arguments.length) {
if (x = toVal(arguments[i++])) {
str && (str += ' ');
str += x
}
}
return str;
});
// EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var hoist_non_react_statics_cjs = __webpack_require__(5);
var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs);
// CONCATENATED MODULE: ./node_modules/is-in-browser/dist/module.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; };
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
/* harmony default export */ var dist_module = (isBrowser);
// CONCATENATED MODULE: ./node_modules/tiny-warning/dist/tiny-warning.esm.js
var isProduction = "production" === 'production';
function warning(condition, message) {
if (!isProduction) {
if (condition) {
return;
}
var text = "Warning: " + message;
if (typeof console !== 'undefined') {
console.warn(text);
}
try {
throw Error(text);
} catch (x) {}
}
}
/* harmony default export */ var tiny_warning_esm = (warning);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
// CONCATENATED MODULE: ./node_modules/jss/dist/jss.esm.js
var plainObjectConstrurctor = {}.constructor;
function cloneStyle(style) {
if (style == null || typeof style !== 'object') return style;
if (Array.isArray(style)) return style.map(cloneStyle);
if (style.constructor !== plainObjectConstrurctor) return style;
var newStyle = {};
for (var name in style) {
newStyle[name] = cloneStyle(style[name]);
}
return newStyle;
}
/**
* Create a rule instance.
*/
function createRule(name, decl, options) {
if (name === void 0) {
name = 'unnamed';
}
var jss = options.jss;
var declCopy = cloneStyle(decl);
var rule = jss.plugins.onCreateRule(name, declCopy, options);
if (rule) return rule; // It is an at-rule and it has no instance.
if (name[0] === '@') {
false ? undefined : void 0;
}
return null;
}
var join = function join(value, by) {
var result = '';
for (var i = 0; i < value.length; i++) {
// Remove !important from the value, it will be readded later.
if (value[i] === '!important') break;
if (result) result += by;
result += value[i];
}
return result;
};
/**
* Converts array values to string.
*
* `margin: [['5px', '10px']]` > `margin: 5px 10px;`
* `border: ['1px', '2px']` > `border: 1px, 2px;`
* `margin: [['5px', '10px'], '!important']` > `margin: 5px 10px !important;`
* `color: ['red', !important]` > `color: red !important;`
*/
function toCssValue(value, ignoreImportant) {
if (ignoreImportant === void 0) {
ignoreImportant = false;
}
if (!Array.isArray(value)) return value;
var cssValue = ''; // Support space separated values via `[['5px', '10px']]`.
if (Array.isArray(value[0])) {
for (var i = 0; i < value.length; i++) {
if (value[i] === '!important') break;
if (cssValue) cssValue += ', ';
cssValue += join(value[i], ' ');
}
} else cssValue = join(value, ', '); // Add !important, because it was ignored.
if (!ignoreImportant && value[value.length - 1] === '!important') {
cssValue += ' !important';
}
return cssValue;
}
/**
* Indent a string.
* http://jsperf.com/array-join-vs-for
*/
function indentStr(str, indent) {
var result = '';
for (var index = 0; index < indent; index++) {
result += ' ';
}
return result + str;
}
/**
* Converts a Rule to CSS string.
*/
function toCss(selector, style, options) {
if (options === void 0) {
options = {};
}
var result = '';
if (!style) return result;
var _options = options,
_options$indent = _options.indent,
indent = _options$indent === void 0 ? 0 : _options$indent;
var fallbacks = style.fallbacks;
if (selector) indent++; // Apply fallbacks first.
if (fallbacks) {
// Array syntax {fallbacks: [{prop: value}]}
if (Array.isArray(fallbacks)) {
for (var index = 0; index < fallbacks.length; index++) {
var fallback = fallbacks[index];
for (var prop in fallback) {
var value = fallback[prop];
if (value != null) {
if (result) result += '\n';
result += "" + indentStr(prop + ": " + toCssValue(value) + ";", indent);
}
}
}
} else {
// Object syntax {fallbacks: {prop: value}}
for (var _prop in fallbacks) {
var _value = fallbacks[_prop];
if (_value != null) {
if (result) result += '\n';
result += "" + indentStr(_prop + ": " + toCssValue(_value) + ";", indent);
}
}
}
}
for (var _prop2 in style) {
var _value2 = style[_prop2];
if (_value2 != null && _prop2 !== 'fallbacks') {
if (result) result += '\n';
result += "" + indentStr(_prop2 + ": " + toCssValue(_value2) + ";", indent);
}
} // Allow empty style in this case, because properties will be added dynamically.
if (!result && !options.allowEmpty) return result; // When rule is being stringified before selector was defined.
if (!selector) return result;
indent--;
if (result) result = "\n" + result + "\n";
return indentStr(selector + " {" + result, indent) + indentStr('}', indent);
}
var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;
var nativeEscape = typeof CSS !== 'undefined' && CSS.escape;
var jss_esm_escape = (function (str) {
return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, '\\$1');
});
var BaseStyleRule =
/*#__PURE__*/
function () {
function BaseStyleRule(key, style, options) {
this.type = 'style';
this.key = void 0;
this.isProcessed = false;
this.style = void 0;
this.renderer = void 0;
this.renderable = void 0;
this.options = void 0;
var sheet = options.sheet,
Renderer = options.Renderer;
this.key = key;
this.options = options;
this.style = style;
if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer();
}
/**
* Get or set a style property.
*/
var _proto = BaseStyleRule.prototype;
_proto.prop = function prop(name, value, options) {
// It's a getter.
if (value === undefined) return this.style[name]; // Don't do anything if the value has not changed.
var force = options ? options.force : false;
if (!force && this.style[name] === value) return this;
var newValue = value;
if (!options || options.process !== false) {
newValue = this.options.jss.plugins.onChangeValue(value, name, this);
}
var isEmpty = newValue == null || newValue === false;
var isDefined = name in this.style; // Value is empty and wasn't defined before.
if (isEmpty && !isDefined && !force) return this; // We are going to remove this value.
var remove = isEmpty && isDefined;
if (remove) delete this.style[name];else this.style[name] = newValue; // Renderable is defined if StyleSheet option `link` is true.
if (this.renderable && this.renderer) {
if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue);
return this;
}
var sheet = this.options.sheet;
if (sheet && sheet.attached) {
false ? undefined : void 0;
}
return this;
};
return BaseStyleRule;
}();
var jss_esm_StyleRule =
/*#__PURE__*/
function (_BaseStyleRule) {
_inheritsLoose(StyleRule, _BaseStyleRule);
function StyleRule(key, style, options) {
var _this;
_this = _BaseStyleRule.call(this, key, style, options) || this;
_this.selectorText = void 0;
_this.id = void 0;
_this.renderable = void 0;
var selector = options.selector,
scoped = options.scoped,
sheet = options.sheet,
generateId = options.generateId;
if (selector) {
_this.selectorText = selector;
} else if (scoped !== false) {
_this.id = generateId(_assertThisInitialized(_assertThisInitialized(_this)), sheet);
_this.selectorText = "." + jss_esm_escape(_this.id);
}
return _this;
}
/**
* Set selector string.
* Attention: use this with caution. Most browsers didn't implement
* selectorText setter, so this may result in rerendering of entire Style Sheet.
*/
var _proto2 = StyleRule.prototype;
/**
* Apply rule to an element inline.
*/
_proto2.applyTo = function applyTo(renderable) {
var renderer = this.renderer;
if (renderer) {
var json = this.toJSON();
for (var prop in json) {
renderer.setProperty(renderable, prop, json[prop]);
}
}
return this;
}
/**
* Returns JSON representation of the rule.
* Fallbacks are not supported.
* Useful for inline styles.
*/
;
_proto2.toJSON = function toJSON() {
var json = {};
for (var prop in this.style) {
var value = this.style[prop];
if (typeof value !== 'object') json[prop] = value;else if (Array.isArray(value)) json[prop] = toCssValue(value);
}
return json;
}
/**
* Generates a CSS string.
*/
;
_proto2.toString = function toString(options) {
var sheet = this.options.sheet;
var link = sheet ? sheet.options.link : false;
var opts = link ? _extends({}, options, {
allowEmpty: true
}) : options;
return toCss(this.selectorText, this.style, opts);
};
_createClass(StyleRule, [{
key: "selector",
set: function set(selector) {
if (selector === this.selectorText) return;
this.selectorText = selector;
var renderer = this.renderer,
renderable = this.renderable;
if (!renderable || !renderer) return;
var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule.
if (!hasChanged) {
renderer.replaceRule(renderable, this);
}
}
/**
* Get selector string.
*/
,
get: function get() {
return this.selectorText;
}
}]);
return StyleRule;
}(BaseStyleRule);
var pluginStyleRule = {
onCreateRule: function onCreateRule(name, style, options) {
if (name[0] === '@' || options.parent && options.parent.type === 'keyframes') {
return null;
}
return new jss_esm_StyleRule(name, style, options);
}
};
var defaultToStringOptions = {
indent: 1,
children: true
};
var atRegExp = /@([\w-]+)/;
/**
* Conditional rule for @media, @supports
*/
var jss_esm_ConditionalRule =
/*#__PURE__*/
function () {
function ConditionalRule(key, styles, options) {
this.type = 'conditional';
this.at = void 0;
this.key = void 0;
this.rules = void 0;
this.options = void 0;
this.isProcessed = false;
this.renderable = void 0;
this.key = key;
var atMatch = key.match(atRegExp);
this.at = atMatch ? atMatch[1] : 'unknown';
this.options = options;
this.rules = new jss_esm_RuleList(_extends({}, options, {
parent: this
}));
for (var name in styles) {
this.rules.add(name, styles[name]);
}
this.rules.process();
}
/**
* Get a rule.
*/
var _proto = ConditionalRule.prototype;
_proto.getRule = function getRule(name) {
return this.rules.get(name);
}
/**
* Get index of a rule.
*/
;
_proto.indexOf = function indexOf(rule) {
return this.rules.indexOf(rule);
}
/**
* Create and register rule, run plugins.
*/
;
_proto.addRule = function addRule(name, style, options) {
var rule = this.rules.add(name, style, options);
if (!rule) return null;
this.options.jss.plugins.onProcessRule(rule);
return rule;
}
/**
* Generates a CSS string.
*/
;
_proto.toString = function toString(options) {
if (options === void 0) {
options = defaultToStringOptions;
}
if (options.indent == null) options.indent = defaultToStringOptions.indent;
if (options.children == null) options.children = defaultToStringOptions.children;
if (options.children === false) {
return this.key + " {}";
}
var children = this.rules.toString(options);
return children ? this.key + " {\n" + children + "\n}" : '';
};
return ConditionalRule;
}();
var keyRegExp = /@media|@supports\s+/;
var pluginConditionalRule = {
onCreateRule: function onCreateRule(key, styles, options) {
return keyRegExp.test(key) ? new jss_esm_ConditionalRule(key, styles, options) : null;
}
};
var defaultToStringOptions$1 = {
indent: 1,
children: true
};
var nameRegExp = /@keyframes\s+([\w-]+)/;
/**
* Rule for @keyframes
*/
var jss_esm_KeyframesRule =
/*#__PURE__*/
function () {
function KeyframesRule(key, frames, options) {
this.type = 'keyframes';
this.at = '@keyframes';
this.key = void 0;
this.name = void 0;
this.id = void 0;
this.rules = void 0;
this.options = void 0;
this.isProcessed = false;
this.renderable = void 0;
var nameMatch = key.match(nameRegExp);
if (nameMatch && nameMatch[1]) {
this.name = nameMatch[1];
} else {
this.name = 'noname';
false ? undefined : void 0;
}
this.key = this.type + "-" + this.name;
this.options = options;
var scoped = options.scoped,
sheet = options.sheet,
generateId = options.generateId;
this.id = scoped === false ? this.name : jss_esm_escape(generateId(this, sheet));
this.rules = new jss_esm_RuleList(_extends({}, options, {
parent: this
}));
for (var name in frames) {
this.rules.add(name, frames[name], _extends({}, options, {
parent: this
}));
}
this.rules.process();
}
/**
* Generates a CSS string.
*/
var _proto = KeyframesRule.prototype;
_proto.toString = function toString(options) {
if (options === void 0) {
options = defaultToStringOptions$1;
}
if (options.indent == null) options.indent = defaultToStringOptions$1.indent;
if (options.children == null) options.children = defaultToStringOptions$1.children;
if (options.children === false) {
return this.at + " " + this.id + " {}";
}
var children = this.rules.toString(options);
if (children) children = "\n" + children + "\n";
return this.at + " " + this.id + " {" + children + "}";
};
return KeyframesRule;
}();
var keyRegExp$1 = /@keyframes\s+/;
var refRegExp = /\$([\w-]+)/g;
var findReferencedKeyframe = function findReferencedKeyframe(val, keyframes) {
if (typeof val === 'string') {
return val.replace(refRegExp, function (match, name) {
if (name in keyframes) {
return keyframes[name];
}
false ? undefined : void 0;
return match;
});
}
return val;
};
/**
* Replace the reference for a animation name.
*/
var jss_esm_replaceRef = function replaceRef(style, prop, keyframes) {
var value = style[prop];
var refKeyframe = findReferencedKeyframe(value, keyframes);
if (refKeyframe !== value) {
style[prop] = refKeyframe;
}
};
var jss_esm_plugin = {
onCreateRule: function onCreateRule(key, frames, options) {
return typeof key === 'string' && keyRegExp$1.test(key) ? new jss_esm_KeyframesRule(key, frames, options) : null;
},
// Animation name ref replacer.
onProcessStyle: function onProcessStyle(style, rule, sheet) {
if (rule.type !== 'style' || !sheet) return style;
if ('animation-name' in style) jss_esm_replaceRef(style, 'animation-name', sheet.keyframes);
if ('animation' in style) jss_esm_replaceRef(style, 'animation', sheet.keyframes);
return style;
},
onChangeValue: function onChangeValue(val, prop, rule) {
var sheet = rule.options.sheet;
if (!sheet) {
return val;
}
switch (prop) {
case 'animation':
return findReferencedKeyframe(val, sheet.keyframes);
case 'animation-name':
return findReferencedKeyframe(val, sheet.keyframes);
default:
return val;
}
}
};
var jss_esm_KeyframeRule =
/*#__PURE__*/
function (_BaseStyleRule) {
_inheritsLoose(KeyframeRule, _BaseStyleRule);
function KeyframeRule() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _BaseStyleRule.call.apply(_BaseStyleRule, [this].concat(args)) || this;
_this.renderable = void 0;
return _this;
}
var _proto = KeyframeRule.prototype;
/**
* Generates a CSS string.
*/
_proto.toString = function toString(options) {
var sheet = this.options.sheet;
var link = sheet ? sheet.options.link : false;
var opts = link ? _extends({}, options, {
allowEmpty: true
}) : options;
return toCss(this.key, this.style, opts);
};
return KeyframeRule;
}(BaseStyleRule);
var pluginKeyframeRule = {
onCreateRule: function onCreateRule(key, style, options) {
if (options.parent && options.parent.type === 'keyframes') {
return new jss_esm_KeyframeRule(key, style, options);
}
return null;
}
};
var FontFaceRule =
/*#__PURE__*/
function () {
function FontFaceRule(key, style, options) {
this.type = 'font-face';
this.at = '@font-face';
this.key = void 0;
this.style = void 0;
this.options = void 0;
this.isProcessed = false;
this.renderable = void 0;
this.key = key;
this.style = style;
this.options = options;
}
/**
* Generates a CSS string.
*/
var _proto = FontFaceRule.prototype;
_proto.toString = function toString(options) {
if (Array.isArray(this.style)) {
var str = '';
for (var index = 0; index < this.style.length; index++) {
str += toCss(this.key, this.style[index]);
if (this.style[index + 1]) str += '\n';
}
return str;
}
return toCss(this.key, this.style, options);
};
return FontFaceRule;
}();
var pluginFontFaceRule = {
onCreateRule: function onCreateRule(key, style, options) {
return key === '@font-face' ? new FontFaceRule(key, style, options) : null;
}
};
var ViewportRule =
/*#__PURE__*/
function () {
function ViewportRule(key, style, options) {
this.type = 'viewport';
this.at = '@viewport';
this.key = void 0;
this.style = void 0;
this.options = void 0;
this.isProcessed = false;
this.renderable = void 0;
this.key = key;
this.style = style;
this.options = options;
}
/**
* Generates a CSS string.
*/
var _proto = ViewportRule.prototype;
_proto.toString = function toString(options) {
return toCss(this.key, this.style, options);
};
return ViewportRule;
}();
var pluginViewportRule = {
onCreateRule: function onCreateRule(key, style, options) {
return key === '@viewport' || key === '@-ms-viewport' ? new ViewportRule(key, style, options) : null;
}
};
var SimpleRule =
/*#__PURE__*/
function () {
function SimpleRule(key, value, options) {
this.type = 'simple';
this.key = void 0;
this.value = void 0;
this.options = void 0;
this.isProcessed = false;
this.renderable = void 0;
this.key = key;
this.value = value;
this.options = options;
}
/**
* Generates a CSS string.
*/
// eslint-disable-next-line no-unused-vars
var _proto = SimpleRule.prototype;
_proto.toString = function toString(options) {
if (Array.isArray(this.value)) {
var str = '';
for (var index = 0; index < this.value.length; index++) {
str += this.key + " " + this.value[index] + ";";
if (this.value[index + 1]) str += '\n';
}
return str;
}
return this.key + " " + this.value + ";";
};
return SimpleRule;
}();
var keysMap = {
'@charset': true,
'@import': true,
'@namespace': true
};
var pluginSimpleRule = {
onCreateRule: function onCreateRule(key, value, options) {
return key in keysMap ? new SimpleRule(key, value, options) : null;
}
};
var plugins = [pluginStyleRule, pluginConditionalRule, jss_esm_plugin, pluginKeyframeRule, pluginFontFaceRule, pluginViewportRule, pluginSimpleRule];
var defaultUpdateOptions = {
process: true
};
var forceUpdateOptions = {
force: true,
process: true
/**
* Contains rules objects and allows adding/removing etc.
* Is used for e.g. by `StyleSheet` or `ConditionalRule`.
*/
};
var jss_esm_RuleList =
/*#__PURE__*/
function () {
// Rules registry for access by .get() method.
// It contains the same rule registered by name and by selector.
// Original styles object.
// Used to ensure correct rules order.
function RuleList(options) {
this.map = {};
this.raw = {};
this.index = [];
this.options = void 0;
this.classes = void 0;
this.keyframes = void 0;
this.options = options;
this.classes = options.classes;
this.keyframes = options.keyframes;
}
/**
* Create and register rule.
*
* Will not render after Style Sheet was rendered the first time.
*/
var _proto = RuleList.prototype;
_proto.add = function add(key, decl, ruleOptions) {
var _this$options = this.options,
parent = _this$options.parent,
sheet = _this$options.sheet,
jss = _this$options.jss,
Renderer = _this$options.Renderer,
generateId = _this$options.generateId,
scoped = _this$options.scoped;
var options = _extends({
classes: this.classes,
parent: parent,
sheet: sheet,
jss: jss,
Renderer: Renderer,
generateId: generateId,
scoped: scoped
}, ruleOptions); // We need to save the original decl before creating the rule
// because cache plugin needs to use it as a key to return a cached rule.
this.raw[key] = decl;
if (key in this.classes) {
// For e.g. rules inside of @media container
options.selector = "." + jss_esm_escape(this.classes[key]);
}
var rule = createRule(key, decl, options);
if (!rule) return null;
this.register(rule);
var index = options.index === undefined ? this.index.length : options.index;
this.index.splice(index, 0, rule);
return rule;
}
/**
* Get a rule.
*/
;
_proto.get = function get(name) {
return this.map[name];
}
/**
* Delete a rule.
*/
;
_proto.remove = function remove(rule) {
this.unregister(rule);
delete this.raw[rule.key];
this.index.splice(this.indexOf(rule), 1);
}
/**
* Get index of a rule.
*/
;
_proto.indexOf = function indexOf(rule) {
return this.index.indexOf(rule);
}
/**
* Run `onProcessRule()` plugins on every rule.
*/
;
_proto.process = function process() {
var plugins$$1 = this.options.jss.plugins; // We need to clone array because if we modify the index somewhere else during a loop
// we end up with very hard-to-track-down side effects.
this.index.slice(0).forEach(plugins$$1.onProcessRule, plugins$$1);
}
/**
* Register a rule in `.map` and `.classes` maps.
*/
;
_proto.register = function register(rule) {
this.map[rule.key] = rule;
if (rule instanceof jss_esm_StyleRule) {
this.map[rule.selector] = rule;
if (rule.id) this.classes[rule.key] = rule.id;
} else if (rule instanceof jss_esm_KeyframesRule && this.keyframes) {
this.keyframes[rule.name] = rule.id;
}
}
/**
* Unregister a rule.
*/
;
_proto.unregister = function unregister(rule) {
delete this.map[rule.key];
if (rule instanceof jss_esm_StyleRule) {
delete this.map[rule.selector];
delete this.classes[rule.key];
} else if (rule instanceof jss_esm_KeyframesRule) {
delete this.keyframes[rule.name];
}
}
/**
* Update the function values with a new data.
*/
;
_proto.update = function update() {
var name;
var data;
var options;
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
name = arguments.length <= 0 ? undefined : arguments[0]; // $FlowFixMe
data = arguments.length <= 1 ? undefined : arguments[1]; // $FlowFixMe
options = arguments.length <= 2 ? undefined : arguments[2];
} else {
data = arguments.length <= 0 ? undefined : arguments[0]; // $FlowFixMe
options = arguments.length <= 1 ? undefined : arguments[1];
name = null;
}
if (name) {
this.onUpdate(data, this.get(name), options);
} else {
for (var index = 0; index < this.index.length; index++) {
this.onUpdate(data, this.index[index], options);
}
}
}
/**
* Execute plugins, update rule props.
*/
;
_proto.onUpdate = function onUpdate(data, rule, options) {
if (options === void 0) {
options = defaultUpdateOptions;
}
var _this$options2 = this.options,
plugins$$1 = _this$options2.jss.plugins,
sheet = _this$options2.sheet; // It is a rules container like for e.g. ConditionalRule.
if (rule.rules instanceof RuleList) {
rule.rules.update(data, options);
return;
}
var styleRule = rule;
var style = styleRule.style;
plugins$$1.onUpdate(data, rule, sheet, options); // We rely on a new `style` ref in case it was mutated during onUpdate hook.
if (options.process && style && style !== styleRule.style) {
// We need to run the plugins in case new `style` relies on syntax plugins.
plugins$$1.onProcessStyle(styleRule.style, styleRule, sheet); // Update and add props.
for (var prop in styleRule.style) {
var nextValue = styleRule.style[prop];
var prevValue = style[prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.
// We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.
if (nextValue !== prevValue) {
styleRule.prop(prop, nextValue, forceUpdateOptions);
}
} // Remove props.
for (var _prop in style) {
var _nextValue = styleRule.style[_prop];
var _prevValue = style[_prop]; // We need to use `force: true` because `rule.style` has been updated during onUpdate hook, so `rule.prop()` will not update the CSSOM rule.
// We do this comparison to avoid unneeded `rule.prop()` calls, since we have the old `style` object here.
if (_nextValue == null && _nextValue !== _prevValue) {
styleRule.prop(_prop, null, forceUpdateOptions);
}
}
}
}
/**
* Convert rules to a CSS string.
*/
;
_proto.toString = function toString(options) {
var str = '';
var sheet = this.options.sheet;
var link = sheet ? sheet.options.link : false;
for (var index = 0; index < this.index.length; index++) {
var rule = this.index[index];
var css = rule.toString(options); // No need to render an empty rule.
if (!css && !link) continue;
if (str) str += '\n';
str += css;
}
return str;
};
return RuleList;
}();
var jss_esm_StyleSheet =
/*#__PURE__*/
function () {
function StyleSheet(styles, options) {
this.options = void 0;
this.deployed = void 0;
this.attached = void 0;
this.rules = void 0;
this.renderer = void 0;
this.classes = void 0;
this.keyframes = void 0;
this.queue = void 0;
this.attached = false;
this.deployed = false;
this.classes = {};
this.keyframes = {};
this.options = _extends({}, options, {
sheet: this,
parent: this,
classes: this.classes,
keyframes: this.keyframes
});
if (options.Renderer) {
this.renderer = new options.Renderer(this);
}
this.rules = new jss_esm_RuleList(this.options);
for (var name in styles) {
this.rules.add(name, styles[name]);
}
this.rules.process();
}
/**
* Attach renderable to the render tree.
*/
var _proto = StyleSheet.prototype;
_proto.attach = function attach() {
if (this.attached) return this;
if (this.renderer) this.renderer.attach();
this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached.
if (!this.deployed) this.deploy();
return this;
}
/**
* Remove renderable from render tree.
*/
;
_proto.detach = function detach() {
if (!this.attached) return this;
if (this.renderer) this.renderer.detach();
this.attached = false;
return this;
}
/**
* Add a rule to the current stylesheet.
* Will insert a rule also after the stylesheet has been rendered first time.
*/
;
_proto.addRule = function addRule(name, decl, options) {
var queue = this.queue; // Plugins can create rules.
// In order to preserve the right order, we need to queue all `.addRule` calls,
// which happen after the first `rules.add()` call.
if (this.attached && !queue) this.queue = [];
var rule = this.rules.add(name, decl, options);
if (!rule) return null;
this.options.jss.plugins.onProcessRule(rule);
if (this.attached) {
if (!this.deployed) return rule; // Don't insert rule directly if there is no stringified version yet.
// It will be inserted all together when .attach is called.
if (queue) queue.push(rule);else {
this.insertRule(rule);
if (this.queue) {
this.queue.forEach(this.insertRule, this);
this.queue = undefined;
}
}
return rule;
} // We can't add rules to a detached style node.
// We will redeploy the sheet once user will attach it.
this.deployed = false;
return rule;
}
/**
* Insert rule into the StyleSheet
*/
;
_proto.insertRule = function insertRule(rule) {
if (this.renderer) {
this.renderer.insertRule(rule);
}