1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('jss')) :
|
3 | typeof define === 'function' && define.amd ? define(['exports', 'react', 'jss'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.reactJss = {}, global.React, global.jss));
|
5 | }(this, (function (exports, React, jss) { 'use strict';
|
6 |
|
7 | function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8 |
|
9 | var React__default = _interopDefaultLegacy(React);
|
10 |
|
11 | function _extends() {
|
12 | _extends = Object.assign || function (target) {
|
13 | for (var i = 1; i < arguments.length; i++) {
|
14 | var source = arguments[i];
|
15 |
|
16 | for (var key in source) {
|
17 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
18 | target[key] = source[key];
|
19 | }
|
20 | }
|
21 | }
|
22 |
|
23 | return target;
|
24 | };
|
25 |
|
26 | return _extends.apply(this, arguments);
|
27 | }
|
28 |
|
29 | function _objectWithoutPropertiesLoose(source, excluded) {
|
30 | if (source == null) return {};
|
31 | var target = {};
|
32 | var sourceKeys = Object.keys(source);
|
33 | var key, i;
|
34 |
|
35 | for (i = 0; i < sourceKeys.length; i++) {
|
36 | key = sourceKeys[i];
|
37 | if (excluded.indexOf(key) >= 0) continue;
|
38 | target[key] = source[key];
|
39 | }
|
40 |
|
41 | return target;
|
42 | }
|
43 |
|
44 | function getDefaultExportFromCjs (x) {
|
45 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
46 | }
|
47 |
|
48 | function createCommonjsModule(fn, basedir, module) {
|
49 | return module = {
|
50 | path: basedir,
|
51 | exports: {},
|
52 | require: function (path, base) {
|
53 | return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
54 | }
|
55 | }, fn(module, module.exports), module.exports;
|
56 | }
|
57 |
|
58 | function getAugmentedNamespace(n) {
|
59 | if (n.__esModule) return n;
|
60 | var a = Object.defineProperty({}, '__esModule', {value: true});
|
61 | Object.keys(n).forEach(function (k) {
|
62 | var d = Object.getOwnPropertyDescriptor(n, k);
|
63 | Object.defineProperty(a, k, d.get ? d : {
|
64 | enumerable: true,
|
65 | get: function () {
|
66 | return n[k];
|
67 | }
|
68 | });
|
69 | });
|
70 | return a;
|
71 | }
|
72 |
|
73 | function commonjsRequire () {
|
74 | throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
75 | }
|
76 |
|
77 | var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
78 | Object.defineProperty(exports,"__esModule",{value:!0});
|
79 | 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.concurrent_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,n=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):60115,r=b?Symbol.for("react.lazy"):
|
80 | 60116;function t(a){if("object"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}function u(a){return t(a)===l}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;
|
81 | exports.StrictMode=f;exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return u(a)};exports.isConcurrentMode=u;exports.isContextConsumer=function(a){return t(a)===k};exports.isContextProvider=function(a){return t(a)===h};
|
82 | exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===m};exports.isFragment=function(a){return t(a)===e};exports.isProfiler=function(a){return t(a)===g};exports.isPortal=function(a){return t(a)===d};exports.isStrictMode=function(a){return t(a)===f};
|
83 | });
|
84 |
|
85 | var reactIs_development = createCommonjsModule(function (module, exports) {
|
86 |
|
87 |
|
88 |
|
89 | {
|
90 | (function() {
|
91 |
|
92 | Object.defineProperty(exports, '__esModule', { value: true });
|
93 |
|
94 |
|
95 |
|
96 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
97 |
|
98 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
99 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
100 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
101 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
102 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
103 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
104 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
105 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
106 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
107 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
108 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
109 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
110 |
|
111 | function isValidElementType(type) {
|
112 | return typeof type === 'string' || typeof type === 'function' ||
|
113 |
|
114 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
|
115 | }
|
116 |
|
117 | |
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 | var lowPriorityWarning = function () {};
|
132 |
|
133 | {
|
134 | var printWarning = function (format) {
|
135 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
136 | args[_key - 1] = arguments[_key];
|
137 | }
|
138 |
|
139 | var argIndex = 0;
|
140 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
141 | return args[argIndex++];
|
142 | });
|
143 | if (typeof console !== 'undefined') {
|
144 | console.warn(message);
|
145 | }
|
146 | try {
|
147 |
|
148 |
|
149 |
|
150 | throw new Error(message);
|
151 | } catch (x) {}
|
152 | };
|
153 |
|
154 | lowPriorityWarning = function (condition, format) {
|
155 | if (format === undefined) {
|
156 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
157 | }
|
158 | if (!condition) {
|
159 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
160 | args[_key2 - 2] = arguments[_key2];
|
161 | }
|
162 |
|
163 | printWarning.apply(undefined, [format].concat(args));
|
164 | }
|
165 | };
|
166 | }
|
167 |
|
168 | var lowPriorityWarning$1 = lowPriorityWarning;
|
169 |
|
170 | function typeOf(object) {
|
171 | if (typeof object === 'object' && object !== null) {
|
172 | var $$typeof = object.$$typeof;
|
173 |
|
174 | switch ($$typeof) {
|
175 | case REACT_ELEMENT_TYPE:
|
176 | var type = object.type;
|
177 |
|
178 | switch (type) {
|
179 | case REACT_CONCURRENT_MODE_TYPE:
|
180 | case REACT_FRAGMENT_TYPE:
|
181 | case REACT_PROFILER_TYPE:
|
182 | case REACT_STRICT_MODE_TYPE:
|
183 | return type;
|
184 | default:
|
185 | var $$typeofType = type && type.$$typeof;
|
186 |
|
187 | switch ($$typeofType) {
|
188 | case REACT_CONTEXT_TYPE:
|
189 | case REACT_FORWARD_REF_TYPE:
|
190 | case REACT_PROVIDER_TYPE:
|
191 | return $$typeofType;
|
192 | default:
|
193 | return $$typeof;
|
194 | }
|
195 | }
|
196 | case REACT_PORTAL_TYPE:
|
197 | return $$typeof;
|
198 | }
|
199 | }
|
200 |
|
201 | return undefined;
|
202 | }
|
203 |
|
204 |
|
205 | var AsyncMode = REACT_CONCURRENT_MODE_TYPE;
|
206 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
207 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
208 | var ContextProvider = REACT_PROVIDER_TYPE;
|
209 | var Element = REACT_ELEMENT_TYPE;
|
210 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
211 | var Fragment = REACT_FRAGMENT_TYPE;
|
212 | var Profiler = REACT_PROFILER_TYPE;
|
213 | var Portal = REACT_PORTAL_TYPE;
|
214 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
215 |
|
216 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
217 |
|
218 |
|
219 | function isAsyncMode(object) {
|
220 | {
|
221 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
222 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
223 | lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
224 | }
|
225 | }
|
226 | return isConcurrentMode(object);
|
227 | }
|
228 | function isConcurrentMode(object) {
|
229 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
230 | }
|
231 | function isContextConsumer(object) {
|
232 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
233 | }
|
234 | function isContextProvider(object) {
|
235 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
236 | }
|
237 | function isElement(object) {
|
238 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
239 | }
|
240 | function isForwardRef(object) {
|
241 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
242 | }
|
243 | function isFragment(object) {
|
244 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
245 | }
|
246 | function isProfiler(object) {
|
247 | return typeOf(object) === REACT_PROFILER_TYPE;
|
248 | }
|
249 | function isPortal(object) {
|
250 | return typeOf(object) === REACT_PORTAL_TYPE;
|
251 | }
|
252 | function isStrictMode(object) {
|
253 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
254 | }
|
255 |
|
256 | exports.typeOf = typeOf;
|
257 | exports.AsyncMode = AsyncMode;
|
258 | exports.ConcurrentMode = ConcurrentMode;
|
259 | exports.ContextConsumer = ContextConsumer;
|
260 | exports.ContextProvider = ContextProvider;
|
261 | exports.Element = Element;
|
262 | exports.ForwardRef = ForwardRef;
|
263 | exports.Fragment = Fragment;
|
264 | exports.Profiler = Profiler;
|
265 | exports.Portal = Portal;
|
266 | exports.StrictMode = StrictMode;
|
267 | exports.isValidElementType = isValidElementType;
|
268 | exports.isAsyncMode = isAsyncMode;
|
269 | exports.isConcurrentMode = isConcurrentMode;
|
270 | exports.isContextConsumer = isContextConsumer;
|
271 | exports.isContextProvider = isContextProvider;
|
272 | exports.isElement = isElement;
|
273 | exports.isForwardRef = isForwardRef;
|
274 | exports.isFragment = isFragment;
|
275 | exports.isProfiler = isProfiler;
|
276 | exports.isPortal = isPortal;
|
277 | exports.isStrictMode = isStrictMode;
|
278 | })();
|
279 | }
|
280 | });
|
281 |
|
282 | var reactIs = createCommonjsModule(function (module) {
|
283 |
|
284 | {
|
285 | module.exports = reactIs_development;
|
286 | }
|
287 | });
|
288 |
|
289 | |
290 |
|
291 |
|
292 |
|
293 |
|
294 | var REACT_STATICS = {
|
295 | childContextTypes: true,
|
296 | contextType: true,
|
297 | contextTypes: true,
|
298 | defaultProps: true,
|
299 | displayName: true,
|
300 | getDefaultProps: true,
|
301 | getDerivedStateFromError: true,
|
302 | getDerivedStateFromProps: true,
|
303 | mixins: true,
|
304 | propTypes: true,
|
305 | type: true
|
306 | };
|
307 |
|
308 | var KNOWN_STATICS = {
|
309 | name: true,
|
310 | length: true,
|
311 | prototype: true,
|
312 | caller: true,
|
313 | callee: true,
|
314 | arguments: true,
|
315 | arity: true
|
316 | };
|
317 |
|
318 | var FORWARD_REF_STATICS = {
|
319 | '$$typeof': true,
|
320 | render: true
|
321 | };
|
322 |
|
323 | var TYPE_STATICS = {};
|
324 | TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
325 |
|
326 | var defineProperty = Object.defineProperty;
|
327 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
328 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
329 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
330 | var getPrototypeOf = Object.getPrototypeOf;
|
331 | var objectPrototype = Object.prototype;
|
332 |
|
333 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
334 | if (typeof sourceComponent !== 'string') {
|
335 |
|
336 |
|
337 | if (objectPrototype) {
|
338 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
339 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
340 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
341 | }
|
342 | }
|
343 |
|
344 | var keys = getOwnPropertyNames(sourceComponent);
|
345 |
|
346 | if (getOwnPropertySymbols) {
|
347 | keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
348 | }
|
349 |
|
350 | var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
|
351 | var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
|
352 |
|
353 | for (var i = 0; i < keys.length; ++i) {
|
354 | var key = keys[i];
|
355 | if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
356 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
357 | try {
|
358 |
|
359 | defineProperty(targetComponent, key, descriptor);
|
360 | } catch (e) {}
|
361 | }
|
362 | }
|
363 |
|
364 | return targetComponent;
|
365 | }
|
366 |
|
367 | return targetComponent;
|
368 | }
|
369 |
|
370 | var hoistNonReactStatics_cjs = hoistNonReactStatics;
|
371 |
|
372 | function warning(condition, message) {
|
373 | {
|
374 | if (condition) {
|
375 | return;
|
376 | }
|
377 |
|
378 | var text = "Warning: " + message;
|
379 |
|
380 | if (typeof console !== 'undefined') {
|
381 | console.warn(text);
|
382 | }
|
383 |
|
384 | try {
|
385 | throw Error(text);
|
386 | } catch (x) {}
|
387 | }
|
388 | }
|
389 |
|
390 | |
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 | var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
|
397 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
398 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
399 |
|
400 | function toObject(val) {
|
401 | if (val === null || val === undefined) {
|
402 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
403 | }
|
404 |
|
405 | return Object(val);
|
406 | }
|
407 |
|
408 | function shouldUseNative() {
|
409 | try {
|
410 | if (!Object.assign) {
|
411 | return false;
|
412 | }
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | var test1 = new String('abc');
|
418 | test1[5] = 'de';
|
419 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
420 | return false;
|
421 | }
|
422 |
|
423 |
|
424 | var test2 = {};
|
425 | for (var i = 0; i < 10; i++) {
|
426 | test2['_' + String.fromCharCode(i)] = i;
|
427 | }
|
428 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
429 | return test2[n];
|
430 | });
|
431 | if (order2.join('') !== '0123456789') {
|
432 | return false;
|
433 | }
|
434 |
|
435 |
|
436 | var test3 = {};
|
437 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
438 | test3[letter] = letter;
|
439 | });
|
440 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
441 | 'abcdefghijklmnopqrst') {
|
442 | return false;
|
443 | }
|
444 |
|
445 | return true;
|
446 | } catch (err) {
|
447 |
|
448 | return false;
|
449 | }
|
450 | }
|
451 |
|
452 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
453 | var from;
|
454 | var to = toObject(target);
|
455 | var symbols;
|
456 |
|
457 | for (var s = 1; s < arguments.length; s++) {
|
458 | from = Object(arguments[s]);
|
459 |
|
460 | for (var key in from) {
|
461 | if (hasOwnProperty.call(from, key)) {
|
462 | to[key] = from[key];
|
463 | }
|
464 | }
|
465 |
|
466 | if (getOwnPropertySymbols$1) {
|
467 | symbols = getOwnPropertySymbols$1(from);
|
468 | for (var i = 0; i < symbols.length; i++) {
|
469 | if (propIsEnumerable.call(from, symbols[i])) {
|
470 | to[symbols[i]] = from[symbols[i]];
|
471 | }
|
472 | }
|
473 | }
|
474 | }
|
475 |
|
476 | return to;
|
477 | };
|
478 |
|
479 | var objectAssign = Object.freeze({
|
480 | __proto__: null
|
481 | });
|
482 |
|
483 | |
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
491 |
|
492 | var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
493 |
|
494 | var printWarning = function() {};
|
495 |
|
496 | {
|
497 | var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
498 | var loggedTypeFailures = {};
|
499 |
|
500 | printWarning = function(text) {
|
501 | var message = 'Warning: ' + text;
|
502 | if (typeof console !== 'undefined') {
|
503 | console.error(message);
|
504 | }
|
505 | try {
|
506 |
|
507 |
|
508 |
|
509 | throw new Error(message);
|
510 | } catch (x) {}
|
511 | };
|
512 | }
|
513 |
|
514 | |
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
526 | {
|
527 | for (var typeSpecName in typeSpecs) {
|
528 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
529 | var error;
|
530 |
|
531 |
|
532 |
|
533 | try {
|
534 |
|
535 |
|
536 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
537 | var err = Error(
|
538 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
539 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
540 | );
|
541 | err.name = 'Invariant Violation';
|
542 | throw err;
|
543 | }
|
544 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
545 | } catch (ex) {
|
546 | error = ex;
|
547 | }
|
548 | if (error && !(error instanceof Error)) {
|
549 | printWarning(
|
550 | (componentName || 'React class') + ': type specification of ' +
|
551 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
552 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
553 | 'You may have forgotten to pass an argument to the type checker ' +
|
554 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
555 | 'shape all require an argument).'
|
556 | );
|
557 |
|
558 | }
|
559 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
560 |
|
561 |
|
562 | loggedTypeFailures[error.message] = true;
|
563 |
|
564 | var stack = getStack ? getStack() : '';
|
565 |
|
566 | printWarning(
|
567 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
568 | );
|
569 | }
|
570 | }
|
571 | }
|
572 | }
|
573 | }
|
574 |
|
575 | var checkPropTypes_1 = checkPropTypes;
|
576 |
|
577 | var assign = getAugmentedNamespace(objectAssign);
|
578 |
|
579 | var printWarning$1 = function() {};
|
580 |
|
581 | {
|
582 | printWarning$1 = function(text) {
|
583 | var message = 'Warning: ' + text;
|
584 | if (typeof console !== 'undefined') {
|
585 | console.error(message);
|
586 | }
|
587 | try {
|
588 |
|
589 |
|
590 |
|
591 | throw new Error(message);
|
592 | } catch (x) {}
|
593 | };
|
594 | }
|
595 |
|
596 | function emptyFunctionThatReturnsNull() {
|
597 | return null;
|
598 | }
|
599 |
|
600 | var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
601 |
|
602 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
603 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
604 |
|
605 | |
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 | function getIteratorFn(maybeIterable) {
|
620 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
621 | if (typeof iteratorFn === 'function') {
|
622 | return iteratorFn;
|
623 | }
|
624 | }
|
625 |
|
626 | |
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 | var ANONYMOUS = '<<anonymous>>';
|
674 |
|
675 |
|
676 |
|
677 | var ReactPropTypes = {
|
678 | array: createPrimitiveTypeChecker('array'),
|
679 | bool: createPrimitiveTypeChecker('boolean'),
|
680 | func: createPrimitiveTypeChecker('function'),
|
681 | number: createPrimitiveTypeChecker('number'),
|
682 | object: createPrimitiveTypeChecker('object'),
|
683 | string: createPrimitiveTypeChecker('string'),
|
684 | symbol: createPrimitiveTypeChecker('symbol'),
|
685 |
|
686 | any: createAnyTypeChecker(),
|
687 | arrayOf: createArrayOfTypeChecker,
|
688 | element: createElementTypeChecker(),
|
689 | instanceOf: createInstanceTypeChecker,
|
690 | node: createNodeChecker(),
|
691 | objectOf: createObjectOfTypeChecker,
|
692 | oneOf: createEnumTypeChecker,
|
693 | oneOfType: createUnionTypeChecker,
|
694 | shape: createShapeTypeChecker,
|
695 | exact: createStrictShapeTypeChecker,
|
696 | };
|
697 |
|
698 | |
699 |
|
700 |
|
701 |
|
702 |
|
703 | function is(x, y) {
|
704 |
|
705 | if (x === y) {
|
706 |
|
707 |
|
708 | return x !== 0 || 1 / x === 1 / y;
|
709 | } else {
|
710 |
|
711 | return x !== x && y !== y;
|
712 | }
|
713 | }
|
714 |
|
715 |
|
716 | |
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 | function PropTypeError(message) {
|
724 | this.message = message;
|
725 | this.stack = '';
|
726 | }
|
727 |
|
728 | PropTypeError.prototype = Error.prototype;
|
729 |
|
730 | function createChainableTypeChecker(validate) {
|
731 | {
|
732 | var manualPropTypeCallCache = {};
|
733 | var manualPropTypeWarningCount = 0;
|
734 | }
|
735 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
736 | componentName = componentName || ANONYMOUS;
|
737 | propFullName = propFullName || propName;
|
738 |
|
739 | if (secret !== ReactPropTypesSecret_1) {
|
740 | if (throwOnDirectAccess) {
|
741 |
|
742 | var err = new Error(
|
743 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
744 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
745 | 'Read more at http://fb.me/use-check-prop-types'
|
746 | );
|
747 | err.name = 'Invariant Violation';
|
748 | throw err;
|
749 | } else if ( typeof console !== 'undefined') {
|
750 |
|
751 | var cacheKey = componentName + ':' + propName;
|
752 | if (
|
753 | !manualPropTypeCallCache[cacheKey] &&
|
754 |
|
755 | manualPropTypeWarningCount < 3
|
756 | ) {
|
757 | printWarning$1(
|
758 | 'You are manually calling a React.PropTypes validation ' +
|
759 | 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
760 | 'and will throw in the standalone `prop-types` package. ' +
|
761 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
762 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
763 | );
|
764 | manualPropTypeCallCache[cacheKey] = true;
|
765 | manualPropTypeWarningCount++;
|
766 | }
|
767 | }
|
768 | }
|
769 | if (props[propName] == null) {
|
770 | if (isRequired) {
|
771 | if (props[propName] === null) {
|
772 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
773 | }
|
774 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
775 | }
|
776 | return null;
|
777 | } else {
|
778 | return validate(props, propName, componentName, location, propFullName);
|
779 | }
|
780 | }
|
781 |
|
782 | var chainedCheckType = checkType.bind(null, false);
|
783 | chainedCheckType.isRequired = checkType.bind(null, true);
|
784 |
|
785 | return chainedCheckType;
|
786 | }
|
787 |
|
788 | function createPrimitiveTypeChecker(expectedType) {
|
789 | function validate(props, propName, componentName, location, propFullName, secret) {
|
790 | var propValue = props[propName];
|
791 | var propType = getPropType(propValue);
|
792 | if (propType !== expectedType) {
|
793 |
|
794 |
|
795 |
|
796 | var preciseType = getPreciseType(propValue);
|
797 |
|
798 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
799 | }
|
800 | return null;
|
801 | }
|
802 | return createChainableTypeChecker(validate);
|
803 | }
|
804 |
|
805 | function createAnyTypeChecker() {
|
806 | return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
807 | }
|
808 |
|
809 | function createArrayOfTypeChecker(typeChecker) {
|
810 | function validate(props, propName, componentName, location, propFullName) {
|
811 | if (typeof typeChecker !== 'function') {
|
812 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
813 | }
|
814 | var propValue = props[propName];
|
815 | if (!Array.isArray(propValue)) {
|
816 | var propType = getPropType(propValue);
|
817 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
818 | }
|
819 | for (var i = 0; i < propValue.length; i++) {
|
820 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
821 | if (error instanceof Error) {
|
822 | return error;
|
823 | }
|
824 | }
|
825 | return null;
|
826 | }
|
827 | return createChainableTypeChecker(validate);
|
828 | }
|
829 |
|
830 | function createElementTypeChecker() {
|
831 | function validate(props, propName, componentName, location, propFullName) {
|
832 | var propValue = props[propName];
|
833 | if (!isValidElement(propValue)) {
|
834 | var propType = getPropType(propValue);
|
835 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
836 | }
|
837 | return null;
|
838 | }
|
839 | return createChainableTypeChecker(validate);
|
840 | }
|
841 |
|
842 | function createInstanceTypeChecker(expectedClass) {
|
843 | function validate(props, propName, componentName, location, propFullName) {
|
844 | if (!(props[propName] instanceof expectedClass)) {
|
845 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
846 | var actualClassName = getClassName(props[propName]);
|
847 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
848 | }
|
849 | return null;
|
850 | }
|
851 | return createChainableTypeChecker(validate);
|
852 | }
|
853 |
|
854 | function createEnumTypeChecker(expectedValues) {
|
855 | if (!Array.isArray(expectedValues)) {
|
856 | printWarning$1('Invalid argument supplied to oneOf, expected an instance of array.') ;
|
857 | return emptyFunctionThatReturnsNull;
|
858 | }
|
859 |
|
860 | function validate(props, propName, componentName, location, propFullName) {
|
861 | var propValue = props[propName];
|
862 | for (var i = 0; i < expectedValues.length; i++) {
|
863 | if (is(propValue, expectedValues[i])) {
|
864 | return null;
|
865 | }
|
866 | }
|
867 |
|
868 | var valuesString = JSON.stringify(expectedValues);
|
869 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
870 | }
|
871 | return createChainableTypeChecker(validate);
|
872 | }
|
873 |
|
874 | function createObjectOfTypeChecker(typeChecker) {
|
875 | function validate(props, propName, componentName, location, propFullName) {
|
876 | if (typeof typeChecker !== 'function') {
|
877 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
878 | }
|
879 | var propValue = props[propName];
|
880 | var propType = getPropType(propValue);
|
881 | if (propType !== 'object') {
|
882 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
883 | }
|
884 | for (var key in propValue) {
|
885 | if (propValue.hasOwnProperty(key)) {
|
886 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
887 | if (error instanceof Error) {
|
888 | return error;
|
889 | }
|
890 | }
|
891 | }
|
892 | return null;
|
893 | }
|
894 | return createChainableTypeChecker(validate);
|
895 | }
|
896 |
|
897 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
898 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
899 | printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') ;
|
900 | return emptyFunctionThatReturnsNull;
|
901 | }
|
902 |
|
903 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
904 | var checker = arrayOfTypeCheckers[i];
|
905 | if (typeof checker !== 'function') {
|
906 | printWarning$1(
|
907 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
908 | 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
909 | );
|
910 | return emptyFunctionThatReturnsNull;
|
911 | }
|
912 | }
|
913 |
|
914 | function validate(props, propName, componentName, location, propFullName) {
|
915 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
916 | var checker = arrayOfTypeCheckers[i];
|
917 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
918 | return null;
|
919 | }
|
920 | }
|
921 |
|
922 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
923 | }
|
924 | return createChainableTypeChecker(validate);
|
925 | }
|
926 |
|
927 | function createNodeChecker() {
|
928 | function validate(props, propName, componentName, location, propFullName) {
|
929 | if (!isNode(props[propName])) {
|
930 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
931 | }
|
932 | return null;
|
933 | }
|
934 | return createChainableTypeChecker(validate);
|
935 | }
|
936 |
|
937 | function createShapeTypeChecker(shapeTypes) {
|
938 | function validate(props, propName, componentName, location, propFullName) {
|
939 | var propValue = props[propName];
|
940 | var propType = getPropType(propValue);
|
941 | if (propType !== 'object') {
|
942 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
943 | }
|
944 | for (var key in shapeTypes) {
|
945 | var checker = shapeTypes[key];
|
946 | if (!checker) {
|
947 | continue;
|
948 | }
|
949 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
950 | if (error) {
|
951 | return error;
|
952 | }
|
953 | }
|
954 | return null;
|
955 | }
|
956 | return createChainableTypeChecker(validate);
|
957 | }
|
958 |
|
959 | function createStrictShapeTypeChecker(shapeTypes) {
|
960 | function validate(props, propName, componentName, location, propFullName) {
|
961 | var propValue = props[propName];
|
962 | var propType = getPropType(propValue);
|
963 | if (propType !== 'object') {
|
964 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
965 | }
|
966 |
|
967 |
|
968 | var allKeys = assign({}, props[propName], shapeTypes);
|
969 | for (var key in allKeys) {
|
970 | var checker = shapeTypes[key];
|
971 | if (!checker) {
|
972 | return new PropTypeError(
|
973 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
974 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
975 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
976 | );
|
977 | }
|
978 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
979 | if (error) {
|
980 | return error;
|
981 | }
|
982 | }
|
983 | return null;
|
984 | }
|
985 |
|
986 | return createChainableTypeChecker(validate);
|
987 | }
|
988 |
|
989 | function isNode(propValue) {
|
990 | switch (typeof propValue) {
|
991 | case 'number':
|
992 | case 'string':
|
993 | case 'undefined':
|
994 | return true;
|
995 | case 'boolean':
|
996 | return !propValue;
|
997 | case 'object':
|
998 | if (Array.isArray(propValue)) {
|
999 | return propValue.every(isNode);
|
1000 | }
|
1001 | if (propValue === null || isValidElement(propValue)) {
|
1002 | return true;
|
1003 | }
|
1004 |
|
1005 | var iteratorFn = getIteratorFn(propValue);
|
1006 | if (iteratorFn) {
|
1007 | var iterator = iteratorFn.call(propValue);
|
1008 | var step;
|
1009 | if (iteratorFn !== propValue.entries) {
|
1010 | while (!(step = iterator.next()).done) {
|
1011 | if (!isNode(step.value)) {
|
1012 | return false;
|
1013 | }
|
1014 | }
|
1015 | } else {
|
1016 |
|
1017 | while (!(step = iterator.next()).done) {
|
1018 | var entry = step.value;
|
1019 | if (entry) {
|
1020 | if (!isNode(entry[1])) {
|
1021 | return false;
|
1022 | }
|
1023 | }
|
1024 | }
|
1025 | }
|
1026 | } else {
|
1027 | return false;
|
1028 | }
|
1029 |
|
1030 | return true;
|
1031 | default:
|
1032 | return false;
|
1033 | }
|
1034 | }
|
1035 |
|
1036 | function isSymbol(propType, propValue) {
|
1037 |
|
1038 | if (propType === 'symbol') {
|
1039 | return true;
|
1040 | }
|
1041 |
|
1042 |
|
1043 | if (propValue['@@toStringTag'] === 'Symbol') {
|
1044 | return true;
|
1045 | }
|
1046 |
|
1047 |
|
1048 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
1049 | return true;
|
1050 | }
|
1051 |
|
1052 | return false;
|
1053 | }
|
1054 |
|
1055 |
|
1056 | function getPropType(propValue) {
|
1057 | var propType = typeof propValue;
|
1058 | if (Array.isArray(propValue)) {
|
1059 | return 'array';
|
1060 | }
|
1061 | if (propValue instanceof RegExp) {
|
1062 |
|
1063 |
|
1064 |
|
1065 | return 'object';
|
1066 | }
|
1067 | if (isSymbol(propType, propValue)) {
|
1068 | return 'symbol';
|
1069 | }
|
1070 | return propType;
|
1071 | }
|
1072 |
|
1073 |
|
1074 |
|
1075 | function getPreciseType(propValue) {
|
1076 | if (typeof propValue === 'undefined' || propValue === null) {
|
1077 | return '' + propValue;
|
1078 | }
|
1079 | var propType = getPropType(propValue);
|
1080 | if (propType === 'object') {
|
1081 | if (propValue instanceof Date) {
|
1082 | return 'date';
|
1083 | } else if (propValue instanceof RegExp) {
|
1084 | return 'regexp';
|
1085 | }
|
1086 | }
|
1087 | return propType;
|
1088 | }
|
1089 |
|
1090 |
|
1091 |
|
1092 | function getPostfixForTypeWarning(value) {
|
1093 | var type = getPreciseType(value);
|
1094 | switch (type) {
|
1095 | case 'array':
|
1096 | case 'object':
|
1097 | return 'an ' + type;
|
1098 | case 'boolean':
|
1099 | case 'date':
|
1100 | case 'regexp':
|
1101 | return 'a ' + type;
|
1102 | default:
|
1103 | return type;
|
1104 | }
|
1105 | }
|
1106 |
|
1107 |
|
1108 | function getClassName(propValue) {
|
1109 | if (!propValue.constructor || !propValue.constructor.name) {
|
1110 | return ANONYMOUS;
|
1111 | }
|
1112 | return propValue.constructor.name;
|
1113 | }
|
1114 |
|
1115 | ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
1116 | ReactPropTypes.PropTypes = ReactPropTypes;
|
1117 |
|
1118 | return ReactPropTypes;
|
1119 | };
|
1120 |
|
1121 | var propTypes = createCommonjsModule(function (module) {
|
1122 | |
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 | {
|
1130 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
1131 | Symbol.for &&
|
1132 | Symbol.for('react.element')) ||
|
1133 | 0xeac7;
|
1134 |
|
1135 | var isValidElement = function(object) {
|
1136 | return typeof object === 'object' &&
|
1137 | object !== null &&
|
1138 | object.$$typeof === REACT_ELEMENT_TYPE;
|
1139 | };
|
1140 |
|
1141 |
|
1142 |
|
1143 | var throwOnDirectAccess = true;
|
1144 | module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
|
1145 | }
|
1146 | });
|
1147 |
|
1148 | {
|
1149 | module.exports = require('./cjs/react-is.development.js');
|
1150 | }
|
1151 |
|
1152 | var reactIs$1 = Object.freeze({
|
1153 | __proto__: null
|
1154 | });
|
1155 |
|
1156 | var ReactIs = getAugmentedNamespace(reactIs$1);
|
1157 |
|
1158 | |
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 | var REACT_STATICS$1 = {
|
1164 | childContextTypes: true,
|
1165 | contextType: true,
|
1166 | contextTypes: true,
|
1167 | defaultProps: true,
|
1168 | displayName: true,
|
1169 | getDefaultProps: true,
|
1170 | getDerivedStateFromError: true,
|
1171 | getDerivedStateFromProps: true,
|
1172 | mixins: true,
|
1173 | propTypes: true,
|
1174 | type: true
|
1175 | };
|
1176 |
|
1177 | var KNOWN_STATICS$1 = {
|
1178 | name: true,
|
1179 | length: true,
|
1180 | prototype: true,
|
1181 | caller: true,
|
1182 | callee: true,
|
1183 | arguments: true,
|
1184 | arity: true
|
1185 | };
|
1186 |
|
1187 | var FORWARD_REF_STATICS$1 = {
|
1188 | '$$typeof': true,
|
1189 | render: true,
|
1190 | defaultProps: true,
|
1191 | displayName: true,
|
1192 | propTypes: true
|
1193 | };
|
1194 |
|
1195 | var MEMO_STATICS = {
|
1196 | '$$typeof': true,
|
1197 | compare: true,
|
1198 | defaultProps: true,
|
1199 | displayName: true,
|
1200 | propTypes: true,
|
1201 | type: true
|
1202 | };
|
1203 |
|
1204 | var TYPE_STATICS$1 = {};
|
1205 | TYPE_STATICS$1[ReactIs.ForwardRef] = FORWARD_REF_STATICS$1;
|
1206 |
|
1207 | function getStatics(component) {
|
1208 | if (ReactIs.isMemo(component)) {
|
1209 | return MEMO_STATICS;
|
1210 | }
|
1211 | return TYPE_STATICS$1[component['$$typeof']] || REACT_STATICS$1;
|
1212 | }
|
1213 |
|
1214 | var defineProperty$1 = Object.defineProperty;
|
1215 | var getOwnPropertyNames$1 = Object.getOwnPropertyNames;
|
1216 | var getOwnPropertySymbols$2 = Object.getOwnPropertySymbols;
|
1217 | var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
1218 | var getPrototypeOf$1 = Object.getPrototypeOf;
|
1219 | var objectPrototype$1 = Object.prototype;
|
1220 |
|
1221 | function hoistNonReactStatics$1(targetComponent, sourceComponent, blacklist) {
|
1222 | if (typeof sourceComponent !== 'string') {
|
1223 |
|
1224 |
|
1225 | if (objectPrototype$1) {
|
1226 | var inheritedComponent = getPrototypeOf$1(sourceComponent);
|
1227 | if (inheritedComponent && inheritedComponent !== objectPrototype$1) {
|
1228 | hoistNonReactStatics$1(targetComponent, inheritedComponent, blacklist);
|
1229 | }
|
1230 | }
|
1231 |
|
1232 | var keys = getOwnPropertyNames$1(sourceComponent);
|
1233 |
|
1234 | if (getOwnPropertySymbols$2) {
|
1235 | keys = keys.concat(getOwnPropertySymbols$2(sourceComponent));
|
1236 | }
|
1237 |
|
1238 | var targetStatics = getStatics(targetComponent);
|
1239 | var sourceStatics = getStatics(sourceComponent);
|
1240 |
|
1241 | for (var i = 0; i < keys.length; ++i) {
|
1242 | var key = keys[i];
|
1243 | if (!KNOWN_STATICS$1[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
1244 | var descriptor = getOwnPropertyDescriptor$1(sourceComponent, key);
|
1245 | try {
|
1246 |
|
1247 | defineProperty$1(targetComponent, key, descriptor);
|
1248 | } catch (e) {}
|
1249 | }
|
1250 | }
|
1251 |
|
1252 | return targetComponent;
|
1253 | }
|
1254 |
|
1255 | return targetComponent;
|
1256 | }
|
1257 |
|
1258 | var hoistNonReactStatics_cjs$1 = hoistNonReactStatics$1;
|
1259 |
|
1260 | var getDisplayName_1 = createCommonjsModule(function (module, exports) {
|
1261 |
|
1262 | Object.defineProperty(exports, "__esModule", {
|
1263 | value: true
|
1264 | });
|
1265 | exports.default = getDisplayName;
|
1266 | function getDisplayName(Component) {
|
1267 | return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
|
1268 | }
|
1269 | });
|
1270 |
|
1271 | var getDisplayName = getDefaultExportFromCjs(getDisplayName_1);
|
1272 |
|
1273 | function _defineProperty(obj, key, value) {
|
1274 | if (key in obj) {
|
1275 | Object.defineProperty(obj, key, {
|
1276 | value: value,
|
1277 | enumerable: true,
|
1278 | configurable: true,
|
1279 | writable: true
|
1280 | });
|
1281 | } else {
|
1282 | obj[key] = value;
|
1283 | }
|
1284 |
|
1285 | return obj;
|
1286 | }
|
1287 |
|
1288 | function _extends$1() {
|
1289 | _extends$1 = Object.assign || function (target) {
|
1290 | for (var i = 1; i < arguments.length; i++) {
|
1291 | var source = arguments[i];
|
1292 |
|
1293 | for (var key in source) {
|
1294 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1295 | target[key] = source[key];
|
1296 | }
|
1297 | }
|
1298 | }
|
1299 |
|
1300 | return target;
|
1301 | };
|
1302 |
|
1303 | return _extends$1.apply(this, arguments);
|
1304 | }
|
1305 |
|
1306 | function _inheritsLoose(subClass, superClass) {
|
1307 | subClass.prototype = Object.create(superClass.prototype);
|
1308 | subClass.prototype.constructor = subClass;
|
1309 | subClass.__proto__ = superClass;
|
1310 | }
|
1311 |
|
1312 | function _assertThisInitialized(self) {
|
1313 | if (self === void 0) {
|
1314 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
1315 | }
|
1316 |
|
1317 | return self;
|
1318 | }
|
1319 |
|
1320 | function isObject(obj) {
|
1321 | return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
1322 | }
|
1323 |
|
1324 | function createThemeProvider(context) {
|
1325 | var ThemeProvider =
|
1326 |
|
1327 | function (_React$Component) {
|
1328 | _inheritsLoose(ThemeProvider, _React$Component);
|
1329 |
|
1330 | function ThemeProvider() {
|
1331 | var _this;
|
1332 |
|
1333 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
1334 | args[_key] = arguments[_key];
|
1335 | }
|
1336 |
|
1337 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
1338 |
|
1339 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "cachedTheme", void 0);
|
1340 |
|
1341 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastOuterTheme", void 0);
|
1342 |
|
1343 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastTheme", void 0);
|
1344 |
|
1345 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderProvider", function (outerTheme) {
|
1346 | var children = _this.props.children;
|
1347 | return React__default['default'].createElement(context.Provider, {
|
1348 | value: _this.getTheme(outerTheme)
|
1349 | }, children);
|
1350 | });
|
1351 |
|
1352 | return _this;
|
1353 | }
|
1354 |
|
1355 | var _proto = ThemeProvider.prototype;
|
1356 |
|
1357 |
|
1358 | _proto.getTheme = function getTheme(outerTheme) {
|
1359 | if (this.props.theme !== this.lastTheme || outerTheme !== this.lastOuterTheme || !this.cachedTheme) {
|
1360 | this.lastOuterTheme = outerTheme;
|
1361 | this.lastTheme = this.props.theme;
|
1362 |
|
1363 | if (typeof this.lastTheme === 'function') {
|
1364 | var theme = this.props.theme;
|
1365 | this.cachedTheme = theme(outerTheme);
|
1366 | warning(isObject(this.cachedTheme), '[ThemeProvider] Please return an object from your theme function') ;
|
1367 | } else {
|
1368 | var _theme = this.props.theme;
|
1369 | warning(isObject(_theme), '[ThemeProvider] Please make your theme prop a plain object') ;
|
1370 | this.cachedTheme = outerTheme ? _extends$1({}, outerTheme, _theme) : _theme;
|
1371 | }
|
1372 | }
|
1373 |
|
1374 | return this.cachedTheme;
|
1375 | };
|
1376 |
|
1377 | _proto.render = function render() {
|
1378 | var children = this.props.children;
|
1379 |
|
1380 | if (!children) {
|
1381 | return null;
|
1382 | }
|
1383 |
|
1384 | return React__default['default'].createElement(context.Consumer, null, this.renderProvider);
|
1385 | };
|
1386 |
|
1387 | return ThemeProvider;
|
1388 | }(React__default['default'].Component);
|
1389 |
|
1390 | {
|
1391 | ThemeProvider.propTypes = {
|
1392 |
|
1393 | children: propTypes.node,
|
1394 | theme: propTypes.oneOfType([propTypes.shape({}), propTypes.func]).isRequired
|
1395 | };
|
1396 | }
|
1397 |
|
1398 | return ThemeProvider;
|
1399 | }
|
1400 |
|
1401 | function createWithTheme(context) {
|
1402 | return function hoc(Component) {
|
1403 | var withTheme = React__default['default'].forwardRef(function (props, ref) {
|
1404 | return React__default['default'].createElement(context.Consumer, null, function (theme) {
|
1405 | warning(isObject(theme), '[theming] Please use withTheme only with the ThemeProvider') ;
|
1406 | return React__default['default'].createElement(Component, _extends$1({
|
1407 | theme: theme,
|
1408 | ref: ref
|
1409 | }, props));
|
1410 | });
|
1411 | });
|
1412 |
|
1413 | {
|
1414 | withTheme.displayName = "WithTheme(" + getDisplayName(Component) + ")";
|
1415 | }
|
1416 |
|
1417 | hoistNonReactStatics_cjs$1(withTheme, Component);
|
1418 | return withTheme;
|
1419 | };
|
1420 | }
|
1421 |
|
1422 | function createUseTheme(context) {
|
1423 | var useTheme = function useTheme() {
|
1424 | var theme = React__default['default'].useContext(context);
|
1425 | warning(isObject(theme), '[theming] Please use useTheme only with the ThemeProvider') ;
|
1426 | return theme;
|
1427 | };
|
1428 |
|
1429 | return useTheme;
|
1430 | }
|
1431 |
|
1432 | function createTheming(context) {
|
1433 | return {
|
1434 | context: context,
|
1435 | withTheme: createWithTheme(context),
|
1436 | useTheme: createUseTheme(context),
|
1437 | ThemeProvider: createThemeProvider(context)
|
1438 | };
|
1439 | }
|
1440 |
|
1441 | var ThemeContext = React.createContext();
|
1442 |
|
1443 | var _createTheming = createTheming(ThemeContext),
|
1444 | withTheme = _createTheming.withTheme,
|
1445 | ThemeProvider = _createTheming.ThemeProvider,
|
1446 | useTheme = _createTheming.useTheme;
|
1447 |
|
1448 | var getDisplayName$1 = function getDisplayName(Component) {
|
1449 | return Component.displayName || Component.name || 'Component';
|
1450 | };
|
1451 |
|
1452 | var memoize = function memoize(fn) {
|
1453 | var lastArgs;
|
1454 | var lastResult;
|
1455 | return function () {
|
1456 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
1457 | args[_key] = arguments[_key];
|
1458 | }
|
1459 |
|
1460 | if (Array.isArray(lastArgs) && args.length === lastArgs.length) {
|
1461 | var isSame = true;
|
1462 |
|
1463 | for (var i = 0; i < args.length; i++) {
|
1464 | if (args[i] !== lastArgs[i]) {
|
1465 | isSame = false;
|
1466 | }
|
1467 | }
|
1468 |
|
1469 | if (isSame) {
|
1470 | return lastResult;
|
1471 | }
|
1472 | }
|
1473 |
|
1474 | lastArgs = args;
|
1475 | lastResult = fn.apply(void 0, args);
|
1476 | return lastResult;
|
1477 | };
|
1478 | };
|
1479 |
|
1480 | var mergeClasses = function mergeClasses(baseClasses, additionalClasses) {
|
1481 | var combinedClasses = _extends({}, baseClasses);
|
1482 |
|
1483 | for (var name in additionalClasses) {
|
1484 | combinedClasses[name] = name in combinedClasses ? combinedClasses[name] + " " + additionalClasses[name] : additionalClasses[name];
|
1485 | }
|
1486 |
|
1487 | return combinedClasses;
|
1488 | };
|
1489 |
|
1490 | |
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 | var index = Number.MIN_SAFE_INTEGER || -1e9;
|
1504 |
|
1505 | var getSheetIndex = function getSheetIndex() {
|
1506 | return index++;
|
1507 | };
|
1508 |
|
1509 | 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; };
|
1510 |
|
1511 | var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
|
1512 |
|
1513 | var JssContext = React.createContext({
|
1514 | classNamePrefix: '',
|
1515 | disableStylesGeneration: false
|
1516 | });
|
1517 |
|
1518 | var defaultManagers = new Map();
|
1519 | var getManager = function getManager(context, managerId) {
|
1520 |
|
1521 |
|
1522 | var managers = context.managers;
|
1523 |
|
1524 | if (managers) {
|
1525 | if (!managers[managerId]) {
|
1526 | managers[managerId] = new jss.SheetsManager();
|
1527 | }
|
1528 |
|
1529 | return managers[managerId];
|
1530 | }
|
1531 |
|
1532 | var manager = defaultManagers.get(managerId);
|
1533 |
|
1534 | if (!manager) {
|
1535 | manager = new jss.SheetsManager();
|
1536 | defaultManagers.set(managerId, manager);
|
1537 | }
|
1538 |
|
1539 | return manager;
|
1540 | };
|
1541 | var manageSheet = function manageSheet(options) {
|
1542 | var sheet = options.sheet,
|
1543 | context = options.context,
|
1544 | index = options.index,
|
1545 | theme = options.theme;
|
1546 |
|
1547 | if (!sheet) {
|
1548 | return;
|
1549 | }
|
1550 |
|
1551 | var manager = getManager(context, index);
|
1552 | manager.manage(theme);
|
1553 |
|
1554 | if (context.registry) {
|
1555 | context.registry.add(sheet);
|
1556 | }
|
1557 | };
|
1558 | var unmanageSheet = function unmanageSheet(options) {
|
1559 | if (!options.sheet) {
|
1560 | return;
|
1561 | }
|
1562 |
|
1563 | var manager = getManager(options.context, options.index);
|
1564 | manager.unmanage(options.theme);
|
1565 | };
|
1566 |
|
1567 | var now = Date.now();
|
1568 | var fnValuesNs = "fnValues" + now;
|
1569 | var fnRuleNs = "fnStyle" + ++now;
|
1570 |
|
1571 | var functionPlugin = function functionPlugin() {
|
1572 | return {
|
1573 | onCreateRule: function onCreateRule(name, decl, options) {
|
1574 | if (typeof decl !== 'function') return null;
|
1575 | var rule = jss.createRule(name, {}, options);
|
1576 | rule[fnRuleNs] = decl;
|
1577 | return rule;
|
1578 | },
|
1579 | onProcessStyle: function onProcessStyle(style, rule) {
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 | if (fnValuesNs in rule || fnRuleNs in rule) return style;
|
1585 | var fnValues = {};
|
1586 |
|
1587 | for (var prop in style) {
|
1588 | var value = style[prop];
|
1589 | if (typeof value !== 'function') continue;
|
1590 | delete style[prop];
|
1591 | fnValues[prop] = value;
|
1592 | }
|
1593 |
|
1594 | rule[fnValuesNs] = fnValues;
|
1595 | return style;
|
1596 | },
|
1597 | onUpdate: function onUpdate(data, rule, sheet, options) {
|
1598 | var styleRule = rule;
|
1599 | var fnRule = styleRule[fnRuleNs];
|
1600 |
|
1601 |
|
1602 | if (fnRule) {
|
1603 |
|
1604 |
|
1605 | styleRule.style = fnRule(data) || {};
|
1606 |
|
1607 | {
|
1608 | for (var prop in styleRule.style) {
|
1609 | if (typeof styleRule.style[prop] === 'function') {
|
1610 | warning(false, '[JSS] Function values inside function rules are not supported.') ;
|
1611 | break;
|
1612 | }
|
1613 | }
|
1614 | }
|
1615 | }
|
1616 |
|
1617 | var fnValues = styleRule[fnValuesNs];
|
1618 |
|
1619 | if (fnValues) {
|
1620 | for (var _prop in fnValues) {
|
1621 | styleRule.prop(_prop, fnValues[_prop](data), options);
|
1622 | }
|
1623 | }
|
1624 | }
|
1625 | };
|
1626 | };
|
1627 |
|
1628 | function symbolObservablePonyfill(root) {
|
1629 | var result;
|
1630 | var Symbol = root.Symbol;
|
1631 |
|
1632 | if (typeof Symbol === 'function') {
|
1633 | if (Symbol.observable) {
|
1634 | result = Symbol.observable;
|
1635 | } else {
|
1636 | result = Symbol('observable');
|
1637 | Symbol.observable = result;
|
1638 | }
|
1639 | } else {
|
1640 | result = '@@observable';
|
1641 | }
|
1642 |
|
1643 | return result;
|
1644 | }
|
1645 |
|
1646 |
|
1647 |
|
1648 | var root;
|
1649 |
|
1650 | if (typeof self !== 'undefined') {
|
1651 | root = self;
|
1652 | } else if (typeof window !== 'undefined') {
|
1653 | root = window;
|
1654 | } else if (typeof global !== 'undefined') {
|
1655 | root = global;
|
1656 | } else if (typeof module !== 'undefined') {
|
1657 | root = module;
|
1658 | } else {
|
1659 | root = Function('return this')();
|
1660 | }
|
1661 |
|
1662 | var result = symbolObservablePonyfill(root);
|
1663 |
|
1664 | var isObservable = function isObservable(value) {
|
1665 | return value && value[result] && value === value[result]();
|
1666 | };
|
1667 |
|
1668 | var observablePlugin = function observablePlugin(updateOptions) {
|
1669 | return {
|
1670 | onCreateRule: function onCreateRule(name, decl, options) {
|
1671 | if (!isObservable(decl)) return null;
|
1672 | var style$ = decl;
|
1673 | var rule = jss.createRule(name, {}, options);
|
1674 |
|
1675 |
|
1676 |
|
1677 | style$.subscribe(function (style) {
|
1678 | for (var prop in style) {
|
1679 | rule.prop(prop, style[prop], updateOptions);
|
1680 | }
|
1681 | });
|
1682 | return rule;
|
1683 | },
|
1684 | onProcessRule: function onProcessRule(rule) {
|
1685 | if (rule && rule.type !== 'style') return;
|
1686 | var styleRule = rule;
|
1687 | var style = styleRule.style;
|
1688 |
|
1689 | var _loop = function _loop(prop) {
|
1690 | var value = style[prop];
|
1691 | if (!isObservable(value)) return "continue";
|
1692 | delete style[prop];
|
1693 | value.subscribe({
|
1694 | next: function next(nextValue) {
|
1695 | styleRule.prop(prop, nextValue, updateOptions);
|
1696 | }
|
1697 | });
|
1698 | };
|
1699 |
|
1700 | for (var prop in style) {
|
1701 | var _ret = _loop(prop);
|
1702 |
|
1703 | if (_ret === "continue") continue;
|
1704 | }
|
1705 | }
|
1706 | };
|
1707 | };
|
1708 |
|
1709 | var semiWithNl = /;\n/;
|
1710 | |
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 | var parse = function parse(cssText) {
|
1718 | var style = {};
|
1719 | var split = cssText.split(semiWithNl);
|
1720 |
|
1721 | for (var i = 0; i < split.length; i++) {
|
1722 | var decl = (split[i] || '').trim();
|
1723 | if (!decl) continue;
|
1724 | var colonIndex = decl.indexOf(':');
|
1725 |
|
1726 | if (colonIndex === -1) {
|
1727 | warning(false, "[JSS] Malformed CSS string \"" + decl + "\"") ;
|
1728 | continue;
|
1729 | }
|
1730 |
|
1731 | var prop = decl.substr(0, colonIndex).trim();
|
1732 | var value = decl.substr(colonIndex + 1).trim();
|
1733 | style[prop] = value;
|
1734 | }
|
1735 |
|
1736 | return style;
|
1737 | };
|
1738 |
|
1739 | var onProcessRule = function onProcessRule(rule) {
|
1740 | if (typeof rule.style === 'string') {
|
1741 | rule.style = parse(rule.style);
|
1742 | }
|
1743 | };
|
1744 |
|
1745 | function templatePlugin() {
|
1746 | return {
|
1747 | onProcessRule: onProcessRule
|
1748 | };
|
1749 | }
|
1750 |
|
1751 | var at = '@global';
|
1752 | var atPrefix = '@global ';
|
1753 |
|
1754 | var GlobalContainerRule =
|
1755 |
|
1756 | function () {
|
1757 | function GlobalContainerRule(key, styles, options) {
|
1758 | this.type = 'global';
|
1759 | this.at = at;
|
1760 | this.isProcessed = false;
|
1761 | this.key = key;
|
1762 | this.options = options;
|
1763 | this.rules = new jss.RuleList(_extends({}, options, {
|
1764 | parent: this
|
1765 | }));
|
1766 |
|
1767 | for (var selector in styles) {
|
1768 | this.rules.add(selector, styles[selector]);
|
1769 | }
|
1770 |
|
1771 | this.rules.process();
|
1772 | }
|
1773 | |
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 | var _proto = GlobalContainerRule.prototype;
|
1779 |
|
1780 | _proto.getRule = function getRule(name) {
|
1781 | return this.rules.get(name);
|
1782 | }
|
1783 | |
1784 |
|
1785 |
|
1786 | ;
|
1787 |
|
1788 | _proto.addRule = function addRule(name, style, options) {
|
1789 | var rule = this.rules.add(name, style, options);
|
1790 | if (rule) this.options.jss.plugins.onProcessRule(rule);
|
1791 | return rule;
|
1792 | }
|
1793 | |
1794 |
|
1795 |
|
1796 | ;
|
1797 |
|
1798 | _proto.replaceRule = function replaceRule(name, style, options) {
|
1799 | var newRule = this.rules.replace(name, style, options);
|
1800 | if (newRule) this.options.jss.plugins.onProcessRule(newRule);
|
1801 | return newRule;
|
1802 | }
|
1803 | |
1804 |
|
1805 |
|
1806 | ;
|
1807 |
|
1808 | _proto.indexOf = function indexOf(rule) {
|
1809 | return this.rules.indexOf(rule);
|
1810 | }
|
1811 | |
1812 |
|
1813 |
|
1814 | ;
|
1815 |
|
1816 | _proto.toString = function toString(options) {
|
1817 | return this.rules.toString(options);
|
1818 | };
|
1819 |
|
1820 | return GlobalContainerRule;
|
1821 | }();
|
1822 |
|
1823 | var GlobalPrefixedRule =
|
1824 |
|
1825 | function () {
|
1826 | function GlobalPrefixedRule(key, style, options) {
|
1827 | this.type = 'global';
|
1828 | this.at = at;
|
1829 | this.isProcessed = false;
|
1830 | this.key = key;
|
1831 | this.options = options;
|
1832 | var selector = key.substr(atPrefix.length);
|
1833 | this.rule = options.jss.createRule(selector, style, _extends({}, options, {
|
1834 | parent: this
|
1835 | }));
|
1836 | }
|
1837 |
|
1838 | var _proto2 = GlobalPrefixedRule.prototype;
|
1839 |
|
1840 | _proto2.toString = function toString(options) {
|
1841 | return this.rule ? this.rule.toString(options) : '';
|
1842 | };
|
1843 |
|
1844 | return GlobalPrefixedRule;
|
1845 | }();
|
1846 |
|
1847 | var separatorRegExp = /\s*,\s*/g;
|
1848 |
|
1849 | function addScope(selector, scope) {
|
1850 | var parts = selector.split(separatorRegExp);
|
1851 | var scoped = '';
|
1852 |
|
1853 | for (var i = 0; i < parts.length; i++) {
|
1854 | scoped += scope + " " + parts[i].trim();
|
1855 | if (parts[i + 1]) scoped += ', ';
|
1856 | }
|
1857 |
|
1858 | return scoped;
|
1859 | }
|
1860 |
|
1861 | function handleNestedGlobalContainerRule(rule, sheet) {
|
1862 | var options = rule.options,
|
1863 | style = rule.style;
|
1864 | var rules = style ? style[at] : null;
|
1865 | if (!rules) return;
|
1866 |
|
1867 | for (var name in rules) {
|
1868 | sheet.addRule(name, rules[name], _extends({}, options, {
|
1869 | selector: addScope(name, rule.selector)
|
1870 | }));
|
1871 | }
|
1872 |
|
1873 | delete style[at];
|
1874 | }
|
1875 |
|
1876 | function handlePrefixedGlobalRule(rule, sheet) {
|
1877 | var options = rule.options,
|
1878 | style = rule.style;
|
1879 |
|
1880 | for (var prop in style) {
|
1881 | if (prop[0] !== '@' || prop.substr(0, at.length) !== at) continue;
|
1882 | var selector = addScope(prop.substr(at.length), rule.selector);
|
1883 | sheet.addRule(selector, style[prop], _extends({}, options, {
|
1884 | selector: selector
|
1885 | }));
|
1886 | delete style[prop];
|
1887 | }
|
1888 | }
|
1889 | |
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 | function jssGlobal() {
|
1895 | function onCreateRule(name, styles, options) {
|
1896 | if (!name) return null;
|
1897 |
|
1898 | if (name === at) {
|
1899 | return new GlobalContainerRule(name, styles, options);
|
1900 | }
|
1901 |
|
1902 | if (name[0] === '@' && name.substr(0, atPrefix.length) === atPrefix) {
|
1903 | return new GlobalPrefixedRule(name, styles, options);
|
1904 | }
|
1905 |
|
1906 | var parent = options.parent;
|
1907 |
|
1908 | if (parent) {
|
1909 | if (parent.type === 'global' || parent.options.parent && parent.options.parent.type === 'global') {
|
1910 | options.scoped = false;
|
1911 | }
|
1912 | }
|
1913 |
|
1914 | if (!options.selector && options.scoped === false) {
|
1915 | options.selector = name;
|
1916 | }
|
1917 |
|
1918 | return null;
|
1919 | }
|
1920 |
|
1921 | function onProcessRule(rule, sheet) {
|
1922 | if (rule.type !== 'style' || !sheet) return;
|
1923 | handleNestedGlobalContainerRule(rule, sheet);
|
1924 | handlePrefixedGlobalRule(rule, sheet);
|
1925 | }
|
1926 |
|
1927 | return {
|
1928 | onCreateRule: onCreateRule,
|
1929 | onProcessRule: onProcessRule
|
1930 | };
|
1931 | }
|
1932 |
|
1933 | var isObject$1 = function isObject(obj) {
|
1934 | return obj && typeof obj === 'object' && !Array.isArray(obj);
|
1935 | };
|
1936 |
|
1937 | var valueNs = "extendCurrValue" + Date.now();
|
1938 |
|
1939 | function mergeExtend(style, rule, sheet, newStyle) {
|
1940 | var extendType = typeof style.extend;
|
1941 |
|
1942 | if (extendType === 'string') {
|
1943 | if (!sheet) return;
|
1944 | var refRule = sheet.getRule(style.extend);
|
1945 | if (!refRule) return;
|
1946 |
|
1947 | if (refRule === rule) {
|
1948 | warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString()) ;
|
1949 | return;
|
1950 | }
|
1951 |
|
1952 | var parent = refRule.options.parent;
|
1953 |
|
1954 | if (parent) {
|
1955 | var originalStyle = parent.rules.raw[style.extend];
|
1956 | extend(originalStyle, rule, sheet, newStyle);
|
1957 | }
|
1958 |
|
1959 | return;
|
1960 | }
|
1961 |
|
1962 |
|
1963 | if (Array.isArray(style.extend)) {
|
1964 | for (var index = 0; index < style.extend.length; index++) {
|
1965 | var singleExtend = style.extend[index];
|
1966 | var singleStyle = typeof singleExtend === 'string' ? _extends({}, style, {
|
1967 | extend: singleExtend
|
1968 | }) : style.extend[index];
|
1969 | extend(singleStyle, rule, sheet, newStyle);
|
1970 | }
|
1971 |
|
1972 | return;
|
1973 | }
|
1974 |
|
1975 |
|
1976 | for (var prop in style.extend) {
|
1977 | if (prop === 'extend') {
|
1978 | extend(style.extend.extend, rule, sheet, newStyle);
|
1979 | continue;
|
1980 | }
|
1981 |
|
1982 | if (isObject$1(style.extend[prop])) {
|
1983 | if (!(prop in newStyle)) newStyle[prop] = {};
|
1984 | extend(style.extend[prop], rule, sheet, newStyle[prop]);
|
1985 | continue;
|
1986 | }
|
1987 |
|
1988 | newStyle[prop] = style.extend[prop];
|
1989 | }
|
1990 | }
|
1991 |
|
1992 | function mergeRest(style, rule, sheet, newStyle) {
|
1993 |
|
1994 | for (var prop in style) {
|
1995 | if (prop === 'extend') continue;
|
1996 |
|
1997 | if (isObject$1(newStyle[prop]) && isObject$1(style[prop])) {
|
1998 | extend(style[prop], rule, sheet, newStyle[prop]);
|
1999 | continue;
|
2000 | }
|
2001 |
|
2002 | if (isObject$1(style[prop])) {
|
2003 | newStyle[prop] = extend(style[prop], rule, sheet);
|
2004 | continue;
|
2005 | }
|
2006 |
|
2007 | newStyle[prop] = style[prop];
|
2008 | }
|
2009 | }
|
2010 | |
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 | function extend(style, rule, sheet, newStyle) {
|
2016 | if (newStyle === void 0) {
|
2017 | newStyle = {};
|
2018 | }
|
2019 |
|
2020 | mergeExtend(style, rule, sheet, newStyle);
|
2021 | mergeRest(style, rule, sheet, newStyle);
|
2022 | return newStyle;
|
2023 | }
|
2024 | |
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 | function jssExtend() {
|
2030 | function onProcessStyle(style, rule, sheet) {
|
2031 | if ('extend' in style) return extend(style, rule, sheet);
|
2032 | return style;
|
2033 | }
|
2034 |
|
2035 | function onChangeValue(value, prop, rule) {
|
2036 | if (prop !== 'extend') return value;
|
2037 |
|
2038 | if (value == null || value === false) {
|
2039 | for (var key in rule[valueNs]) {
|
2040 | rule.prop(key, null);
|
2041 | }
|
2042 |
|
2043 | rule[valueNs] = null;
|
2044 | return null;
|
2045 | }
|
2046 |
|
2047 | if (typeof value === 'object') {
|
2048 | for (var _key in value) {
|
2049 | rule.prop(_key, value[_key]);
|
2050 | }
|
2051 |
|
2052 | rule[valueNs] = value;
|
2053 | }
|
2054 |
|
2055 |
|
2056 | return null;
|
2057 | }
|
2058 |
|
2059 | return {
|
2060 | onProcessStyle: onProcessStyle,
|
2061 | onChangeValue: onChangeValue
|
2062 | };
|
2063 | }
|
2064 |
|
2065 | var separatorRegExp$1 = /\s*,\s*/g;
|
2066 | var parentRegExp = /&/g;
|
2067 | var refRegExp = /\$([\w-]+)/g;
|
2068 | |
2069 |
|
2070 |
|
2071 |
|
2072 | function jssNested() {
|
2073 |
|
2074 | function getReplaceRef(container, sheet) {
|
2075 | return function (match, key) {
|
2076 | var rule = container.getRule(key) || sheet && sheet.getRule(key);
|
2077 |
|
2078 | if (rule) {
|
2079 | return rule.selector;
|
2080 | }
|
2081 |
|
2082 | warning(false, "[JSS] Could not find the referenced rule \"" + key + "\" in \"" + (container.options.meta || container.toString()) + "\".") ;
|
2083 | return key;
|
2084 | };
|
2085 | }
|
2086 |
|
2087 | function replaceParentRefs(nestedProp, parentProp) {
|
2088 | var parentSelectors = parentProp.split(separatorRegExp$1);
|
2089 | var nestedSelectors = nestedProp.split(separatorRegExp$1);
|
2090 | var result = '';
|
2091 |
|
2092 | for (var i = 0; i < parentSelectors.length; i++) {
|
2093 | var parent = parentSelectors[i];
|
2094 |
|
2095 | for (var j = 0; j < nestedSelectors.length; j++) {
|
2096 | var nested = nestedSelectors[j];
|
2097 | if (result) result += ', ';
|
2098 |
|
2099 | result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + " " + nested;
|
2100 | }
|
2101 | }
|
2102 |
|
2103 | return result;
|
2104 | }
|
2105 |
|
2106 | function getOptions(rule, container, prevOptions) {
|
2107 |
|
2108 | if (prevOptions) return _extends({}, prevOptions, {
|
2109 | index: prevOptions.index + 1
|
2110 | });
|
2111 | var nestingLevel = rule.options.nestingLevel;
|
2112 | nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;
|
2113 |
|
2114 | var options = _extends({}, rule.options, {
|
2115 | nestingLevel: nestingLevel,
|
2116 | index: container.indexOf(rule) + 1
|
2117 |
|
2118 | });
|
2119 |
|
2120 | delete options.name;
|
2121 | return options;
|
2122 | }
|
2123 |
|
2124 | function onProcessStyle(style, rule, sheet) {
|
2125 | if (rule.type !== 'style') return style;
|
2126 | var styleRule = rule;
|
2127 | var container = styleRule.options.parent;
|
2128 | var options;
|
2129 | var replaceRef;
|
2130 |
|
2131 | for (var prop in style) {
|
2132 | var isNested = prop.indexOf('&') !== -1;
|
2133 | var isNestedConditional = prop[0] === '@';
|
2134 | if (!isNested && !isNestedConditional) continue;
|
2135 | options = getOptions(styleRule, container, options);
|
2136 |
|
2137 | if (isNested) {
|
2138 | var selector = replaceParentRefs(prop, styleRule.selector);
|
2139 |
|
2140 |
|
2141 | if (!replaceRef) replaceRef = getReplaceRef(container, sheet);
|
2142 |
|
2143 | selector = selector.replace(refRegExp, replaceRef);
|
2144 | var name = styleRule.key + "-" + prop;
|
2145 |
|
2146 | if ('replaceRule' in container) {
|
2147 |
|
2148 | container.replaceRule(name, style[prop], _extends({}, options, {
|
2149 | selector: selector
|
2150 | }));
|
2151 | } else {
|
2152 | container.addRule(name, style[prop], _extends({}, options, {
|
2153 | selector: selector
|
2154 | }));
|
2155 | }
|
2156 | } else if (isNestedConditional) {
|
2157 |
|
2158 | container.addRule(prop, {}, options).addRule(styleRule.key, style[prop], {
|
2159 | selector: styleRule.selector
|
2160 | });
|
2161 | }
|
2162 |
|
2163 | delete style[prop];
|
2164 | }
|
2165 |
|
2166 | return style;
|
2167 | }
|
2168 |
|
2169 | return {
|
2170 | onProcessStyle: onProcessStyle
|
2171 | };
|
2172 | }
|
2173 |
|
2174 | |
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 | function registerClass(rule, className) {
|
2183 |
|
2184 | if (!className) return true;
|
2185 |
|
2186 | if (Array.isArray(className)) {
|
2187 | for (var index = 0; index < className.length; index++) {
|
2188 | var isSetted = registerClass(rule, className[index]);
|
2189 | if (!isSetted) return false;
|
2190 | }
|
2191 |
|
2192 | return true;
|
2193 | }
|
2194 |
|
2195 |
|
2196 | if (className.indexOf(' ') > -1) {
|
2197 | return registerClass(rule, className.split(' '));
|
2198 | }
|
2199 |
|
2200 | var parent = rule.options.parent;
|
2201 |
|
2202 | if (className[0] === '$') {
|
2203 | var refRule = parent.getRule(className.substr(1));
|
2204 |
|
2205 | if (!refRule) {
|
2206 | warning(false, "[JSS] Referenced rule is not defined. \n" + rule.toString()) ;
|
2207 | return false;
|
2208 | }
|
2209 |
|
2210 | if (refRule === rule) {
|
2211 | warning(false, "[JSS] Cyclic composition detected. \n" + rule.toString()) ;
|
2212 | return false;
|
2213 | }
|
2214 |
|
2215 | parent.classes[rule.key] += " " + parent.classes[refRule.key];
|
2216 | return true;
|
2217 | }
|
2218 |
|
2219 | parent.classes[rule.key] += " " + className;
|
2220 | return true;
|
2221 | }
|
2222 | |
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 | function jssCompose() {
|
2228 | function onProcessStyle(style, rule) {
|
2229 | if (!('composes' in style)) return style;
|
2230 | registerClass(rule, style.composes);
|
2231 |
|
2232 | delete style.composes;
|
2233 | return style;
|
2234 | }
|
2235 |
|
2236 | return {
|
2237 | onProcessStyle: onProcessStyle
|
2238 | };
|
2239 | }
|
2240 |
|
2241 |
|
2242 | var uppercasePattern = /[A-Z]/g;
|
2243 | var msPattern = /^ms-/;
|
2244 | var cache = {};
|
2245 |
|
2246 | function toHyphenLower(match) {
|
2247 | return '-' + match.toLowerCase()
|
2248 | }
|
2249 |
|
2250 | function hyphenateStyleName(name) {
|
2251 | if (cache.hasOwnProperty(name)) {
|
2252 | return cache[name]
|
2253 | }
|
2254 |
|
2255 | var hName = name.replace(uppercasePattern, toHyphenLower);
|
2256 | return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
|
2257 | }
|
2258 |
|
2259 | |
2260 |
|
2261 |
|
2262 |
|
2263 | function convertCase(style) {
|
2264 | var converted = {};
|
2265 |
|
2266 | for (var prop in style) {
|
2267 | var key = prop.indexOf('--') === 0 ? prop : hyphenateStyleName(prop);
|
2268 | converted[key] = style[prop];
|
2269 | }
|
2270 |
|
2271 | if (style.fallbacks) {
|
2272 | if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);
|
2273 | }
|
2274 |
|
2275 | return converted;
|
2276 | }
|
2277 | |
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 | function camelCase() {
|
2283 | function onProcessStyle(style) {
|
2284 | if (Array.isArray(style)) {
|
2285 |
|
2286 | for (var index = 0; index < style.length; index++) {
|
2287 | style[index] = convertCase(style[index]);
|
2288 | }
|
2289 |
|
2290 | return style;
|
2291 | }
|
2292 |
|
2293 | return convertCase(style);
|
2294 | }
|
2295 |
|
2296 | function onChangeValue(value, prop, rule) {
|
2297 | if (prop.indexOf('--') === 0) {
|
2298 | return value;
|
2299 | }
|
2300 |
|
2301 | var hyphenatedProp = hyphenateStyleName(prop);
|
2302 |
|
2303 | if (prop === hyphenatedProp) return value;
|
2304 | rule.prop(hyphenatedProp, value);
|
2305 |
|
2306 | return null;
|
2307 | }
|
2308 |
|
2309 | return {
|
2310 | onProcessStyle: onProcessStyle,
|
2311 | onChangeValue: onChangeValue
|
2312 | };
|
2313 | }
|
2314 |
|
2315 | var px = jss.hasCSSTOMSupport && CSS ? CSS.px : 'px';
|
2316 | var ms = jss.hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
|
2317 | var percent = jss.hasCSSTOMSupport && CSS ? CSS.percent : '%';
|
2318 | |
2319 |
|
2320 |
|
2321 |
|
2322 | var defaultUnits = {
|
2323 |
|
2324 | 'animation-delay': ms,
|
2325 | 'animation-duration': ms,
|
2326 |
|
2327 | 'background-position': px,
|
2328 | 'background-position-x': px,
|
2329 | 'background-position-y': px,
|
2330 | 'background-size': px,
|
2331 |
|
2332 | border: px,
|
2333 | 'border-bottom': px,
|
2334 | 'border-bottom-left-radius': px,
|
2335 | 'border-bottom-right-radius': px,
|
2336 | 'border-bottom-width': px,
|
2337 | 'border-left': px,
|
2338 | 'border-left-width': px,
|
2339 | 'border-radius': px,
|
2340 | 'border-right': px,
|
2341 | 'border-right-width': px,
|
2342 | 'border-top': px,
|
2343 | 'border-top-left-radius': px,
|
2344 | 'border-top-right-radius': px,
|
2345 | 'border-top-width': px,
|
2346 | 'border-width': px,
|
2347 | 'border-block': px,
|
2348 | 'border-block-end': px,
|
2349 | 'border-block-end-width': px,
|
2350 | 'border-block-start': px,
|
2351 | 'border-block-start-width': px,
|
2352 | 'border-block-width': px,
|
2353 | 'border-inline': px,
|
2354 | 'border-inline-end': px,
|
2355 | 'border-inline-end-width': px,
|
2356 | 'border-inline-start': px,
|
2357 | 'border-inline-start-width': px,
|
2358 | 'border-inline-width': px,
|
2359 | 'border-start-start-radius': px,
|
2360 | 'border-start-end-radius': px,
|
2361 | 'border-end-start-radius': px,
|
2362 | 'border-end-end-radius': px,
|
2363 |
|
2364 | margin: px,
|
2365 | 'margin-bottom': px,
|
2366 | 'margin-left': px,
|
2367 | 'margin-right': px,
|
2368 | 'margin-top': px,
|
2369 | 'margin-block': px,
|
2370 | 'margin-block-end': px,
|
2371 | 'margin-block-start': px,
|
2372 | 'margin-inline': px,
|
2373 | 'margin-inline-end': px,
|
2374 | 'margin-inline-start': px,
|
2375 |
|
2376 | padding: px,
|
2377 | 'padding-bottom': px,
|
2378 | 'padding-left': px,
|
2379 | 'padding-right': px,
|
2380 | 'padding-top': px,
|
2381 | 'padding-block': px,
|
2382 | 'padding-block-end': px,
|
2383 | 'padding-block-start': px,
|
2384 | 'padding-inline': px,
|
2385 | 'padding-inline-end': px,
|
2386 | 'padding-inline-start': px,
|
2387 |
|
2388 | 'mask-position-x': px,
|
2389 | 'mask-position-y': px,
|
2390 | 'mask-size': px,
|
2391 |
|
2392 | height: px,
|
2393 | width: px,
|
2394 | 'min-height': px,
|
2395 | 'max-height': px,
|
2396 | 'min-width': px,
|
2397 | 'max-width': px,
|
2398 |
|
2399 | bottom: px,
|
2400 | left: px,
|
2401 | top: px,
|
2402 | right: px,
|
2403 | inset: px,
|
2404 | 'inset-block': px,
|
2405 | 'inset-block-end': px,
|
2406 | 'inset-block-start': px,
|
2407 | 'inset-inline': px,
|
2408 | 'inset-inline-end': px,
|
2409 | 'inset-inline-start': px,
|
2410 |
|
2411 | 'box-shadow': px,
|
2412 | 'text-shadow': px,
|
2413 |
|
2414 | 'column-gap': px,
|
2415 | 'column-rule': px,
|
2416 | 'column-rule-width': px,
|
2417 | 'column-width': px,
|
2418 |
|
2419 | 'font-size': px,
|
2420 | 'font-size-delta': px,
|
2421 | 'letter-spacing': px,
|
2422 | 'text-decoration-thickness': px,
|
2423 | 'text-indent': px,
|
2424 | 'text-stroke': px,
|
2425 | 'text-stroke-width': px,
|
2426 | 'word-spacing': px,
|
2427 |
|
2428 | motion: px,
|
2429 | 'motion-offset': px,
|
2430 |
|
2431 | outline: px,
|
2432 | 'outline-offset': px,
|
2433 | 'outline-width': px,
|
2434 |
|
2435 | perspective: px,
|
2436 | 'perspective-origin-x': percent,
|
2437 | 'perspective-origin-y': percent,
|
2438 |
|
2439 | 'transform-origin': percent,
|
2440 | 'transform-origin-x': percent,
|
2441 | 'transform-origin-y': percent,
|
2442 | 'transform-origin-z': percent,
|
2443 |
|
2444 | 'transition-delay': ms,
|
2445 | 'transition-duration': ms,
|
2446 |
|
2447 | 'vertical-align': px,
|
2448 | 'flex-basis': px,
|
2449 |
|
2450 | 'shape-margin': px,
|
2451 | size: px,
|
2452 | gap: px,
|
2453 |
|
2454 | grid: px,
|
2455 | 'grid-gap': px,
|
2456 | 'row-gap': px,
|
2457 | 'grid-row-gap': px,
|
2458 | 'grid-column-gap': px,
|
2459 | 'grid-template-rows': px,
|
2460 | 'grid-template-columns': px,
|
2461 | 'grid-auto-rows': px,
|
2462 | 'grid-auto-columns': px,
|
2463 |
|
2464 |
|
2465 | 'box-shadow-x': px,
|
2466 | 'box-shadow-y': px,
|
2467 | 'box-shadow-blur': px,
|
2468 | 'box-shadow-spread': px,
|
2469 | 'font-line-height': px,
|
2470 | 'text-shadow-x': px,
|
2471 | 'text-shadow-y': px,
|
2472 | 'text-shadow-blur': px
|
2473 | };
|
2474 | |
2475 |
|
2476 |
|
2477 |
|
2478 | function addCamelCasedVersion(obj) {
|
2479 | var regExp = /(-[a-z])/g;
|
2480 |
|
2481 | var replace = function replace(str) {
|
2482 | return str[1].toUpperCase();
|
2483 | };
|
2484 |
|
2485 | var newObj = {};
|
2486 |
|
2487 | for (var key in obj) {
|
2488 | newObj[key] = obj[key];
|
2489 | newObj[key.replace(regExp, replace)] = obj[key];
|
2490 | }
|
2491 |
|
2492 | return newObj;
|
2493 | }
|
2494 |
|
2495 | var units = addCamelCasedVersion(defaultUnits);
|
2496 | |
2497 |
|
2498 |
|
2499 |
|
2500 | function iterate(prop, value, options) {
|
2501 | if (value == null) return value;
|
2502 |
|
2503 | if (Array.isArray(value)) {
|
2504 | for (var i = 0; i < value.length; i++) {
|
2505 | value[i] = iterate(prop, value[i], options);
|
2506 | }
|
2507 | } else if (typeof value === 'object') {
|
2508 | if (prop === 'fallbacks') {
|
2509 | for (var innerProp in value) {
|
2510 | value[innerProp] = iterate(innerProp, value[innerProp], options);
|
2511 | }
|
2512 | } else {
|
2513 | for (var _innerProp in value) {
|
2514 | value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
|
2515 | }
|
2516 | }
|
2517 |
|
2518 | } else if (typeof value === 'number' && isNaN(value) === false) {
|
2519 | var unit = options[prop] || units[prop];
|
2520 |
|
2521 | if (unit && !(value === 0 && unit === px)) {
|
2522 | return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
|
2523 | }
|
2524 |
|
2525 | return value.toString();
|
2526 | }
|
2527 |
|
2528 | return value;
|
2529 | }
|
2530 | |
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 | function defaultUnit(options) {
|
2536 | if (options === void 0) {
|
2537 | options = {};
|
2538 | }
|
2539 |
|
2540 | var camelCasedOptions = addCamelCasedVersion(options);
|
2541 |
|
2542 | function onProcessStyle(style, rule) {
|
2543 | if (rule.type !== 'style') return style;
|
2544 |
|
2545 | for (var prop in style) {
|
2546 | style[prop] = iterate(prop, style[prop], camelCasedOptions);
|
2547 | }
|
2548 |
|
2549 | return style;
|
2550 | }
|
2551 |
|
2552 | function onChangeValue(value, prop) {
|
2553 | return iterate(prop, value, camelCasedOptions);
|
2554 | }
|
2555 |
|
2556 | return {
|
2557 | onProcessStyle: onProcessStyle,
|
2558 | onChangeValue: onChangeValue
|
2559 | };
|
2560 | }
|
2561 |
|
2562 | |
2563 |
|
2564 |
|
2565 |
|
2566 | var propArray = {
|
2567 | 'background-size': true,
|
2568 | 'background-position': true,
|
2569 | border: true,
|
2570 | 'border-bottom': true,
|
2571 | 'border-left': true,
|
2572 | 'border-top': true,
|
2573 | 'border-right': true,
|
2574 | 'border-radius': true,
|
2575 | 'border-image': true,
|
2576 | 'border-width': true,
|
2577 | 'border-style': true,
|
2578 | 'border-color': true,
|
2579 | 'box-shadow': true,
|
2580 | flex: true,
|
2581 | margin: true,
|
2582 | padding: true,
|
2583 | outline: true,
|
2584 | 'transform-origin': true,
|
2585 | transform: true,
|
2586 | transition: true
|
2587 | |
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 | };
|
2593 | var propArrayInObj = {
|
2594 | position: true,
|
2595 |
|
2596 | size: true
|
2597 |
|
2598 | |
2599 |
|
2600 |
|
2601 |
|
2602 | };
|
2603 | var propObj = {
|
2604 | padding: {
|
2605 | top: 0,
|
2606 | right: 0,
|
2607 | bottom: 0,
|
2608 | left: 0
|
2609 | },
|
2610 | margin: {
|
2611 | top: 0,
|
2612 | right: 0,
|
2613 | bottom: 0,
|
2614 | left: 0
|
2615 | },
|
2616 | background: {
|
2617 | attachment: null,
|
2618 | color: null,
|
2619 | image: null,
|
2620 | position: null,
|
2621 | repeat: null
|
2622 | },
|
2623 | border: {
|
2624 | width: null,
|
2625 | style: null,
|
2626 | color: null
|
2627 | },
|
2628 | 'border-top': {
|
2629 | width: null,
|
2630 | style: null,
|
2631 | color: null
|
2632 | },
|
2633 | 'border-right': {
|
2634 | width: null,
|
2635 | style: null,
|
2636 | color: null
|
2637 | },
|
2638 | 'border-bottom': {
|
2639 | width: null,
|
2640 | style: null,
|
2641 | color: null
|
2642 | },
|
2643 | 'border-left': {
|
2644 | width: null,
|
2645 | style: null,
|
2646 | color: null
|
2647 | },
|
2648 | outline: {
|
2649 | width: null,
|
2650 | style: null,
|
2651 | color: null
|
2652 | },
|
2653 | 'list-style': {
|
2654 | type: null,
|
2655 | position: null,
|
2656 | image: null
|
2657 | },
|
2658 | transition: {
|
2659 | property: null,
|
2660 | duration: null,
|
2661 | 'timing-function': null,
|
2662 | timingFunction: null,
|
2663 |
|
2664 | delay: null
|
2665 | },
|
2666 | animation: {
|
2667 | name: null,
|
2668 | duration: null,
|
2669 | 'timing-function': null,
|
2670 | timingFunction: null,
|
2671 |
|
2672 | delay: null,
|
2673 | 'iteration-count': null,
|
2674 | iterationCount: null,
|
2675 |
|
2676 | direction: null,
|
2677 | 'fill-mode': null,
|
2678 | fillMode: null,
|
2679 |
|
2680 | 'play-state': null,
|
2681 | playState: null
|
2682 |
|
2683 | },
|
2684 | 'box-shadow': {
|
2685 | x: 0,
|
2686 | y: 0,
|
2687 | blur: 0,
|
2688 | spread: 0,
|
2689 | color: null,
|
2690 | inset: null
|
2691 | },
|
2692 | 'text-shadow': {
|
2693 | x: 0,
|
2694 | y: 0,
|
2695 | blur: null,
|
2696 | color: null
|
2697 | |
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 | }
|
2703 | };
|
2704 | var customPropObj = {
|
2705 | border: {
|
2706 | radius: 'border-radius',
|
2707 | image: 'border-image',
|
2708 | width: 'border-width',
|
2709 | style: 'border-style',
|
2710 | color: 'border-color'
|
2711 | },
|
2712 | 'border-bottom': {
|
2713 | width: 'border-bottom-width',
|
2714 | style: 'border-bottom-style',
|
2715 | color: 'border-bottom-color'
|
2716 | },
|
2717 | 'border-top': {
|
2718 | width: 'border-top-width',
|
2719 | style: 'border-top-style',
|
2720 | color: 'border-top-color'
|
2721 | },
|
2722 | 'border-left': {
|
2723 | width: 'border-left-width',
|
2724 | style: 'border-left-style',
|
2725 | color: 'border-left-color'
|
2726 | },
|
2727 | 'border-right': {
|
2728 | width: 'border-right-width',
|
2729 | style: 'border-right-style',
|
2730 | color: 'border-right-color'
|
2731 | },
|
2732 | background: {
|
2733 | size: 'background-size',
|
2734 | image: 'background-image'
|
2735 | },
|
2736 | font: {
|
2737 | style: 'font-style',
|
2738 | variant: 'font-variant',
|
2739 | weight: 'font-weight',
|
2740 | stretch: 'font-stretch',
|
2741 | size: 'font-size',
|
2742 | family: 'font-family',
|
2743 | lineHeight: 'line-height',
|
2744 |
|
2745 | 'line-height': 'line-height'
|
2746 | },
|
2747 | flex: {
|
2748 | grow: 'flex-grow',
|
2749 | basis: 'flex-basis',
|
2750 | direction: 'flex-direction',
|
2751 | wrap: 'flex-wrap',
|
2752 | flow: 'flex-flow',
|
2753 | shrink: 'flex-shrink'
|
2754 | },
|
2755 | align: {
|
2756 | self: 'align-self',
|
2757 | items: 'align-items',
|
2758 | content: 'align-content'
|
2759 | },
|
2760 | grid: {
|
2761 | 'template-columns': 'grid-template-columns',
|
2762 | templateColumns: 'grid-template-columns',
|
2763 | 'template-rows': 'grid-template-rows',
|
2764 | templateRows: 'grid-template-rows',
|
2765 | 'template-areas': 'grid-template-areas',
|
2766 | templateAreas: 'grid-template-areas',
|
2767 | template: 'grid-template',
|
2768 | 'auto-columns': 'grid-auto-columns',
|
2769 | autoColumns: 'grid-auto-columns',
|
2770 | 'auto-rows': 'grid-auto-rows',
|
2771 | autoRows: 'grid-auto-rows',
|
2772 | 'auto-flow': 'grid-auto-flow',
|
2773 | autoFlow: 'grid-auto-flow',
|
2774 | row: 'grid-row',
|
2775 | column: 'grid-column',
|
2776 | 'row-start': 'grid-row-start',
|
2777 | rowStart: 'grid-row-start',
|
2778 | 'row-end': 'grid-row-end',
|
2779 | rowEnd: 'grid-row-end',
|
2780 | 'column-start': 'grid-column-start',
|
2781 | columnStart: 'grid-column-start',
|
2782 | 'column-end': 'grid-column-end',
|
2783 | columnEnd: 'grid-column-end',
|
2784 | area: 'grid-area',
|
2785 | gap: 'grid-gap',
|
2786 | 'row-gap': 'grid-row-gap',
|
2787 | rowGap: 'grid-row-gap',
|
2788 | 'column-gap': 'grid-column-gap',
|
2789 | columnGap: 'grid-column-gap'
|
2790 | }
|
2791 | };
|
2792 |
|
2793 |
|
2794 | |
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 | function mapValuesByProp(value, prop, rule) {
|
2804 | return value.map(function (item) {
|
2805 | return objectToArray(item, prop, rule, false, true);
|
2806 | });
|
2807 | }
|
2808 | |
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 | function processArray(value, prop, scheme, rule) {
|
2814 | if (scheme[prop] == null) return value;
|
2815 | if (value.length === 0) return [];
|
2816 | if (Array.isArray(value[0])) return processArray(value[0], prop, scheme, rule);
|
2817 |
|
2818 | if (typeof value[0] === 'object') {
|
2819 | return mapValuesByProp(value, prop, rule);
|
2820 | }
|
2821 |
|
2822 | return [value];
|
2823 | }
|
2824 | |
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 | function objectToArray(value, prop, rule, isFallback, isInArray) {
|
2830 | if (!(propObj[prop] || customPropObj[prop])) return [];
|
2831 | var result = [];
|
2832 |
|
2833 | if (customPropObj[prop]) {
|
2834 |
|
2835 | value = customPropsToStyle(value, rule, customPropObj[prop], isFallback);
|
2836 | }
|
2837 |
|
2838 |
|
2839 | if (Object.keys(value).length) {
|
2840 | for (var baseProp in propObj[prop]) {
|
2841 | if (value[baseProp]) {
|
2842 | if (Array.isArray(value[baseProp])) {
|
2843 | result.push(propArrayInObj[baseProp] === null ? value[baseProp] : value[baseProp].join(' '));
|
2844 | } else result.push(value[baseProp]);
|
2845 |
|
2846 | continue;
|
2847 | }
|
2848 |
|
2849 |
|
2850 | if (propObj[prop][baseProp] != null) {
|
2851 | result.push(propObj[prop][baseProp]);
|
2852 | }
|
2853 | }
|
2854 | }
|
2855 |
|
2856 | if (!result.length || isInArray) return result;
|
2857 | return [result];
|
2858 | }
|
2859 | |
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 | function customPropsToStyle(value, rule, customProps, isFallback) {
|
2865 | for (var prop in customProps) {
|
2866 | var propName = customProps[prop];
|
2867 |
|
2868 | if (typeof value[prop] !== 'undefined' && (isFallback || !rule.prop(propName))) {
|
2869 | var _styleDetector;
|
2870 |
|
2871 | var appendedValue = styleDetector((_styleDetector = {}, _styleDetector[propName] = value[prop], _styleDetector), rule)[propName];
|
2872 |
|
2873 | if (isFallback) rule.style.fallbacks[propName] = appendedValue;else rule.style[propName] = appendedValue;
|
2874 | }
|
2875 |
|
2876 |
|
2877 | delete value[prop];
|
2878 | }
|
2879 |
|
2880 | return value;
|
2881 | }
|
2882 | |
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 | function styleDetector(style, rule, isFallback) {
|
2888 | for (var prop in style) {
|
2889 | var value = style[prop];
|
2890 |
|
2891 | if (Array.isArray(value)) {
|
2892 |
|
2893 | if (!Array.isArray(value[0])) {
|
2894 | if (prop === 'fallbacks') {
|
2895 | for (var index = 0; index < style.fallbacks.length; index++) {
|
2896 | style.fallbacks[index] = styleDetector(style.fallbacks[index], rule, true);
|
2897 | }
|
2898 |
|
2899 | continue;
|
2900 | }
|
2901 |
|
2902 | style[prop] = processArray(value, prop, propArray, rule);
|
2903 |
|
2904 | if (!style[prop].length) delete style[prop];
|
2905 | }
|
2906 | } else if (typeof value === 'object') {
|
2907 | if (prop === 'fallbacks') {
|
2908 | style.fallbacks = styleDetector(style.fallbacks, rule, true);
|
2909 | continue;
|
2910 | }
|
2911 |
|
2912 | style[prop] = objectToArray(value, prop, rule, isFallback);
|
2913 |
|
2914 | if (!style[prop].length) delete style[prop];
|
2915 | }
|
2916 | else if (style[prop] === '') delete style[prop];
|
2917 | }
|
2918 |
|
2919 | return style;
|
2920 | }
|
2921 | |
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 | function jssExpand() {
|
2927 | function onProcessStyle(style, rule) {
|
2928 | if (!style || rule.type !== 'style') return style;
|
2929 |
|
2930 | if (Array.isArray(style)) {
|
2931 |
|
2932 | for (var index = 0; index < style.length; index++) {
|
2933 | style[index] = styleDetector(style[index], rule);
|
2934 | }
|
2935 |
|
2936 | return style;
|
2937 | }
|
2938 |
|
2939 | return styleDetector(style, rule);
|
2940 | }
|
2941 |
|
2942 | return {
|
2943 | onProcessStyle: onProcessStyle
|
2944 | };
|
2945 | }
|
2946 |
|
2947 | function _arrayLikeToArray(arr, len) {
|
2948 | if (len == null || len > arr.length) len = arr.length;
|
2949 |
|
2950 | for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
2951 | arr2[i] = arr[i];
|
2952 | }
|
2953 |
|
2954 | return arr2;
|
2955 | }
|
2956 |
|
2957 | function _arrayWithoutHoles(arr) {
|
2958 | if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
2959 | }
|
2960 |
|
2961 | function _iterableToArray(iter) {
|
2962 | if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
2963 | }
|
2964 |
|
2965 | function _unsupportedIterableToArray(o, minLen) {
|
2966 | if (!o) return;
|
2967 | if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
2968 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
2969 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
2970 | if (n === "Map" || n === "Set") return Array.from(n);
|
2971 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
2972 | }
|
2973 |
|
2974 | function _nonIterableSpread() {
|
2975 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
2976 | }
|
2977 |
|
2978 | function _toConsumableArray(arr) {
|
2979 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
2980 | }
|
2981 |
|
2982 |
|
2983 | var js = '';
|
2984 | var css = '';
|
2985 | var vendor = '';
|
2986 | var browser = '';
|
2987 | var isTouch = isBrowser && 'ontouchstart' in document.documentElement;
|
2988 |
|
2989 | if (isBrowser) {
|
2990 |
|
2991 |
|
2992 | var jsCssMap = {
|
2993 | Moz: '-moz-',
|
2994 | ms: '-ms-',
|
2995 | O: '-o-',
|
2996 | Webkit: '-webkit-'
|
2997 | };
|
2998 |
|
2999 | var _document$createEleme = document.createElement('p'),
|
3000 | style = _document$createEleme.style;
|
3001 |
|
3002 | var testProp = 'Transform';
|
3003 |
|
3004 | for (var key in jsCssMap) {
|
3005 | if (key + testProp in style) {
|
3006 | js = key;
|
3007 | css = jsCssMap[key];
|
3008 | break;
|
3009 | }
|
3010 | }
|
3011 |
|
3012 |
|
3013 | if (js === 'Webkit' && 'msHyphens' in style) {
|
3014 | js = 'ms';
|
3015 | css = jsCssMap.ms;
|
3016 | browser = 'edge';
|
3017 | }
|
3018 |
|
3019 |
|
3020 | if (js === 'Webkit' && '-apple-trailing-word' in style) {
|
3021 | vendor = 'apple';
|
3022 | }
|
3023 | }
|
3024 | |
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 | var prefix = {
|
3033 | js: js,
|
3034 | css: css,
|
3035 | vendor: vendor,
|
3036 | browser: browser,
|
3037 | isTouch: isTouch
|
3038 | };
|
3039 |
|
3040 | |
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 | function supportedKeyframes(key) {
|
3049 |
|
3050 | if (key[1] === '-') return key;
|
3051 |
|
3052 |
|
3053 | if (prefix.js === 'ms') return key;
|
3054 | return "@" + prefix.css + "keyframes" + key.substr(10);
|
3055 | }
|
3056 |
|
3057 |
|
3058 |
|
3059 | var appearence = {
|
3060 | noPrefill: ['appearance'],
|
3061 | supportedProperty: function supportedProperty(prop) {
|
3062 | if (prop !== 'appearance') return false;
|
3063 | if (prefix.js === 'ms') return "-webkit-" + prop;
|
3064 | return prefix.css + prop;
|
3065 | }
|
3066 | };
|
3067 |
|
3068 |
|
3069 |
|
3070 | var colorAdjust = {
|
3071 | noPrefill: ['color-adjust'],
|
3072 | supportedProperty: function supportedProperty(prop) {
|
3073 | if (prop !== 'color-adjust') return false;
|
3074 | if (prefix.js === 'Webkit') return prefix.css + "print-" + prop;
|
3075 | return prop;
|
3076 | }
|
3077 | };
|
3078 |
|
3079 | var regExp = /[-\s]+(.)?/g;
|
3080 | |
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 | function toUpper(match, c) {
|
3090 | return c ? c.toUpperCase() : '';
|
3091 | }
|
3092 | |
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 | function camelize(str) {
|
3102 | return str.replace(regExp, toUpper);
|
3103 | }
|
3104 |
|
3105 | |
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 | function pascalize(str) {
|
3114 | return camelize("-" + str);
|
3115 | }
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 | var mask = {
|
3121 | noPrefill: ['mask'],
|
3122 | supportedProperty: function supportedProperty(prop, style) {
|
3123 | if (!/^mask/.test(prop)) return false;
|
3124 |
|
3125 | if (prefix.js === 'Webkit') {
|
3126 | var longhand = 'mask-image';
|
3127 |
|
3128 | if (camelize(longhand) in style) {
|
3129 | return prop;
|
3130 | }
|
3131 |
|
3132 | if (prefix.js + pascalize(longhand) in style) {
|
3133 | return prefix.css + prop;
|
3134 | }
|
3135 | }
|
3136 |
|
3137 | return prop;
|
3138 | }
|
3139 | };
|
3140 |
|
3141 |
|
3142 |
|
3143 | var textOrientation = {
|
3144 | noPrefill: ['text-orientation'],
|
3145 | supportedProperty: function supportedProperty(prop) {
|
3146 | if (prop !== 'text-orientation') return false;
|
3147 |
|
3148 | if (prefix.vendor === 'apple' && !prefix.isTouch) {
|
3149 | return prefix.css + prop;
|
3150 | }
|
3151 |
|
3152 | return prop;
|
3153 | }
|
3154 | };
|
3155 |
|
3156 |
|
3157 |
|
3158 | var transform = {
|
3159 | noPrefill: ['transform'],
|
3160 | supportedProperty: function supportedProperty(prop, style, options) {
|
3161 | if (prop !== 'transform') return false;
|
3162 |
|
3163 | if (options.transform) {
|
3164 | return prop;
|
3165 | }
|
3166 |
|
3167 | return prefix.css + prop;
|
3168 | }
|
3169 | };
|
3170 |
|
3171 |
|
3172 |
|
3173 | var transition = {
|
3174 | noPrefill: ['transition'],
|
3175 | supportedProperty: function supportedProperty(prop, style, options) {
|
3176 | if (prop !== 'transition') return false;
|
3177 |
|
3178 | if (options.transition) {
|
3179 | return prop;
|
3180 | }
|
3181 |
|
3182 | return prefix.css + prop;
|
3183 | }
|
3184 | };
|
3185 |
|
3186 |
|
3187 |
|
3188 | var writingMode = {
|
3189 | noPrefill: ['writing-mode'],
|
3190 | supportedProperty: function supportedProperty(prop) {
|
3191 | if (prop !== 'writing-mode') return false;
|
3192 |
|
3193 | if (prefix.js === 'Webkit' || prefix.js === 'ms' && prefix.browser !== 'edge') {
|
3194 | return prefix.css + prop;
|
3195 | }
|
3196 |
|
3197 | return prop;
|
3198 | }
|
3199 | };
|
3200 |
|
3201 |
|
3202 |
|
3203 | var userSelect = {
|
3204 | noPrefill: ['user-select'],
|
3205 | supportedProperty: function supportedProperty(prop) {
|
3206 | if (prop !== 'user-select') return false;
|
3207 |
|
3208 | if (prefix.js === 'Moz' || prefix.js === 'ms' || prefix.vendor === 'apple') {
|
3209 | return prefix.css + prop;
|
3210 | }
|
3211 |
|
3212 | return prop;
|
3213 | }
|
3214 | };
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 | var breakPropsOld = {
|
3221 | supportedProperty: function supportedProperty(prop, style) {
|
3222 | if (!/^break-/.test(prop)) return false;
|
3223 |
|
3224 | if (prefix.js === 'Webkit') {
|
3225 | var jsProp = "WebkitColumn" + pascalize(prop);
|
3226 | return jsProp in style ? prefix.css + "column-" + prop : false;
|
3227 | }
|
3228 |
|
3229 | if (prefix.js === 'Moz') {
|
3230 | var _jsProp = "page" + pascalize(prop);
|
3231 |
|
3232 | return _jsProp in style ? "page-" + prop : false;
|
3233 | }
|
3234 |
|
3235 | return false;
|
3236 | }
|
3237 | };
|
3238 |
|
3239 |
|
3240 |
|
3241 | var inlineLogicalOld = {
|
3242 | supportedProperty: function supportedProperty(prop, style) {
|
3243 | if (!/^(border|margin|padding)-inline/.test(prop)) return false;
|
3244 | if (prefix.js === 'Moz') return prop;
|
3245 | var newProp = prop.replace('-inline', '');
|
3246 | return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
|
3247 | }
|
3248 | };
|
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 | var unprefixed = {
|
3254 | supportedProperty: function supportedProperty(prop, style) {
|
3255 | return camelize(prop) in style ? prop : false;
|
3256 | }
|
3257 | };
|
3258 |
|
3259 | var prefixed = {
|
3260 | supportedProperty: function supportedProperty(prop, style) {
|
3261 | var pascalized = pascalize(prop);
|
3262 |
|
3263 | if (prop[0] === '-') return prop;
|
3264 |
|
3265 | if (prop[0] === '-' && prop[1] === '-') return prop;
|
3266 | if (prefix.js + pascalized in style) return prefix.css + prop;
|
3267 |
|
3268 | if (prefix.js !== 'Webkit' && "Webkit" + pascalized in style) return "-webkit-" + prop;
|
3269 | return false;
|
3270 | }
|
3271 | };
|
3272 |
|
3273 |
|
3274 |
|
3275 | var scrollSnap = {
|
3276 | supportedProperty: function supportedProperty(prop) {
|
3277 | if (prop.substring(0, 11) !== 'scroll-snap') return false;
|
3278 |
|
3279 | if (prefix.js === 'ms') {
|
3280 | return "" + prefix.css + prop;
|
3281 | }
|
3282 |
|
3283 | return prop;
|
3284 | }
|
3285 | };
|
3286 |
|
3287 |
|
3288 |
|
3289 | var overscrollBehavior = {
|
3290 | supportedProperty: function supportedProperty(prop) {
|
3291 | if (prop !== 'overscroll-behavior') return false;
|
3292 |
|
3293 | if (prefix.js === 'ms') {
|
3294 | return prefix.css + "scroll-chaining";
|
3295 | }
|
3296 |
|
3297 | return prop;
|
3298 | }
|
3299 | };
|
3300 |
|
3301 | var propMap = {
|
3302 | 'flex-grow': 'flex-positive',
|
3303 | 'flex-shrink': 'flex-negative',
|
3304 | 'flex-basis': 'flex-preferred-size',
|
3305 | 'justify-content': 'flex-pack',
|
3306 | order: 'flex-order',
|
3307 | 'align-items': 'flex-align',
|
3308 | 'align-content': 'flex-line-pack'
|
3309 |
|
3310 | };
|
3311 |
|
3312 | var flex2012 = {
|
3313 | supportedProperty: function supportedProperty(prop, style) {
|
3314 | var newProp = propMap[prop];
|
3315 | if (!newProp) return false;
|
3316 | return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
|
3317 | }
|
3318 | };
|
3319 |
|
3320 | var propMap$1 = {
|
3321 | flex: 'box-flex',
|
3322 | 'flex-grow': 'box-flex',
|
3323 | 'flex-direction': ['box-orient', 'box-direction'],
|
3324 | order: 'box-ordinal-group',
|
3325 | 'align-items': 'box-align',
|
3326 | 'flex-flow': ['box-orient', 'box-direction'],
|
3327 | 'justify-content': 'box-pack'
|
3328 | };
|
3329 | var propKeys = Object.keys(propMap$1);
|
3330 |
|
3331 | var prefixCss = function prefixCss(p) {
|
3332 | return prefix.css + p;
|
3333 | };
|
3334 |
|
3335 |
|
3336 | var flex2009 = {
|
3337 | supportedProperty: function supportedProperty(prop, style, _ref) {
|
3338 | var multiple = _ref.multiple;
|
3339 |
|
3340 | if (propKeys.indexOf(prop) > -1) {
|
3341 | var newProp = propMap$1[prop];
|
3342 |
|
3343 | if (!Array.isArray(newProp)) {
|
3344 | return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
|
3345 | }
|
3346 |
|
3347 | if (!multiple) return false;
|
3348 |
|
3349 | for (var i = 0; i < newProp.length; i++) {
|
3350 | if (!(prefix.js + pascalize(newProp[0]) in style)) {
|
3351 | return false;
|
3352 | }
|
3353 | }
|
3354 |
|
3355 | return newProp.map(prefixCss);
|
3356 | }
|
3357 |
|
3358 | return false;
|
3359 | }
|
3360 | };
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 | var plugins = [appearence, colorAdjust, mask, textOrientation, transform, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];
|
3378 | var propertyDetectors = plugins.filter(function (p) {
|
3379 | return p.supportedProperty;
|
3380 | }).map(function (p) {
|
3381 | return p.supportedProperty;
|
3382 | });
|
3383 | var noPrefill = plugins.filter(function (p) {
|
3384 | return p.noPrefill;
|
3385 | }).reduce(function (a, p) {
|
3386 | a.push.apply(a, _toConsumableArray(p.noPrefill));
|
3387 | return a;
|
3388 | }, []);
|
3389 |
|
3390 | var el;
|
3391 | var cache$1 = {};
|
3392 |
|
3393 | if (isBrowser) {
|
3394 | el = document.createElement('p');
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 | var computed = window.getComputedStyle(document.documentElement, '');
|
3403 |
|
3404 | for (var key$1 in computed) {
|
3405 |
|
3406 | if (!isNaN(key$1)) cache$1[computed[key$1]] = computed[key$1];
|
3407 | }
|
3408 |
|
3409 |
|
3410 |
|
3411 | noPrefill.forEach(function (x) {
|
3412 | return delete cache$1[x];
|
3413 | });
|
3414 | }
|
3415 | |
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 | function supportedProperty(prop, options) {
|
3427 | if (options === void 0) {
|
3428 | options = {};
|
3429 | }
|
3430 |
|
3431 |
|
3432 | if (!el) return prop;
|
3433 |
|
3434 | if ( cache$1[prop] != null) {
|
3435 | return cache$1[prop];
|
3436 | }
|
3437 |
|
3438 |
|
3439 | if (prop === 'transition' || prop === 'transform') {
|
3440 | options[prop] = prop in el.style;
|
3441 | }
|
3442 |
|
3443 |
|
3444 | for (var i = 0; i < propertyDetectors.length; i++) {
|
3445 | cache$1[prop] = propertyDetectors[i](prop, el.style, options);
|
3446 |
|
3447 | if (cache$1[prop]) break;
|
3448 | }
|
3449 |
|
3450 |
|
3451 |
|
3452 | try {
|
3453 | el.style[prop] = '';
|
3454 | } catch (err) {
|
3455 | return false;
|
3456 | }
|
3457 |
|
3458 | return cache$1[prop];
|
3459 | }
|
3460 |
|
3461 | var cache$1$1 = {};
|
3462 | var transitionProperties = {
|
3463 | transition: 1,
|
3464 | 'transition-property': 1,
|
3465 | '-webkit-transition': 1,
|
3466 | '-webkit-transition-property': 1
|
3467 | };
|
3468 | var transPropsRegExp = /(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;
|
3469 | var el$1;
|
3470 | |
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 | function prefixTransitionCallback(match, p1, p2) {
|
3481 | if (p1 === 'var') return 'var';
|
3482 | if (p1 === 'all') return 'all';
|
3483 | if (p2 === 'all') return ', all';
|
3484 | var prefixedValue = p1 ? supportedProperty(p1) : ", " + supportedProperty(p2);
|
3485 | if (!prefixedValue) return p1 || p2;
|
3486 | return prefixedValue;
|
3487 | }
|
3488 |
|
3489 | if (isBrowser) el$1 = document.createElement('p');
|
3490 | |
3491 |
|
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 | function supportedValue(property, value) {
|
3500 |
|
3501 | var prefixedValue = value;
|
3502 | if (!el$1 || property === 'content') return value;
|
3503 |
|
3504 |
|
3505 |
|
3506 | if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) {
|
3507 | return prefixedValue;
|
3508 | }
|
3509 |
|
3510 |
|
3511 | var cacheKey = property + prefixedValue;
|
3512 |
|
3513 | if ( cache$1$1[cacheKey] != null) {
|
3514 | return cache$1$1[cacheKey];
|
3515 | }
|
3516 |
|
3517 |
|
3518 | try {
|
3519 |
|
3520 | el$1.style[property] = prefixedValue;
|
3521 | } catch (err) {
|
3522 |
|
3523 | cache$1$1[cacheKey] = false;
|
3524 | return false;
|
3525 | }
|
3526 |
|
3527 |
|
3528 | if (transitionProperties[property]) {
|
3529 | prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);
|
3530 | } else if (el$1.style[property] === '') {
|
3531 |
|
3532 | prefixedValue = prefix.css + prefixedValue;
|
3533 |
|
3534 | if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox';
|
3535 |
|
3536 | el$1.style[property] = prefixedValue;
|
3537 |
|
3538 | if (el$1.style[property] === '') {
|
3539 | cache$1$1[cacheKey] = false;
|
3540 | return false;
|
3541 | }
|
3542 | }
|
3543 |
|
3544 |
|
3545 | el$1.style[property] = '';
|
3546 |
|
3547 | cache$1$1[cacheKey] = prefixedValue;
|
3548 | return cache$1$1[cacheKey];
|
3549 | }
|
3550 |
|
3551 | |
3552 |
|
3553 |
|
3554 |
|
3555 | function jssVendorPrefixer() {
|
3556 | function onProcessRule(rule) {
|
3557 | if (rule.type === 'keyframes') {
|
3558 | var atRule = rule;
|
3559 | atRule.at = supportedKeyframes(atRule.at);
|
3560 | }
|
3561 | }
|
3562 |
|
3563 | function prefixStyle(style) {
|
3564 | for (var prop in style) {
|
3565 | var value = style[prop];
|
3566 |
|
3567 | if (prop === 'fallbacks' && Array.isArray(value)) {
|
3568 | style[prop] = value.map(prefixStyle);
|
3569 | continue;
|
3570 | }
|
3571 |
|
3572 | var changeProp = false;
|
3573 | var supportedProp = supportedProperty(prop);
|
3574 | if (supportedProp && supportedProp !== prop) changeProp = true;
|
3575 | var changeValue = false;
|
3576 | var supportedValue$1 = supportedValue(supportedProp, jss.toCssValue(value));
|
3577 | if (supportedValue$1 && supportedValue$1 !== value) changeValue = true;
|
3578 |
|
3579 | if (changeProp || changeValue) {
|
3580 | if (changeProp) delete style[prop];
|
3581 | style[supportedProp || prop] = supportedValue$1 || value;
|
3582 | }
|
3583 | }
|
3584 |
|
3585 | return style;
|
3586 | }
|
3587 |
|
3588 | function onProcessStyle(style, rule) {
|
3589 | if (rule.type !== 'style') return style;
|
3590 | return prefixStyle(style);
|
3591 | }
|
3592 |
|
3593 | function onChangeValue(value, prop) {
|
3594 | return supportedValue(prop, jss.toCssValue(value)) || value;
|
3595 | }
|
3596 |
|
3597 | return {
|
3598 | onProcessRule: onProcessRule,
|
3599 | onProcessStyle: onProcessStyle,
|
3600 | onChangeValue: onChangeValue
|
3601 | };
|
3602 | }
|
3603 |
|
3604 | |
3605 |
|
3606 |
|
3607 | function jssPropsSort() {
|
3608 | var sort = function sort(prop0, prop1) {
|
3609 | if (prop0.length === prop1.length) {
|
3610 | return prop0 > prop1 ? 1 : -1;
|
3611 | }
|
3612 |
|
3613 | return prop0.length - prop1.length;
|
3614 | };
|
3615 |
|
3616 | return {
|
3617 | onProcessStyle: function onProcessStyle(style, rule) {
|
3618 | if (rule.type !== 'style') return style;
|
3619 | var newStyle = {};
|
3620 | var props = Object.keys(style).sort(sort);
|
3621 |
|
3622 | for (var i = 0; i < props.length; i++) {
|
3623 | newStyle[props[i]] = style[props[i]];
|
3624 | }
|
3625 |
|
3626 | return newStyle;
|
3627 | }
|
3628 | };
|
3629 | }
|
3630 |
|
3631 | var create = function create(options) {
|
3632 | if (options === void 0) {
|
3633 | options = {};
|
3634 | }
|
3635 |
|
3636 | return {
|
3637 | plugins: [functionPlugin(), observablePlugin(options.observable), templatePlugin(), jssGlobal(), jssExtend(), jssNested(), jssCompose(), camelCase(), defaultUnit(options.defaultUnit), jssExpand(), jssVendorPrefixer(), jssPropsSort()]
|
3638 | };
|
3639 | };
|
3640 |
|
3641 | var defaultJss = jss.create(create());
|
3642 |
|
3643 | var sheetsMeta = new WeakMap();
|
3644 | var getMeta = function getMeta(sheet) {
|
3645 | return sheetsMeta.get(sheet);
|
3646 | };
|
3647 | var addMeta = function addMeta(sheet, meta) {
|
3648 | sheetsMeta.set(sheet, meta);
|
3649 | };
|
3650 |
|
3651 | var getStyles = function getStyles(options) {
|
3652 | var styles = options.styles;
|
3653 |
|
3654 | if (typeof styles !== 'function') {
|
3655 | return styles;
|
3656 | }
|
3657 |
|
3658 | warning(styles.length !== 0, "[JSS] <" + (options.name || 'Hook') + " />'s styles function doesn't rely on the \"theme\" argument. We recommend declaring styles as an object instead.") ;
|
3659 | return styles(options.theme);
|
3660 | };
|
3661 |
|
3662 | function getSheetOptions(options, link) {
|
3663 | var minify;
|
3664 |
|
3665 | if (options.context.id && options.context.id.minify != null) {
|
3666 | minify = options.context.id.minify;
|
3667 | }
|
3668 |
|
3669 | var classNamePrefix = options.context.classNamePrefix || '';
|
3670 |
|
3671 | if (options.name && !minify) {
|
3672 | classNamePrefix += options.name.replace(/\s/g, '-') + "-";
|
3673 | }
|
3674 |
|
3675 | var meta = '';
|
3676 | if (options.name) meta = options.name + ", ";
|
3677 | meta += typeof options.styles === 'function' ? 'Themed' : 'Unthemed';
|
3678 | return _extends({}, options.sheetOptions, {
|
3679 | index: options.index,
|
3680 | meta: meta,
|
3681 | classNamePrefix: classNamePrefix,
|
3682 | link: link,
|
3683 | generateId: options.sheetOptions && options.sheetOptions.generateId ? options.sheetOptions.generateId : options.context.generateId
|
3684 | });
|
3685 | }
|
3686 |
|
3687 | var createStyleSheet = function createStyleSheet(options) {
|
3688 | if (options.context.disableStylesGeneration) {
|
3689 | return undefined;
|
3690 | }
|
3691 |
|
3692 | var manager = getManager(options.context, options.index);
|
3693 | var existingSheet = manager.get(options.theme);
|
3694 |
|
3695 | if (existingSheet) {
|
3696 | return existingSheet;
|
3697 | }
|
3698 |
|
3699 | var jss$1 = options.context.jss || defaultJss;
|
3700 | var styles = getStyles(options);
|
3701 | var dynamicStyles = jss.getDynamicStyles(styles);
|
3702 | var sheet = jss$1.createStyleSheet(styles, getSheetOptions(options, dynamicStyles !== null));
|
3703 | addMeta(sheet, {
|
3704 | dynamicStyles: dynamicStyles,
|
3705 | styles: styles
|
3706 | });
|
3707 | manager.add(options.theme, sheet);
|
3708 | return sheet;
|
3709 | };
|
3710 | var removeDynamicRules = function removeDynamicRules(sheet, rules) {
|
3711 |
|
3712 |
|
3713 | for (var key in rules) {
|
3714 | sheet.deleteRule(rules[key]);
|
3715 | }
|
3716 | };
|
3717 | var updateDynamicRules = function updateDynamicRules(data, sheet, rules) {
|
3718 |
|
3719 |
|
3720 | for (var key in rules) {
|
3721 | sheet.updateOne(rules[key], data);
|
3722 | }
|
3723 | };
|
3724 | var addDynamicRules = function addDynamicRules(sheet, data) {
|
3725 | var meta = getMeta(sheet);
|
3726 |
|
3727 | if (!meta) {
|
3728 | return undefined;
|
3729 | }
|
3730 |
|
3731 | var rules = {};
|
3732 |
|
3733 | for (var key in meta.dynamicStyles) {
|
3734 | var initialRuleCount = sheet.rules.index.length;
|
3735 | var originalRule = sheet.addRule(key, meta.dynamicStyles[key]);
|
3736 |
|
3737 | for (var i = initialRuleCount; i < sheet.rules.index.length; i++) {
|
3738 | var rule = sheet.rules.index[i];
|
3739 | sheet.updateOne(rule, data);
|
3740 |
|
3741 |
|
3742 | rules[originalRule === rule ? key : rule.key] = rule;
|
3743 | }
|
3744 | }
|
3745 |
|
3746 | return rules;
|
3747 | };
|
3748 |
|
3749 | var getSheetClasses = function getSheetClasses(sheet, dynamicRules) {
|
3750 | if (!dynamicRules) {
|
3751 | return sheet.classes;
|
3752 | }
|
3753 |
|
3754 | var meta = getMeta(sheet);
|
3755 |
|
3756 | if (!meta) {
|
3757 | return sheet.classes;
|
3758 | }
|
3759 |
|
3760 | var classes = {};
|
3761 |
|
3762 | for (var key in meta.styles) {
|
3763 | classes[key] = sheet.classes[key];
|
3764 |
|
3765 | if (key in dynamicRules) {
|
3766 | classes[key] += " " + sheet.classes[dynamicRules[key].key];
|
3767 | }
|
3768 | }
|
3769 |
|
3770 | return classes;
|
3771 | };
|
3772 |
|
3773 | var useEffectOrLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
3774 | var noTheme = {};
|
3775 |
|
3776 | var createUseStyles = function createUseStyles(styles, options) {
|
3777 | if (options === void 0) {
|
3778 | options = {};
|
3779 | }
|
3780 |
|
3781 | var _options = options,
|
3782 | _options$index = _options.index,
|
3783 | index = _options$index === void 0 ? getSheetIndex() : _options$index,
|
3784 | theming = _options.theming,
|
3785 | name = _options.name,
|
3786 | sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "name"]);
|
3787 |
|
3788 | var ThemeContext$1 = theming && theming.context || ThemeContext;
|
3789 |
|
3790 | var useTheme = function useTheme(theme) {
|
3791 | if (typeof styles === 'function') {
|
3792 | return theme || React.useContext(ThemeContext$1) || noTheme;
|
3793 | }
|
3794 |
|
3795 | return noTheme;
|
3796 | };
|
3797 |
|
3798 | var emptyObject = {};
|
3799 | return function useStyles(data) {
|
3800 | var isFirstMount = React.useRef(true);
|
3801 | var context = React.useContext(JssContext);
|
3802 | var theme = useTheme(data && data.theme);
|
3803 |
|
3804 | var _React$useMemo = React.useMemo(function () {
|
3805 | var newSheet = createStyleSheet({
|
3806 | context: context,
|
3807 | styles: styles,
|
3808 | name: name,
|
3809 | theme: theme,
|
3810 | index: index,
|
3811 | sheetOptions: sheetOptions
|
3812 | });
|
3813 | var newDynamicRules = newSheet ? addDynamicRules(newSheet, data) : null;
|
3814 |
|
3815 | if (newSheet) {
|
3816 | manageSheet({
|
3817 | index: index,
|
3818 | context: context,
|
3819 | sheet: newSheet,
|
3820 | theme: theme
|
3821 | });
|
3822 | }
|
3823 |
|
3824 | return [newSheet, newDynamicRules];
|
3825 | }, [context, theme]),
|
3826 | sheet = _React$useMemo[0],
|
3827 | dynamicRules = _React$useMemo[1];
|
3828 |
|
3829 | useEffectOrLayoutEffect(function () {
|
3830 |
|
3831 | if (sheet && dynamicRules && !isFirstMount.current) {
|
3832 | updateDynamicRules(data, sheet, dynamicRules);
|
3833 | }
|
3834 | }, [data]);
|
3835 | useEffectOrLayoutEffect(function () {
|
3836 | return (
|
3837 | function () {
|
3838 | if (sheet) {
|
3839 | unmanageSheet({
|
3840 | index: index,
|
3841 | context: context,
|
3842 | sheet: sheet,
|
3843 | theme: theme
|
3844 | });
|
3845 | }
|
3846 |
|
3847 | if (sheet && dynamicRules) {
|
3848 | removeDynamicRules(sheet, dynamicRules);
|
3849 | }
|
3850 | }
|
3851 | );
|
3852 | }, [sheet]);
|
3853 | var classes = React.useMemo(function () {
|
3854 | return sheet && dynamicRules ? getSheetClasses(sheet, dynamicRules) : emptyObject;
|
3855 | }, [sheet, dynamicRules]);
|
3856 | React.useDebugValue(classes);
|
3857 | React.useDebugValue(theme === noTheme ? 'No theme' : theme);
|
3858 | React.useEffect(function () {
|
3859 | isFirstMount.current = false;
|
3860 | });
|
3861 | return classes;
|
3862 | };
|
3863 | };
|
3864 |
|
3865 | var NoRenderer = function NoRenderer(props) {
|
3866 | return props.children || null;
|
3867 | };
|
3868 | |
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 | var createWithStyles = function createWithStyles(styles, options) {
|
3876 | if (options === void 0) {
|
3877 | options = {};
|
3878 | }
|
3879 |
|
3880 | var _options = options,
|
3881 | _options$index = _options.index,
|
3882 | index = _options$index === void 0 ? getSheetIndex() : _options$index,
|
3883 | theming = _options.theming,
|
3884 | injectTheme = _options.injectTheme,
|
3885 | sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "injectTheme"]);
|
3886 |
|
3887 | var ThemeContext$1 = theming ? theming.context : ThemeContext;
|
3888 | return function (InnerComponent) {
|
3889 | if (InnerComponent === void 0) {
|
3890 | InnerComponent = NoRenderer;
|
3891 | }
|
3892 |
|
3893 | var displayName = getDisplayName$1(InnerComponent);
|
3894 | var mergeClassesProp = memoize(function (sheetClasses, classesProp) {
|
3895 | return classesProp ? mergeClasses(sheetClasses, classesProp) : sheetClasses;
|
3896 | });
|
3897 | var hookOptions = Object.assign(sheetOptions, {
|
3898 | theming: theming,
|
3899 | index: index,
|
3900 | name: displayName
|
3901 | });
|
3902 | var useStyles = createUseStyles(styles, hookOptions);
|
3903 | var WithStyles = React.forwardRef(function (props, ref) {
|
3904 | var theme = React.useContext(ThemeContext$1);
|
3905 |
|
3906 | var newProps = _extends({}, props);
|
3907 |
|
3908 | if (injectTheme && newProps.theme == null) {
|
3909 | newProps.theme = theme;
|
3910 | }
|
3911 |
|
3912 | var sheetClasses = useStyles(newProps);
|
3913 | var classes = mergeClassesProp(sheetClasses, props.classes);
|
3914 | return React.createElement(InnerComponent, _extends({}, newProps, {
|
3915 | classes: classes,
|
3916 | ref: ref
|
3917 | }));
|
3918 | });
|
3919 | WithStyles.displayName = "WithStyles(" + displayName + ")";
|
3920 | WithStyles.defaultProps = _extends({}, InnerComponent.defaultProps);
|
3921 | WithStyles.InnerComponent = InnerComponent;
|
3922 | return hoistNonReactStatics_cjs(WithStyles, InnerComponent);
|
3923 | };
|
3924 | };
|
3925 |
|
3926 | function shallowEqualObjects(objA, objB) {
|
3927 | if (objA === objB) {
|
3928 | return true;
|
3929 | }
|
3930 |
|
3931 | if (!objA || !objB) {
|
3932 | return false;
|
3933 | }
|
3934 |
|
3935 | var aKeys = Object.keys(objA);
|
3936 | var bKeys = Object.keys(objB);
|
3937 | var len = aKeys.length;
|
3938 |
|
3939 | if (bKeys.length !== len) {
|
3940 | return false;
|
3941 | }
|
3942 |
|
3943 | for (var i = 0; i < len; i++) {
|
3944 | var key = aKeys[i];
|
3945 |
|
3946 | if (objA[key] !== objB[key]) {
|
3947 | return false;
|
3948 | }
|
3949 | }
|
3950 |
|
3951 | return true;
|
3952 | }
|
3953 |
|
3954 | var initialContext = {};
|
3955 | function JssProvider(props) {
|
3956 | var managersRef = React.useRef({});
|
3957 | var prevContextRef = React.useRef();
|
3958 | var registryRef = React.useRef(null);
|
3959 |
|
3960 | var createContext = function createContext(parentContext, prevContext) {
|
3961 | if (prevContext === void 0) {
|
3962 | prevContext = initialContext;
|
3963 | }
|
3964 |
|
3965 | var registry = props.registry,
|
3966 | classNamePrefix = props.classNamePrefix,
|
3967 | jss$1 = props.jss,
|
3968 | generateId = props.generateId,
|
3969 | disableStylesGeneration = props.disableStylesGeneration,
|
3970 | media = props.media,
|
3971 | id = props.id;
|
3972 |
|
3973 | var context = _extends({}, parentContext);
|
3974 |
|
3975 | if (registry) {
|
3976 | context.registry = registry;
|
3977 |
|
3978 |
|
3979 | if (registry !== registryRef.current) {
|
3980 |
|
3981 | managersRef.current = {};
|
3982 | registryRef.current = registry;
|
3983 | }
|
3984 | }
|
3985 |
|
3986 | context.managers = managersRef.current;
|
3987 |
|
3988 | if (id !== undefined) {
|
3989 | context.id = id;
|
3990 | }
|
3991 |
|
3992 | if (generateId !== undefined) {
|
3993 | context.generateId = generateId;
|
3994 | } else if (!context.generateId || !prevContext || context.id !== prevContext.id) {
|
3995 | context.generateId = jss.createGenerateId(context.id);
|
3996 | }
|
3997 |
|
3998 | if (classNamePrefix) {
|
3999 | context.classNamePrefix = (context.classNamePrefix || '') + classNamePrefix;
|
4000 | }
|
4001 |
|
4002 | if (media !== undefined) {
|
4003 | context.media = media;
|
4004 | }
|
4005 |
|
4006 | if (jss$1) {
|
4007 | context.jss = jss$1;
|
4008 | }
|
4009 |
|
4010 | if (disableStylesGeneration !== undefined) {
|
4011 | context.disableStylesGeneration = disableStylesGeneration;
|
4012 | }
|
4013 |
|
4014 | if (prevContext && shallowEqualObjects(prevContext, context)) {
|
4015 | return prevContext;
|
4016 | }
|
4017 |
|
4018 | return context;
|
4019 | };
|
4020 |
|
4021 | var renderProvider = function renderProvider(parentContext) {
|
4022 | var children = props.children;
|
4023 | var context = createContext(parentContext, prevContextRef.current);
|
4024 | prevContextRef.current = context;
|
4025 | return React.createElement(JssContext.Provider, {
|
4026 | value: context
|
4027 | }, children);
|
4028 | };
|
4029 |
|
4030 | return React.createElement(JssContext.Consumer, null, renderProvider);
|
4031 | }
|
4032 |
|
4033 | function memoize$1(fn) {
|
4034 | var cache = {};
|
4035 | return function (arg) {
|
4036 | if (cache[arg] === undefined) cache[arg] = fn(arg);
|
4037 | return cache[arg];
|
4038 | };
|
4039 | }
|
4040 |
|
4041 | var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|default|defer|dir|disabled|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|itemProp|itemScope|itemType|itemID|itemRef|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
|
4042 |
|
4043 | var index$1 = memoize$1(function (prop) {
|
4044 | return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
4045 |
|
4046 | && prop.charCodeAt(1) === 110
|
4047 |
|
4048 | && prop.charCodeAt(2) < 91;
|
4049 | }
|
4050 |
|
4051 | );
|
4052 |
|
4053 | var parseStyles = function parseStyles(args) {
|
4054 | var dynamicStyles = [];
|
4055 | var staticStyle;
|
4056 | var labels = [];
|
4057 |
|
4058 | for (var key in args) {
|
4059 | var style = args[key];
|
4060 | if (!style) continue;
|
4061 |
|
4062 | if (typeof style === 'function') {
|
4063 | dynamicStyles.push(style);
|
4064 | } else {
|
4065 | if (!staticStyle) staticStyle = {};
|
4066 | Object.assign(staticStyle, style);
|
4067 | var _staticStyle = staticStyle,
|
4068 | _label = _staticStyle.label;
|
4069 |
|
4070 | if (_label) {
|
4071 | if (labels.indexOf(_label) === -1) labels.push(_label);
|
4072 | }
|
4073 | }
|
4074 | }
|
4075 |
|
4076 | var styles = {};
|
4077 | var label = labels.length === 0 ? 'sc' : labels.join('-');
|
4078 |
|
4079 | if (staticStyle) {
|
4080 |
|
4081 | if ('label' in staticStyle) delete staticStyle.label;
|
4082 | styles[label] = staticStyle;
|
4083 | }
|
4084 |
|
4085 |
|
4086 | if (dynamicStyles.length === 1) {
|
4087 | styles.scd = dynamicStyles[0];
|
4088 | }
|
4089 |
|
4090 |
|
4091 |
|
4092 | if (dynamicStyles.length > 1) {
|
4093 | styles.scd = function (props) {
|
4094 | var merged = {};
|
4095 |
|
4096 | for (var i = 0; i < dynamicStyles.length; i++) {
|
4097 | var dynamicStyle = dynamicStyles[i](props);
|
4098 | if (dynamicStyle) Object.assign(merged, dynamicStyle);
|
4099 | }
|
4100 |
|
4101 | return merged;
|
4102 | };
|
4103 | }
|
4104 |
|
4105 | return {
|
4106 | styles: styles,
|
4107 | label: label
|
4108 | };
|
4109 | };
|
4110 |
|
4111 | var shouldForwardPropSymbol = Symbol('react-jss-styled');
|
4112 |
|
4113 | var getShouldForwardProp = function getShouldForwardProp(tagOrComponent, options) {
|
4114 | var shouldForwardProp = options.shouldForwardProp;
|
4115 | var childShouldForwardProp = tagOrComponent[shouldForwardPropSymbol];
|
4116 | var finalShouldForwardProp = shouldForwardProp || childShouldForwardProp;
|
4117 |
|
4118 | if (shouldForwardProp && childShouldForwardProp) {
|
4119 | finalShouldForwardProp = function finalShouldForwardProp(prop) {
|
4120 | return childShouldForwardProp(prop) && shouldForwardProp(prop);
|
4121 | };
|
4122 | }
|
4123 |
|
4124 | return finalShouldForwardProp;
|
4125 | };
|
4126 |
|
4127 | var getChildProps = function getChildProps(props, shouldForwardProp, isTag) {
|
4128 | var childProps = {};
|
4129 |
|
4130 | for (var prop in props) {
|
4131 | if (shouldForwardProp) {
|
4132 | if (shouldForwardProp(prop) === true) {
|
4133 | childProps[prop] = props[prop];
|
4134 | }
|
4135 |
|
4136 | continue;
|
4137 | }
|
4138 |
|
4139 |
|
4140 | if (isTag) {
|
4141 | if (index$1(prop)) {
|
4142 | childProps[prop] = props[prop];
|
4143 | }
|
4144 |
|
4145 | continue;
|
4146 | }
|
4147 |
|
4148 | childProps[prop] = props[prop];
|
4149 | }
|
4150 |
|
4151 | return childProps;
|
4152 | };
|
4153 |
|
4154 |
|
4155 | var configureStyled = function configureStyled(tagOrComponent, options) {
|
4156 | if (options === void 0) {
|
4157 | options = {};
|
4158 | }
|
4159 |
|
4160 | var _options = options,
|
4161 | theming = _options.theming;
|
4162 | var isTag = typeof tagOrComponent === 'string';
|
4163 | var ThemeContext$1 = theming ? theming.context : ThemeContext;
|
4164 | var shouldForwardProp = getShouldForwardProp(tagOrComponent, options);
|
4165 |
|
4166 | var _options2 = options,
|
4167 | _ = _options2.shouldForwardProp,
|
4168 | hookOptions = _objectWithoutPropertiesLoose(_options2, ["shouldForwardProp"]);
|
4169 |
|
4170 | return function createStyledComponent() {
|
4171 |
|
4172 | var _parseStyles = parseStyles(arguments),
|
4173 | styles = _parseStyles.styles,
|
4174 | label = _parseStyles.label;
|
4175 |
|
4176 | var useStyles = createUseStyles(styles, hookOptions);
|
4177 |
|
4178 | var Styled = function Styled(props) {
|
4179 | var as = props.as,
|
4180 | className = props.className;
|
4181 | var theme = React.useContext(ThemeContext$1);
|
4182 | var propsWithTheme = Object.assign({
|
4183 | theme: theme
|
4184 | }, props);
|
4185 | var classes = useStyles(propsWithTheme);
|
4186 | var childProps = getChildProps(props, shouldForwardProp, isTag);
|
4187 | var classNames = ((classes[label] || classes.sc || '') + " " + (classes.scd || '')).trim();
|
4188 | childProps.className = className ? className + " " + classNames : classNames;
|
4189 |
|
4190 | if (!isTag && shouldForwardProp) {
|
4191 | tagOrComponent[shouldForwardPropSymbol] = shouldForwardProp;
|
4192 | }
|
4193 |
|
4194 | if (isTag && as) {
|
4195 | return React.createElement(as, childProps);
|
4196 | }
|
4197 |
|
4198 | return React.createElement(tagOrComponent, childProps);
|
4199 | };
|
4200 |
|
4201 | return Styled;
|
4202 | };
|
4203 | };
|
4204 |
|
4205 | var MAX_RULES_PER_SHEET = 10000;
|
4206 | var defaultJss$1 = jss.create(create());
|
4207 |
|
4208 | var createCss = function createCss(jss) {
|
4209 | if (jss === void 0) {
|
4210 | jss = defaultJss$1;
|
4211 | }
|
4212 |
|
4213 | var cache = new Map();
|
4214 | var ruleIndex = 0;
|
4215 | var sheet;
|
4216 |
|
4217 | var getSheet = function getSheet() {
|
4218 | if (!sheet || sheet.rules.index.length > MAX_RULES_PER_SHEET) {
|
4219 | sheet = jss.createStyleSheet().attach();
|
4220 | }
|
4221 |
|
4222 | return sheet;
|
4223 | };
|
4224 |
|
4225 | function css() {
|
4226 |
|
4227 | var args = arguments;
|
4228 |
|
4229 |
|
4230 | var argsStr = JSON.stringify(args);
|
4231 | var cached = cache.get(argsStr);
|
4232 | if (cached) return cached.className;
|
4233 | var flatArgs = [];
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 | for (var argIndex in args) {
|
4239 | var arg = args[argIndex];
|
4240 |
|
4241 | if (!Array.isArray(arg)) {
|
4242 | flatArgs.push(arg);
|
4243 | continue;
|
4244 | }
|
4245 |
|
4246 | for (var innerArgIndex = 0; innerArgIndex < arg.length; innerArgIndex++) {
|
4247 | flatArgs.push(arg[innerArgIndex]);
|
4248 | }
|
4249 | }
|
4250 |
|
4251 | var mergedStyle = {};
|
4252 | var labels = [];
|
4253 |
|
4254 | for (var i = 0; i < flatArgs.length; i++) {
|
4255 | var style = flatArgs[i];
|
4256 | if (!style) continue;
|
4257 | var styleObject = style;
|
4258 |
|
4259 | if (typeof style === 'string') {
|
4260 |
|
4261 | var _cached = cache.get(style);
|
4262 |
|
4263 | if (_cached) {
|
4264 |
|
4265 | if (_cached.labels.length) labels.push.apply(labels, _cached.labels);
|
4266 | styleObject = _cached.style;
|
4267 | }
|
4268 | }
|
4269 |
|
4270 | if (styleObject.label && labels.indexOf(styleObject.label) === -1) labels.push(styleObject.label);
|
4271 | Object.assign(mergedStyle, styleObject);
|
4272 | }
|
4273 |
|
4274 | delete mergedStyle.label;
|
4275 | var label = labels.length === 0 ? 'css' : labels.join('-');
|
4276 | var key = label + "-" + ruleIndex++;
|
4277 | getSheet().addRule(key, mergedStyle);
|
4278 | var className = getSheet().classes[key];
|
4279 | var cacheValue = {
|
4280 | style: mergedStyle,
|
4281 | labels: labels,
|
4282 | className: className
|
4283 | };
|
4284 | cache.set(argsStr, cacheValue);
|
4285 | cache.set(className, cacheValue);
|
4286 | return className;
|
4287 | }
|
4288 |
|
4289 |
|
4290 | css.getSheet = getSheet;
|
4291 | return css;
|
4292 | };
|
4293 |
|
4294 | var css$1 = createCss();
|
4295 |
|
4296 |
|
4297 | var create$1 = function create(css) {
|
4298 | if (css === void 0) {
|
4299 | css = css$1;
|
4300 | }
|
4301 |
|
4302 | return function createElement(type, props) {
|
4303 | var args = arguments;
|
4304 |
|
4305 | if (props && props.css) {
|
4306 | var className = css(props.css);
|
4307 | var newProps = Object.assign({}, props);
|
4308 | newProps.className = props.className ? props.className + " " + className : className;
|
4309 | delete newProps.css;
|
4310 | args[1] = newProps;
|
4311 | }
|
4312 |
|
4313 | return React.createElement.apply(undefined, args);
|
4314 | };
|
4315 | };
|
4316 | var jsx = create$1();
|
4317 |
|
4318 | Object.defineProperty(exports, 'SheetsRegistry', {
|
4319 | enumerable: true,
|
4320 | get: function () {
|
4321 | return jss.SheetsRegistry;
|
4322 | }
|
4323 | });
|
4324 | Object.defineProperty(exports, 'createGenerateId', {
|
4325 | enumerable: true,
|
4326 | get: function () {
|
4327 | return jss.createGenerateId;
|
4328 | }
|
4329 | });
|
4330 | exports.JssContext = JssContext;
|
4331 | exports.JssProvider = JssProvider;
|
4332 | exports.ThemeProvider = ThemeProvider;
|
4333 | exports.createJsx = create$1;
|
4334 | exports.createTheming = createTheming;
|
4335 | exports.createUseStyles = createUseStyles;
|
4336 | exports.default = createWithStyles;
|
4337 | exports.jss = defaultJss;
|
4338 | exports.jsx = jsx;
|
4339 | exports.styled = configureStyled;
|
4340 | exports.useTheme = useTheme;
|
4341 | exports.withStyles = createWithStyles;
|
4342 | exports.withTheme = withTheme;
|
4343 |
|
4344 | Object.defineProperty(exports, '__esModule', { value: true });
|
4345 |
|
4346 | })));
|
4347 |
|