1 | function _extends() {
|
2 | _extends = Object.assign || function (target) {
|
3 | for (var i = 1; i < arguments.length; i++) {
|
4 | var source = arguments[i];
|
5 |
|
6 | for (var key in source) {
|
7 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
8 | target[key] = source[key];
|
9 | }
|
10 | }
|
11 | }
|
12 |
|
13 | return target;
|
14 | };
|
15 |
|
16 | return _extends.apply(this, arguments);
|
17 | }
|
18 |
|
19 | function _objectWithoutPropertiesLoose(source, excluded) {
|
20 | if (source == null) return {};
|
21 | var target = {};
|
22 | var sourceKeys = Object.keys(source);
|
23 | var key, i;
|
24 |
|
25 | for (i = 0; i < sourceKeys.length; i++) {
|
26 | key = sourceKeys[i];
|
27 | if (excluded.indexOf(key) >= 0) continue;
|
28 | target[key] = source[key];
|
29 | }
|
30 |
|
31 | return target;
|
32 | }
|
33 |
|
34 | function getDefaultExportFromCjs (x) {
|
35 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
36 | }
|
37 |
|
38 | function createCommonjsModule(fn, basedir, module) {
|
39 | return module = {
|
40 | path: basedir,
|
41 | exports: {},
|
42 | require: function (path, base) {
|
43 | return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
44 | }
|
45 | }, fn(module, module.exports), module.exports;
|
46 | }
|
47 |
|
48 | function getAugmentedNamespace(n) {
|
49 | if (n.__esModule) return n;
|
50 | var a = Object.defineProperty({}, '__esModule', {value: true});
|
51 | Object.keys(n).forEach(function (k) {
|
52 | var d = Object.getOwnPropertyDescriptor(n, k);
|
53 | Object.defineProperty(a, k, d.get ? d : {
|
54 | enumerable: true,
|
55 | get: function () {
|
56 | return n[k];
|
57 | }
|
58 | });
|
59 | });
|
60 | return a;
|
61 | }
|
62 |
|
63 | function commonjsRequire () {
|
64 | throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
65 | }
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
74 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
75 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
76 |
|
77 | function toObject(val) {
|
78 | if (val === null || val === undefined) {
|
79 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
80 | }
|
81 |
|
82 | return Object(val);
|
83 | }
|
84 |
|
85 | function shouldUseNative() {
|
86 | try {
|
87 | if (!Object.assign) {
|
88 | return false;
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | var test1 = new String('abc');
|
95 | test1[5] = 'de';
|
96 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
97 | return false;
|
98 | }
|
99 |
|
100 |
|
101 | var test2 = {};
|
102 | for (var i = 0; i < 10; i++) {
|
103 | test2['_' + String.fromCharCode(i)] = i;
|
104 | }
|
105 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
106 | return test2[n];
|
107 | });
|
108 | if (order2.join('') !== '0123456789') {
|
109 | return false;
|
110 | }
|
111 |
|
112 |
|
113 | var test3 = {};
|
114 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
115 | test3[letter] = letter;
|
116 | });
|
117 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
118 | 'abcdefghijklmnopqrst') {
|
119 | return false;
|
120 | }
|
121 |
|
122 | return true;
|
123 | } catch (err) {
|
124 |
|
125 | return false;
|
126 | }
|
127 | }
|
128 |
|
129 | module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
130 | var from;
|
131 | var to = toObject(target);
|
132 | var symbols;
|
133 |
|
134 | for (var s = 1; s < arguments.length; s++) {
|
135 | from = Object(arguments[s]);
|
136 |
|
137 | for (var key in from) {
|
138 | if (hasOwnProperty.call(from, key)) {
|
139 | to[key] = from[key];
|
140 | }
|
141 | }
|
142 |
|
143 | if (getOwnPropertySymbols) {
|
144 | symbols = getOwnPropertySymbols(from);
|
145 | for (var i = 0; i < symbols.length; i++) {
|
146 | if (propIsEnumerable.call(from, symbols[i])) {
|
147 | to[symbols[i]] = from[symbols[i]];
|
148 | }
|
149 | }
|
150 | }
|
151 | }
|
152 |
|
153 | return to;
|
154 | };
|
155 |
|
156 | var objectAssign = Object.freeze({
|
157 | __proto__: null
|
158 | });
|
159 |
|
160 | var assign = getAugmentedNamespace(objectAssign);
|
161 |
|
162 | function ca(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else {var l=[d,c,e,g,h,f],m=0;a=Error(b.replace(/%s/g,function(){return l[m++]}));a.name="Invariant Violation";}a.framesToPop=1;throw a;}}
|
163 | function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);ca(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d);}var C={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D={};
|
164 | function E(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C;}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?B("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C;}var H=G.prototype=new F;
|
165 | H.constructor=G;assign(H,E.prototype);H.isPureReactComponent=!0;
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
175 |
|
176 | var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
177 |
|
178 | var printWarning = function() {};
|
179 |
|
180 | {
|
181 | var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
182 | var loggedTypeFailures = {};
|
183 |
|
184 | printWarning = function(text) {
|
185 | var message = 'Warning: ' + text;
|
186 | if (typeof console !== 'undefined') {
|
187 | console.error(message);
|
188 | }
|
189 | try {
|
190 |
|
191 |
|
192 |
|
193 | throw new Error(message);
|
194 | } catch (x) {}
|
195 | };
|
196 | }
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
210 | {
|
211 | for (var typeSpecName in typeSpecs) {
|
212 | if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
213 | var error;
|
214 |
|
215 |
|
216 |
|
217 | try {
|
218 |
|
219 |
|
220 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
221 | var err = Error(
|
222 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
223 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
224 | );
|
225 | err.name = 'Invariant Violation';
|
226 | throw err;
|
227 | }
|
228 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
229 | } catch (ex) {
|
230 | error = ex;
|
231 | }
|
232 | if (error && !(error instanceof Error)) {
|
233 | printWarning(
|
234 | (componentName || 'React class') + ': type specification of ' +
|
235 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
236 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
237 | 'You may have forgotten to pass an argument to the type checker ' +
|
238 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
239 | 'shape all require an argument).'
|
240 | );
|
241 |
|
242 | }
|
243 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
244 |
|
245 |
|
246 | loggedTypeFailures[error.message] = true;
|
247 |
|
248 | var stack = getStack ? getStack() : '';
|
249 |
|
250 | printWarning(
|
251 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
252 | );
|
253 | }
|
254 | }
|
255 | }
|
256 | }
|
257 | }
|
258 |
|
259 | var checkPropTypes_1 = checkPropTypes;
|
260 |
|
261 | var react_development = createCommonjsModule(function (module) {
|
262 |
|
263 |
|
264 |
|
265 | {
|
266 | (function() {
|
267 |
|
268 | var _assign = assign;
|
269 | var checkPropTypes = checkPropTypes_1;
|
270 |
|
271 |
|
272 |
|
273 | var ReactVersion = '16.8.6';
|
274 |
|
275 |
|
276 |
|
277 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
278 |
|
279 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
280 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
281 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
282 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
283 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
284 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
285 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
286 |
|
287 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
288 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
289 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
290 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
291 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
292 |
|
293 | var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
294 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
295 |
|
296 | function getIteratorFn(maybeIterable) {
|
297 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
298 | return null;
|
299 | }
|
300 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
301 | if (typeof maybeIterator === 'function') {
|
302 | return maybeIterator;
|
303 | }
|
304 | return null;
|
305 | }
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 | var validateFormat = function () {};
|
319 |
|
320 | {
|
321 | validateFormat = function (format) {
|
322 | if (format === undefined) {
|
323 | throw new Error('invariant requires an error message argument');
|
324 | }
|
325 | };
|
326 | }
|
327 |
|
328 | function invariant(condition, format, a, b, c, d, e, f) {
|
329 | validateFormat(format);
|
330 |
|
331 | if (!condition) {
|
332 | var error = void 0;
|
333 | if (format === undefined) {
|
334 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
335 | } else {
|
336 | var args = [a, b, c, d, e, f];
|
337 | var argIndex = 0;
|
338 | error = new Error(format.replace(/%s/g, function () {
|
339 | return args[argIndex++];
|
340 | }));
|
341 | error.name = 'Invariant Violation';
|
342 | }
|
343 |
|
344 | error.framesToPop = 1;
|
345 | throw error;
|
346 | }
|
347 | }
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 | var lowPriorityWarning = function () {};
|
367 |
|
368 | {
|
369 | var printWarning = function (format) {
|
370 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
371 | args[_key - 1] = arguments[_key];
|
372 | }
|
373 |
|
374 | var argIndex = 0;
|
375 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
376 | return args[argIndex++];
|
377 | });
|
378 | if (typeof console !== 'undefined') {
|
379 | console.warn(message);
|
380 | }
|
381 | try {
|
382 |
|
383 |
|
384 |
|
385 | throw new Error(message);
|
386 | } catch (x) {}
|
387 | };
|
388 |
|
389 | lowPriorityWarning = function (condition, format) {
|
390 | if (format === undefined) {
|
391 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
392 | }
|
393 | if (!condition) {
|
394 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
395 | args[_key2 - 2] = arguments[_key2];
|
396 | }
|
397 |
|
398 | printWarning.apply(undefined, [format].concat(args));
|
399 | }
|
400 | };
|
401 | }
|
402 |
|
403 | var lowPriorityWarning$1 = lowPriorityWarning;
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 | var warningWithoutStack = function () {};
|
413 |
|
414 | {
|
415 | warningWithoutStack = function (condition, format) {
|
416 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
417 | args[_key - 2] = arguments[_key];
|
418 | }
|
419 |
|
420 | if (format === undefined) {
|
421 | throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
422 | }
|
423 | if (args.length > 8) {
|
424 |
|
425 | throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
426 | }
|
427 | if (condition) {
|
428 | return;
|
429 | }
|
430 | if (typeof console !== 'undefined') {
|
431 | var argsWithFormat = args.map(function (item) {
|
432 | return '' + item;
|
433 | });
|
434 | argsWithFormat.unshift('Warning: ' + format);
|
435 |
|
436 |
|
437 |
|
438 | Function.prototype.apply.call(console.error, console, argsWithFormat);
|
439 | }
|
440 | try {
|
441 |
|
442 |
|
443 |
|
444 | var argIndex = 0;
|
445 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
446 | return args[argIndex++];
|
447 | });
|
448 | throw new Error(message);
|
449 | } catch (x) {}
|
450 | };
|
451 | }
|
452 |
|
453 | var warningWithoutStack$1 = warningWithoutStack;
|
454 |
|
455 | var didWarnStateUpdateForUnmountedComponent = {};
|
456 |
|
457 | function warnNoop(publicInstance, callerName) {
|
458 | {
|
459 | var _constructor = publicInstance.constructor;
|
460 | var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
461 | var warningKey = componentName + '.' + callerName;
|
462 | if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
463 | return;
|
464 | }
|
465 | warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
466 | didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
467 | }
|
468 | }
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | var ReactNoopUpdateQueue = {
|
474 | |
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 | isMounted: function (publicInstance) {
|
482 | return false;
|
483 | },
|
484 |
|
485 | |
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
501 | warnNoop(publicInstance, 'forceUpdate');
|
502 | },
|
503 |
|
504 | |
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 | enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
518 | warnNoop(publicInstance, 'replaceState');
|
519 | },
|
520 |
|
521 | |
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
534 | warnNoop(publicInstance, 'setState');
|
535 | }
|
536 | };
|
537 |
|
538 | var emptyObject = {};
|
539 | {
|
540 | Object.freeze(emptyObject);
|
541 | }
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | function Component(props, context, updater) {
|
547 | this.props = props;
|
548 | this.context = context;
|
549 |
|
550 | this.refs = emptyObject;
|
551 |
|
552 |
|
553 | this.updater = updater || ReactNoopUpdateQueue;
|
554 | }
|
555 |
|
556 | Component.prototype.isReactComponent = {};
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 | Component.prototype.setState = function (partialState, callback) {
|
584 | !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
585 | this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
586 | };
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 | Component.prototype.forceUpdate = function (callback) {
|
603 | this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
604 | };
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 | {
|
612 | var deprecatedAPIs = {
|
613 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
614 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
615 | };
|
616 | var defineDeprecationWarning = function (methodName, info) {
|
617 | Object.defineProperty(Component.prototype, methodName, {
|
618 | get: function () {
|
619 | lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
620 | return undefined;
|
621 | }
|
622 | });
|
623 | };
|
624 | for (var fnName in deprecatedAPIs) {
|
625 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
626 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
627 | }
|
628 | }
|
629 | }
|
630 |
|
631 | function ComponentDummy() {}
|
632 | ComponentDummy.prototype = Component.prototype;
|
633 |
|
634 |
|
635 |
|
636 |
|
637 | function PureComponent(props, context, updater) {
|
638 | this.props = props;
|
639 | this.context = context;
|
640 |
|
641 | this.refs = emptyObject;
|
642 | this.updater = updater || ReactNoopUpdateQueue;
|
643 | }
|
644 |
|
645 | var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
646 | pureComponentPrototype.constructor = PureComponent;
|
647 |
|
648 | _assign(pureComponentPrototype, Component.prototype);
|
649 | pureComponentPrototype.isPureReactComponent = true;
|
650 |
|
651 |
|
652 | function createRef() {
|
653 | var refObject = {
|
654 | current: null
|
655 | };
|
656 | {
|
657 | Object.seal(refObject);
|
658 | }
|
659 | return refObject;
|
660 | }
|
661 |
|
662 |
|
663 |
|
664 |
|
665 | var ReactCurrentDispatcher = {
|
666 | |
667 |
|
668 |
|
669 |
|
670 | current: null
|
671 | };
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 | var ReactCurrentOwner = {
|
680 | |
681 |
|
682 |
|
683 |
|
684 | current: null
|
685 | };
|
686 |
|
687 | var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
688 |
|
689 | var describeComponentFrame = function (name, source, ownerName) {
|
690 | var sourceInfo = '';
|
691 | if (source) {
|
692 | var path = source.fileName;
|
693 | var fileName = path.replace(BEFORE_SLASH_RE, '');
|
694 | {
|
695 |
|
696 |
|
697 | if (/^index\./.test(fileName)) {
|
698 | var match = path.match(BEFORE_SLASH_RE);
|
699 | if (match) {
|
700 | var pathBeforeSlash = match[1];
|
701 | if (pathBeforeSlash) {
|
702 | var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
703 | fileName = folderName + '/' + fileName;
|
704 | }
|
705 | }
|
706 | }
|
707 | }
|
708 | sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
709 | } else if (ownerName) {
|
710 | sourceInfo = ' (created by ' + ownerName + ')';
|
711 | }
|
712 | return '\n in ' + (name || 'Unknown') + sourceInfo;
|
713 | };
|
714 |
|
715 | var Resolved = 1;
|
716 |
|
717 |
|
718 | function refineResolvedLazyComponent(lazyComponent) {
|
719 | return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
720 | }
|
721 |
|
722 | function getWrappedName(outerType, innerType, wrapperName) {
|
723 | var functionName = innerType.displayName || innerType.name || '';
|
724 | return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
725 | }
|
726 |
|
727 | function getComponentName(type) {
|
728 | if (type == null) {
|
729 |
|
730 | return null;
|
731 | }
|
732 | {
|
733 | if (typeof type.tag === 'number') {
|
734 | warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
735 | }
|
736 | }
|
737 | if (typeof type === 'function') {
|
738 | return type.displayName || type.name || null;
|
739 | }
|
740 | if (typeof type === 'string') {
|
741 | return type;
|
742 | }
|
743 | switch (type) {
|
744 | case REACT_CONCURRENT_MODE_TYPE:
|
745 | return 'ConcurrentMode';
|
746 | case REACT_FRAGMENT_TYPE:
|
747 | return 'Fragment';
|
748 | case REACT_PORTAL_TYPE:
|
749 | return 'Portal';
|
750 | case REACT_PROFILER_TYPE:
|
751 | return 'Profiler';
|
752 | case REACT_STRICT_MODE_TYPE:
|
753 | return 'StrictMode';
|
754 | case REACT_SUSPENSE_TYPE:
|
755 | return 'Suspense';
|
756 | }
|
757 | if (typeof type === 'object') {
|
758 | switch (type.$$typeof) {
|
759 | case REACT_CONTEXT_TYPE:
|
760 | return 'Context.Consumer';
|
761 | case REACT_PROVIDER_TYPE:
|
762 | return 'Context.Provider';
|
763 | case REACT_FORWARD_REF_TYPE:
|
764 | return getWrappedName(type, type.render, 'ForwardRef');
|
765 | case REACT_MEMO_TYPE:
|
766 | return getComponentName(type.type);
|
767 | case REACT_LAZY_TYPE:
|
768 | {
|
769 | var thenable = type;
|
770 | var resolvedThenable = refineResolvedLazyComponent(thenable);
|
771 | if (resolvedThenable) {
|
772 | return getComponentName(resolvedThenable);
|
773 | }
|
774 | }
|
775 | }
|
776 | }
|
777 | return null;
|
778 | }
|
779 |
|
780 | var ReactDebugCurrentFrame = {};
|
781 |
|
782 | var currentlyValidatingElement = null;
|
783 |
|
784 | function setCurrentlyValidatingElement(element) {
|
785 | {
|
786 | currentlyValidatingElement = element;
|
787 | }
|
788 | }
|
789 |
|
790 | {
|
791 |
|
792 | ReactDebugCurrentFrame.getCurrentStack = null;
|
793 |
|
794 | ReactDebugCurrentFrame.getStackAddendum = function () {
|
795 | var stack = '';
|
796 |
|
797 |
|
798 | if (currentlyValidatingElement) {
|
799 | var name = getComponentName(currentlyValidatingElement.type);
|
800 | var owner = currentlyValidatingElement._owner;
|
801 | stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
802 | }
|
803 |
|
804 |
|
805 | var impl = ReactDebugCurrentFrame.getCurrentStack;
|
806 | if (impl) {
|
807 | stack += impl() || '';
|
808 | }
|
809 |
|
810 | return stack;
|
811 | };
|
812 | }
|
813 |
|
814 | var ReactSharedInternals = {
|
815 | ReactCurrentDispatcher: ReactCurrentDispatcher,
|
816 | ReactCurrentOwner: ReactCurrentOwner,
|
817 |
|
818 | assign: _assign
|
819 | };
|
820 |
|
821 | {
|
822 | _assign(ReactSharedInternals, {
|
823 |
|
824 | ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
825 |
|
826 |
|
827 | ReactComponentTreeHook: {}
|
828 | });
|
829 | }
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 | var warning = warningWithoutStack$1;
|
839 |
|
840 | {
|
841 | warning = function (condition, format) {
|
842 | if (condition) {
|
843 | return;
|
844 | }
|
845 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
846 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
847 |
|
848 |
|
849 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
850 | args[_key - 2] = arguments[_key];
|
851 | }
|
852 |
|
853 | warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
|
854 | };
|
855 | }
|
856 |
|
857 | var warning$1 = warning;
|
858 |
|
859 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
860 |
|
861 | var RESERVED_PROPS = {
|
862 | key: true,
|
863 | ref: true,
|
864 | __self: true,
|
865 | __source: true
|
866 | };
|
867 |
|
868 | var specialPropKeyWarningShown = void 0;
|
869 | var specialPropRefWarningShown = void 0;
|
870 |
|
871 | function hasValidRef(config) {
|
872 | {
|
873 | if (hasOwnProperty.call(config, 'ref')) {
|
874 | var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
875 | if (getter && getter.isReactWarning) {
|
876 | return false;
|
877 | }
|
878 | }
|
879 | }
|
880 | return config.ref !== undefined;
|
881 | }
|
882 |
|
883 | function hasValidKey(config) {
|
884 | {
|
885 | if (hasOwnProperty.call(config, 'key')) {
|
886 | var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
887 | if (getter && getter.isReactWarning) {
|
888 | return false;
|
889 | }
|
890 | }
|
891 | }
|
892 | return config.key !== undefined;
|
893 | }
|
894 |
|
895 | function defineKeyPropWarningGetter(props, displayName) {
|
896 | var warnAboutAccessingKey = function () {
|
897 | if (!specialPropKeyWarningShown) {
|
898 | specialPropKeyWarningShown = true;
|
899 | warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
900 | }
|
901 | };
|
902 | warnAboutAccessingKey.isReactWarning = true;
|
903 | Object.defineProperty(props, 'key', {
|
904 | get: warnAboutAccessingKey,
|
905 | configurable: true
|
906 | });
|
907 | }
|
908 |
|
909 | function defineRefPropWarningGetter(props, displayName) {
|
910 | var warnAboutAccessingRef = function () {
|
911 | if (!specialPropRefWarningShown) {
|
912 | specialPropRefWarningShown = true;
|
913 | warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
914 | }
|
915 | };
|
916 | warnAboutAccessingRef.isReactWarning = true;
|
917 | Object.defineProperty(props, 'ref', {
|
918 | get: warnAboutAccessingRef,
|
919 | configurable: true
|
920 | });
|
921 | }
|
922 |
|
923 | /**
|
924 | * Factory method to create a new React element. This no longer adheres to
|
925 | * the class pattern, so do not use new to call it. Also, no instanceof check
|
926 | * will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
927 | * if something is a React Element.
|
928 | *
|
929 | * @param {*} type
|
930 | * @param {*} key
|
931 | * @param {string|object} ref
|
932 | * @param {*} self A *temporary* helper to detect places where `this` is
|
933 | * different from the `owner` when React.createElement is called, so that we
|
934 | * can warn. We want to get rid of owner and replace string `ref`s with arrow
|
935 | * functions, and as long as `this` and owner are the same, there will be no
|
936 | * change in behavior.
|
937 | * @param {*} source An annotation object (added by a transpiler or otherwise)
|
938 | * indicating filename, line number, and/or other information.
|
939 | * @param {*} owner
|
940 | * @param {*} props
|
941 | * @internal
|
942 | */
|
943 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
944 | var element = {
|
945 |
|
946 | $$typeof: REACT_ELEMENT_TYPE,
|
947 |
|
948 |
|
949 | type: type,
|
950 | key: key,
|
951 | ref: ref,
|
952 | props: props,
|
953 |
|
954 |
|
955 | _owner: owner
|
956 | };
|
957 |
|
958 | {
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | element._store = {};
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 | Object.defineProperty(element._store, 'validated', {
|
970 | configurable: false,
|
971 | enumerable: false,
|
972 | writable: true,
|
973 | value: false
|
974 | });
|
975 |
|
976 | Object.defineProperty(element, '_self', {
|
977 | configurable: false,
|
978 | enumerable: false,
|
979 | writable: false,
|
980 | value: self
|
981 | });
|
982 |
|
983 |
|
984 | Object.defineProperty(element, '_source', {
|
985 | configurable: false,
|
986 | enumerable: false,
|
987 | writable: false,
|
988 | value: source
|
989 | });
|
990 | if (Object.freeze) {
|
991 | Object.freeze(element.props);
|
992 | Object.freeze(element);
|
993 | }
|
994 | }
|
995 |
|
996 | return element;
|
997 | };
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 | function createElement(type, config, children) {
|
1004 | var propName = void 0;
|
1005 |
|
1006 |
|
1007 | var props = {};
|
1008 |
|
1009 | var key = null;
|
1010 | var ref = null;
|
1011 | var self = null;
|
1012 | var source = null;
|
1013 |
|
1014 | if (config != null) {
|
1015 | if (hasValidRef(config)) {
|
1016 | ref = config.ref;
|
1017 | }
|
1018 | if (hasValidKey(config)) {
|
1019 | key = '' + config.key;
|
1020 | }
|
1021 |
|
1022 | self = config.__self === undefined ? null : config.__self;
|
1023 | source = config.__source === undefined ? null : config.__source;
|
1024 |
|
1025 | for (propName in config) {
|
1026 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1027 | props[propName] = config[propName];
|
1028 | }
|
1029 | }
|
1030 | }
|
1031 |
|
1032 |
|
1033 |
|
1034 | var childrenLength = arguments.length - 2;
|
1035 | if (childrenLength === 1) {
|
1036 | props.children = children;
|
1037 | } else if (childrenLength > 1) {
|
1038 | var childArray = Array(childrenLength);
|
1039 | for (var i = 0; i < childrenLength; i++) {
|
1040 | childArray[i] = arguments[i + 2];
|
1041 | }
|
1042 | {
|
1043 | if (Object.freeze) {
|
1044 | Object.freeze(childArray);
|
1045 | }
|
1046 | }
|
1047 | props.children = childArray;
|
1048 | }
|
1049 |
|
1050 |
|
1051 | if (type && type.defaultProps) {
|
1052 | var defaultProps = type.defaultProps;
|
1053 | for (propName in defaultProps) {
|
1054 | if (props[propName] === undefined) {
|
1055 | props[propName] = defaultProps[propName];
|
1056 | }
|
1057 | }
|
1058 | }
|
1059 | {
|
1060 | if (key || ref) {
|
1061 | var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
1062 | if (key) {
|
1063 | defineKeyPropWarningGetter(props, displayName);
|
1064 | }
|
1065 | if (ref) {
|
1066 | defineRefPropWarningGetter(props, displayName);
|
1067 | }
|
1068 | }
|
1069 | }
|
1070 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
1071 | }
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 | function cloneAndReplaceKey(oldElement, newKey) {
|
1080 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
1081 |
|
1082 | return newElement;
|
1083 | }
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 | function cloneElement(element, config, children) {
|
1090 | !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
|
1091 |
|
1092 | var propName = void 0;
|
1093 |
|
1094 |
|
1095 | var props = _assign({}, element.props);
|
1096 |
|
1097 |
|
1098 | var key = element.key;
|
1099 | var ref = element.ref;
|
1100 |
|
1101 | var self = element._self;
|
1102 |
|
1103 |
|
1104 |
|
1105 | var source = element._source;
|
1106 |
|
1107 |
|
1108 | var owner = element._owner;
|
1109 |
|
1110 | if (config != null) {
|
1111 | if (hasValidRef(config)) {
|
1112 |
|
1113 | ref = config.ref;
|
1114 | owner = ReactCurrentOwner.current;
|
1115 | }
|
1116 | if (hasValidKey(config)) {
|
1117 | key = '' + config.key;
|
1118 | }
|
1119 |
|
1120 |
|
1121 | var defaultProps = void 0;
|
1122 | if (element.type && element.type.defaultProps) {
|
1123 | defaultProps = element.type.defaultProps;
|
1124 | }
|
1125 | for (propName in config) {
|
1126 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1127 | if (config[propName] === undefined && defaultProps !== undefined) {
|
1128 |
|
1129 | props[propName] = defaultProps[propName];
|
1130 | } else {
|
1131 | props[propName] = config[propName];
|
1132 | }
|
1133 | }
|
1134 | }
|
1135 | }
|
1136 |
|
1137 |
|
1138 |
|
1139 | var childrenLength = arguments.length - 2;
|
1140 | if (childrenLength === 1) {
|
1141 | props.children = children;
|
1142 | } else if (childrenLength > 1) {
|
1143 | var childArray = Array(childrenLength);
|
1144 | for (var i = 0; i < childrenLength; i++) {
|
1145 | childArray[i] = arguments[i + 2];
|
1146 | }
|
1147 | props.children = childArray;
|
1148 | }
|
1149 |
|
1150 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
1151 | }
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 | function isValidElement(object) {
|
1161 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
1162 | }
|
1163 |
|
1164 | var SEPARATOR = '.';
|
1165 | var SUBSEPARATOR = ':';
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 | function escape(key) {
|
1174 | var escapeRegex = /[=:]/g;
|
1175 | var escaperLookup = {
|
1176 | '=': '=0',
|
1177 | ':': '=2'
|
1178 | };
|
1179 | var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
1180 | return escaperLookup[match];
|
1181 | });
|
1182 |
|
1183 | return '$' + escapedString;
|
1184 | }
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 | var didWarnAboutMaps = false;
|
1192 |
|
1193 | var userProvidedKeyEscapeRegex = /\/+/g;
|
1194 | function escapeUserProvidedKey(text) {
|
1195 | return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
1196 | }
|
1197 |
|
1198 | var POOL_SIZE = 10;
|
1199 | var traverseContextPool = [];
|
1200 | function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
1201 | if (traverseContextPool.length) {
|
1202 | var traverseContext = traverseContextPool.pop();
|
1203 | traverseContext.result = mapResult;
|
1204 | traverseContext.keyPrefix = keyPrefix;
|
1205 | traverseContext.func = mapFunction;
|
1206 | traverseContext.context = mapContext;
|
1207 | traverseContext.count = 0;
|
1208 | return traverseContext;
|
1209 | } else {
|
1210 | return {
|
1211 | result: mapResult,
|
1212 | keyPrefix: keyPrefix,
|
1213 | func: mapFunction,
|
1214 | context: mapContext,
|
1215 | count: 0
|
1216 | };
|
1217 | }
|
1218 | }
|
1219 |
|
1220 | function releaseTraverseContext(traverseContext) {
|
1221 | traverseContext.result = null;
|
1222 | traverseContext.keyPrefix = null;
|
1223 | traverseContext.func = null;
|
1224 | traverseContext.context = null;
|
1225 | traverseContext.count = 0;
|
1226 | if (traverseContextPool.length < POOL_SIZE) {
|
1227 | traverseContextPool.push(traverseContext);
|
1228 | }
|
1229 | }
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
1240 | var type = typeof children;
|
1241 |
|
1242 | if (type === 'undefined' || type === 'boolean') {
|
1243 |
|
1244 | children = null;
|
1245 | }
|
1246 |
|
1247 | var invokeCallback = false;
|
1248 |
|
1249 | if (children === null) {
|
1250 | invokeCallback = true;
|
1251 | } else {
|
1252 | switch (type) {
|
1253 | case 'string':
|
1254 | case 'number':
|
1255 | invokeCallback = true;
|
1256 | break;
|
1257 | case 'object':
|
1258 | switch (children.$$typeof) {
|
1259 | case REACT_ELEMENT_TYPE:
|
1260 | case REACT_PORTAL_TYPE:
|
1261 | invokeCallback = true;
|
1262 | }
|
1263 | }
|
1264 | }
|
1265 |
|
1266 | if (invokeCallback) {
|
1267 | callback(traverseContext, children,
|
1268 |
|
1269 |
|
1270 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
1271 | return 1;
|
1272 | }
|
1273 |
|
1274 | var child = void 0;
|
1275 | var nextName = void 0;
|
1276 | var subtreeCount = 0;
|
1277 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1278 |
|
1279 | if (Array.isArray(children)) {
|
1280 | for (var i = 0; i < children.length; i++) {
|
1281 | child = children[i];
|
1282 | nextName = nextNamePrefix + getComponentKey(child, i);
|
1283 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1284 | }
|
1285 | } else {
|
1286 | var iteratorFn = getIteratorFn(children);
|
1287 | if (typeof iteratorFn === 'function') {
|
1288 | {
|
1289 |
|
1290 | if (iteratorFn === children.entries) {
|
1291 | !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
|
1292 | didWarnAboutMaps = true;
|
1293 | }
|
1294 | }
|
1295 |
|
1296 | var iterator = iteratorFn.call(children);
|
1297 | var step = void 0;
|
1298 | var ii = 0;
|
1299 | while (!(step = iterator.next()).done) {
|
1300 | child = step.value;
|
1301 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
1302 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1303 | }
|
1304 | } else if (type === 'object') {
|
1305 | var addendum = '';
|
1306 | {
|
1307 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
1308 | }
|
1309 | var childrenString = '' + children;
|
1310 | invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
|
1311 | }
|
1312 | }
|
1313 |
|
1314 | return subtreeCount;
|
1315 | }
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 | function traverseAllChildren(children, callback, traverseContext) {
|
1334 | if (children == null) {
|
1335 | return 0;
|
1336 | }
|
1337 |
|
1338 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
1339 | }
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 | function getComponentKey(component, index) {
|
1349 |
|
1350 |
|
1351 | if (typeof component === 'object' && component !== null && component.key != null) {
|
1352 |
|
1353 | return escape(component.key);
|
1354 | }
|
1355 |
|
1356 | return index.toString(36);
|
1357 | }
|
1358 |
|
1359 | function forEachSingleChild(bookKeeping, child, name) {
|
1360 | var func = bookKeeping.func,
|
1361 | context = bookKeeping.context;
|
1362 |
|
1363 | func.call(context, child, bookKeeping.count++);
|
1364 | }
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 | function forEachChildren(children, forEachFunc, forEachContext) {
|
1379 | if (children == null) {
|
1380 | return children;
|
1381 | }
|
1382 | var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
1383 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
1384 | releaseTraverseContext(traverseContext);
|
1385 | }
|
1386 |
|
1387 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
1388 | var result = bookKeeping.result,
|
1389 | keyPrefix = bookKeeping.keyPrefix,
|
1390 | func = bookKeeping.func,
|
1391 | context = bookKeeping.context;
|
1392 |
|
1393 |
|
1394 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
1395 | if (Array.isArray(mappedChild)) {
|
1396 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
1397 | return c;
|
1398 | });
|
1399 | } else if (mappedChild != null) {
|
1400 | if (isValidElement(mappedChild)) {
|
1401 | mappedChild = cloneAndReplaceKey(mappedChild,
|
1402 |
|
1403 |
|
1404 | keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
1405 | }
|
1406 | result.push(mappedChild);
|
1407 | }
|
1408 | }
|
1409 |
|
1410 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
1411 | var escapedPrefix = '';
|
1412 | if (prefix != null) {
|
1413 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
1414 | }
|
1415 | var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
1416 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
1417 | releaseTraverseContext(traverseContext);
|
1418 | }
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 | function mapChildren(children, func, context) {
|
1434 | if (children == null) {
|
1435 | return children;
|
1436 | }
|
1437 | var result = [];
|
1438 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
1439 | return result;
|
1440 | }
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 | function countChildren(children) {
|
1452 | return traverseAllChildren(children, function () {
|
1453 | return null;
|
1454 | }, null);
|
1455 | }
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 | function toArray(children) {
|
1464 | var result = [];
|
1465 | mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
1466 | return child;
|
1467 | });
|
1468 | return result;
|
1469 | }
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 | function onlyChild(children) {
|
1486 | !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
1487 | return children;
|
1488 | }
|
1489 |
|
1490 | function createContext(defaultValue, calculateChangedBits) {
|
1491 | if (calculateChangedBits === undefined) {
|
1492 | calculateChangedBits = null;
|
1493 | } else {
|
1494 | {
|
1495 | !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
|
1496 | }
|
1497 | }
|
1498 |
|
1499 | var context = {
|
1500 | $$typeof: REACT_CONTEXT_TYPE,
|
1501 | _calculateChangedBits: calculateChangedBits,
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 | _currentValue: defaultValue,
|
1508 | _currentValue2: defaultValue,
|
1509 |
|
1510 |
|
1511 | _threadCount: 0,
|
1512 |
|
1513 | Provider: null,
|
1514 | Consumer: null
|
1515 | };
|
1516 |
|
1517 | context.Provider = {
|
1518 | $$typeof: REACT_PROVIDER_TYPE,
|
1519 | _context: context
|
1520 | };
|
1521 |
|
1522 | var hasWarnedAboutUsingNestedContextConsumers = false;
|
1523 | var hasWarnedAboutUsingConsumerProvider = false;
|
1524 |
|
1525 | {
|
1526 |
|
1527 |
|
1528 |
|
1529 | var Consumer = {
|
1530 | $$typeof: REACT_CONTEXT_TYPE,
|
1531 | _context: context,
|
1532 | _calculateChangedBits: context._calculateChangedBits
|
1533 | };
|
1534 |
|
1535 | Object.defineProperties(Consumer, {
|
1536 | Provider: {
|
1537 | get: function () {
|
1538 | if (!hasWarnedAboutUsingConsumerProvider) {
|
1539 | hasWarnedAboutUsingConsumerProvider = true;
|
1540 | warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
1541 | }
|
1542 | return context.Provider;
|
1543 | },
|
1544 | set: function (_Provider) {
|
1545 | context.Provider = _Provider;
|
1546 | }
|
1547 | },
|
1548 | _currentValue: {
|
1549 | get: function () {
|
1550 | return context._currentValue;
|
1551 | },
|
1552 | set: function (_currentValue) {
|
1553 | context._currentValue = _currentValue;
|
1554 | }
|
1555 | },
|
1556 | _currentValue2: {
|
1557 | get: function () {
|
1558 | return context._currentValue2;
|
1559 | },
|
1560 | set: function (_currentValue2) {
|
1561 | context._currentValue2 = _currentValue2;
|
1562 | }
|
1563 | },
|
1564 | _threadCount: {
|
1565 | get: function () {
|
1566 | return context._threadCount;
|
1567 | },
|
1568 | set: function (_threadCount) {
|
1569 | context._threadCount = _threadCount;
|
1570 | }
|
1571 | },
|
1572 | Consumer: {
|
1573 | get: function () {
|
1574 | if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1575 | hasWarnedAboutUsingNestedContextConsumers = true;
|
1576 | warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
1577 | }
|
1578 | return context.Consumer;
|
1579 | }
|
1580 | }
|
1581 | });
|
1582 |
|
1583 | context.Consumer = Consumer;
|
1584 | }
|
1585 |
|
1586 | {
|
1587 | context._currentRenderer = null;
|
1588 | context._currentRenderer2 = null;
|
1589 | }
|
1590 |
|
1591 | return context;
|
1592 | }
|
1593 |
|
1594 | function lazy(ctor) {
|
1595 | var lazyType = {
|
1596 | $$typeof: REACT_LAZY_TYPE,
|
1597 | _ctor: ctor,
|
1598 |
|
1599 | _status: -1,
|
1600 | _result: null
|
1601 | };
|
1602 |
|
1603 | {
|
1604 |
|
1605 | var defaultProps = void 0;
|
1606 | var propTypes = void 0;
|
1607 | Object.defineProperties(lazyType, {
|
1608 | defaultProps: {
|
1609 | configurable: true,
|
1610 | get: function () {
|
1611 | return defaultProps;
|
1612 | },
|
1613 | set: function (newDefaultProps) {
|
1614 | warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1615 | defaultProps = newDefaultProps;
|
1616 |
|
1617 | Object.defineProperty(lazyType, 'defaultProps', {
|
1618 | enumerable: true
|
1619 | });
|
1620 | }
|
1621 | },
|
1622 | propTypes: {
|
1623 | configurable: true,
|
1624 | get: function () {
|
1625 | return propTypes;
|
1626 | },
|
1627 | set: function (newPropTypes) {
|
1628 | warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1629 | propTypes = newPropTypes;
|
1630 |
|
1631 | Object.defineProperty(lazyType, 'propTypes', {
|
1632 | enumerable: true
|
1633 | });
|
1634 | }
|
1635 | }
|
1636 | });
|
1637 | }
|
1638 |
|
1639 | return lazyType;
|
1640 | }
|
1641 |
|
1642 | function forwardRef(render) {
|
1643 | {
|
1644 | if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1645 | warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
1646 | } else if (typeof render !== 'function') {
|
1647 | warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
1648 | } else {
|
1649 | !(
|
1650 |
|
1651 | render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
|
1652 | }
|
1653 |
|
1654 | if (render != null) {
|
1655 | !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
|
1656 | }
|
1657 | }
|
1658 |
|
1659 | return {
|
1660 | $$typeof: REACT_FORWARD_REF_TYPE,
|
1661 | render: render
|
1662 | };
|
1663 | }
|
1664 |
|
1665 | function isValidElementType(type) {
|
1666 | return typeof type === 'string' || typeof type === 'function' ||
|
1667 |
|
1668 | 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);
|
1669 | }
|
1670 |
|
1671 | function memo(type, compare) {
|
1672 | {
|
1673 | if (!isValidElementType(type)) {
|
1674 | warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
1675 | }
|
1676 | }
|
1677 | return {
|
1678 | $$typeof: REACT_MEMO_TYPE,
|
1679 | type: type,
|
1680 | compare: compare === undefined ? null : compare
|
1681 | };
|
1682 | }
|
1683 |
|
1684 | function resolveDispatcher() {
|
1685 | var dispatcher = ReactCurrentDispatcher.current;
|
1686 | !(dispatcher !== null) ? invariant(false, 'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.') : void 0;
|
1687 | return dispatcher;
|
1688 | }
|
1689 |
|
1690 | function useContext(Context, unstable_observedBits) {
|
1691 | var dispatcher = resolveDispatcher();
|
1692 | {
|
1693 | !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
|
1694 |
|
1695 |
|
1696 | if (Context._context !== undefined) {
|
1697 | var realContext = Context._context;
|
1698 |
|
1699 |
|
1700 | if (realContext.Consumer === Context) {
|
1701 | warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
1702 | } else if (realContext.Provider === Context) {
|
1703 | warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
1704 | }
|
1705 | }
|
1706 | }
|
1707 | return dispatcher.useContext(Context, unstable_observedBits);
|
1708 | }
|
1709 |
|
1710 | function useState(initialState) {
|
1711 | var dispatcher = resolveDispatcher();
|
1712 | return dispatcher.useState(initialState);
|
1713 | }
|
1714 |
|
1715 | function useReducer(reducer, initialArg, init) {
|
1716 | var dispatcher = resolveDispatcher();
|
1717 | return dispatcher.useReducer(reducer, initialArg, init);
|
1718 | }
|
1719 |
|
1720 | function useRef(initialValue) {
|
1721 | var dispatcher = resolveDispatcher();
|
1722 | return dispatcher.useRef(initialValue);
|
1723 | }
|
1724 |
|
1725 | function useEffect(create, inputs) {
|
1726 | var dispatcher = resolveDispatcher();
|
1727 | return dispatcher.useEffect(create, inputs);
|
1728 | }
|
1729 |
|
1730 | function useLayoutEffect(create, inputs) {
|
1731 | var dispatcher = resolveDispatcher();
|
1732 | return dispatcher.useLayoutEffect(create, inputs);
|
1733 | }
|
1734 |
|
1735 | function useCallback(callback, inputs) {
|
1736 | var dispatcher = resolveDispatcher();
|
1737 | return dispatcher.useCallback(callback, inputs);
|
1738 | }
|
1739 |
|
1740 | function useMemo(create, inputs) {
|
1741 | var dispatcher = resolveDispatcher();
|
1742 | return dispatcher.useMemo(create, inputs);
|
1743 | }
|
1744 |
|
1745 | function useImperativeHandle(ref, create, inputs) {
|
1746 | var dispatcher = resolveDispatcher();
|
1747 | return dispatcher.useImperativeHandle(ref, create, inputs);
|
1748 | }
|
1749 |
|
1750 | function useDebugValue(value, formatterFn) {
|
1751 | {
|
1752 | var dispatcher = resolveDispatcher();
|
1753 | return dispatcher.useDebugValue(value, formatterFn);
|
1754 | }
|
1755 | }
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 | var propTypesMisspellWarningShown = void 0;
|
1765 |
|
1766 | {
|
1767 | propTypesMisspellWarningShown = false;
|
1768 | }
|
1769 |
|
1770 | function getDeclarationErrorAddendum() {
|
1771 | if (ReactCurrentOwner.current) {
|
1772 | var name = getComponentName(ReactCurrentOwner.current.type);
|
1773 | if (name) {
|
1774 | return '\n\nCheck the render method of `' + name + '`.';
|
1775 | }
|
1776 | }
|
1777 | return '';
|
1778 | }
|
1779 |
|
1780 | function getSourceInfoErrorAddendum(elementProps) {
|
1781 | if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
1782 | var source = elementProps.__source;
|
1783 | var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
1784 | var lineNumber = source.lineNumber;
|
1785 | return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
1786 | }
|
1787 | return '';
|
1788 | }
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 | var ownerHasKeyUseWarning = {};
|
1796 |
|
1797 | function getCurrentComponentErrorInfo(parentType) {
|
1798 | var info = getDeclarationErrorAddendum();
|
1799 |
|
1800 | if (!info) {
|
1801 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
1802 | if (parentName) {
|
1803 | info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
1804 | }
|
1805 | }
|
1806 | return info;
|
1807 | }
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 | function validateExplicitKey(element, parentType) {
|
1821 | if (!element._store || element._store.validated || element.key != null) {
|
1822 | return;
|
1823 | }
|
1824 | element._store.validated = true;
|
1825 |
|
1826 | var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1827 | if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1828 | return;
|
1829 | }
|
1830 | ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 | var childOwner = '';
|
1836 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
1837 |
|
1838 | childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
|
1839 | }
|
1840 |
|
1841 | setCurrentlyValidatingElement(element);
|
1842 | {
|
1843 | warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
1844 | }
|
1845 | setCurrentlyValidatingElement(null);
|
1846 | }
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 | function validateChildKeys(node, parentType) {
|
1858 | if (typeof node !== 'object') {
|
1859 | return;
|
1860 | }
|
1861 | if (Array.isArray(node)) {
|
1862 | for (var i = 0; i < node.length; i++) {
|
1863 | var child = node[i];
|
1864 | if (isValidElement(child)) {
|
1865 | validateExplicitKey(child, parentType);
|
1866 | }
|
1867 | }
|
1868 | } else if (isValidElement(node)) {
|
1869 |
|
1870 | if (node._store) {
|
1871 | node._store.validated = true;
|
1872 | }
|
1873 | } else if (node) {
|
1874 | var iteratorFn = getIteratorFn(node);
|
1875 | if (typeof iteratorFn === 'function') {
|
1876 |
|
1877 |
|
1878 | if (iteratorFn !== node.entries) {
|
1879 | var iterator = iteratorFn.call(node);
|
1880 | var step = void 0;
|
1881 | while (!(step = iterator.next()).done) {
|
1882 | if (isValidElement(step.value)) {
|
1883 | validateExplicitKey(step.value, parentType);
|
1884 | }
|
1885 | }
|
1886 | }
|
1887 | }
|
1888 | }
|
1889 | }
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 | function validatePropTypes(element) {
|
1898 | var type = element.type;
|
1899 | if (type === null || type === undefined || typeof type === 'string') {
|
1900 | return;
|
1901 | }
|
1902 | var name = getComponentName(type);
|
1903 | var propTypes = void 0;
|
1904 | if (typeof type === 'function') {
|
1905 | propTypes = type.propTypes;
|
1906 | } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
1907 |
|
1908 |
|
1909 | type.$$typeof === REACT_MEMO_TYPE)) {
|
1910 | propTypes = type.propTypes;
|
1911 | } else {
|
1912 | return;
|
1913 | }
|
1914 | if (propTypes) {
|
1915 | setCurrentlyValidatingElement(element);
|
1916 | checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
1917 | setCurrentlyValidatingElement(null);
|
1918 | } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
1919 | propTypesMisspellWarningShown = true;
|
1920 | warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
1921 | }
|
1922 | if (typeof type.getDefaultProps === 'function') {
|
1923 | !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
1924 | }
|
1925 | }
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 | function validateFragmentProps(fragment) {
|
1932 | setCurrentlyValidatingElement(fragment);
|
1933 |
|
1934 | var keys = Object.keys(fragment.props);
|
1935 | for (var i = 0; i < keys.length; i++) {
|
1936 | var key = keys[i];
|
1937 | if (key !== 'children' && key !== 'key') {
|
1938 | warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
1939 | break;
|
1940 | }
|
1941 | }
|
1942 |
|
1943 | if (fragment.ref !== null) {
|
1944 | warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
1945 | }
|
1946 |
|
1947 | setCurrentlyValidatingElement(null);
|
1948 | }
|
1949 |
|
1950 | function createElementWithValidation(type, props, children) {
|
1951 | var validType = isValidElementType(type);
|
1952 |
|
1953 |
|
1954 |
|
1955 | if (!validType) {
|
1956 | var info = '';
|
1957 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
1958 | info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
1959 | }
|
1960 |
|
1961 | var sourceInfo = getSourceInfoErrorAddendum(props);
|
1962 | if (sourceInfo) {
|
1963 | info += sourceInfo;
|
1964 | } else {
|
1965 | info += getDeclarationErrorAddendum();
|
1966 | }
|
1967 |
|
1968 | var typeString = void 0;
|
1969 | if (type === null) {
|
1970 | typeString = 'null';
|
1971 | } else if (Array.isArray(type)) {
|
1972 | typeString = 'array';
|
1973 | } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
1974 | typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
1975 | info = ' Did you accidentally export a JSX literal instead of a component?';
|
1976 | } else {
|
1977 | typeString = typeof type;
|
1978 | }
|
1979 |
|
1980 | warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
1981 | }
|
1982 |
|
1983 | var element = createElement.apply(this, arguments);
|
1984 |
|
1985 |
|
1986 |
|
1987 | if (element == null) {
|
1988 | return element;
|
1989 | }
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 | if (validType) {
|
1997 | for (var i = 2; i < arguments.length; i++) {
|
1998 | validateChildKeys(arguments[i], type);
|
1999 | }
|
2000 | }
|
2001 |
|
2002 | if (type === REACT_FRAGMENT_TYPE) {
|
2003 | validateFragmentProps(element);
|
2004 | } else {
|
2005 | validatePropTypes(element);
|
2006 | }
|
2007 |
|
2008 | return element;
|
2009 | }
|
2010 |
|
2011 | function createFactoryWithValidation(type) {
|
2012 | var validatedFactory = createElementWithValidation.bind(null, type);
|
2013 | validatedFactory.type = type;
|
2014 |
|
2015 | {
|
2016 | Object.defineProperty(validatedFactory, 'type', {
|
2017 | enumerable: false,
|
2018 | get: function () {
|
2019 | lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
2020 | Object.defineProperty(this, 'type', {
|
2021 | value: type
|
2022 | });
|
2023 | return type;
|
2024 | }
|
2025 | });
|
2026 | }
|
2027 |
|
2028 | return validatedFactory;
|
2029 | }
|
2030 |
|
2031 | function cloneElementWithValidation(element, props, children) {
|
2032 | var newElement = cloneElement.apply(this, arguments);
|
2033 | for (var i = 2; i < arguments.length; i++) {
|
2034 | validateChildKeys(arguments[i], newElement.type);
|
2035 | }
|
2036 | validatePropTypes(newElement);
|
2037 | return newElement;
|
2038 | }
|
2039 |
|
2040 | var React = {
|
2041 | Children: {
|
2042 | map: mapChildren,
|
2043 | forEach: forEachChildren,
|
2044 | count: countChildren,
|
2045 | toArray: toArray,
|
2046 | only: onlyChild
|
2047 | },
|
2048 |
|
2049 | createRef: createRef,
|
2050 | Component: Component,
|
2051 | PureComponent: PureComponent,
|
2052 |
|
2053 | createContext: createContext,
|
2054 | forwardRef: forwardRef,
|
2055 | lazy: lazy,
|
2056 | memo: memo,
|
2057 |
|
2058 | useCallback: useCallback,
|
2059 | useContext: useContext,
|
2060 | useEffect: useEffect,
|
2061 | useImperativeHandle: useImperativeHandle,
|
2062 | useDebugValue: useDebugValue,
|
2063 | useLayoutEffect: useLayoutEffect,
|
2064 | useMemo: useMemo,
|
2065 | useReducer: useReducer,
|
2066 | useRef: useRef,
|
2067 | useState: useState,
|
2068 |
|
2069 | Fragment: REACT_FRAGMENT_TYPE,
|
2070 | StrictMode: REACT_STRICT_MODE_TYPE,
|
2071 | Suspense: REACT_SUSPENSE_TYPE,
|
2072 |
|
2073 | createElement: createElementWithValidation,
|
2074 | cloneElement: cloneElementWithValidation,
|
2075 | createFactory: createFactoryWithValidation,
|
2076 | isValidElement: isValidElement,
|
2077 |
|
2078 | version: ReactVersion,
|
2079 |
|
2080 | unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
2081 | unstable_Profiler: REACT_PROFILER_TYPE,
|
2082 |
|
2083 | __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
2084 | };
|
2085 |
|
2086 |
|
2087 |
|
2088 | var React$2 = Object.freeze({
|
2089 | default: React
|
2090 | });
|
2091 |
|
2092 | var React$3 = ( React$2 && React ) || React$2;
|
2093 |
|
2094 |
|
2095 |
|
2096 | var react = React$3.default || React$3;
|
2097 |
|
2098 | module.exports = react;
|
2099 | })();
|
2100 | }
|
2101 | });
|
2102 |
|
2103 | var react = createCommonjsModule(function (module) {
|
2104 |
|
2105 | {
|
2106 | module.exports = react_development;
|
2107 | }
|
2108 | });
|
2109 |
|
2110 | var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
2111 | Object.defineProperty(exports,"__esModule",{value:!0});
|
2112 | 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"):
|
2113 | 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;
|
2114 | 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};
|
2115 | 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};
|
2116 | });
|
2117 |
|
2118 | var reactIs_development = createCommonjsModule(function (module, exports) {
|
2119 |
|
2120 |
|
2121 |
|
2122 | {
|
2123 | (function() {
|
2124 |
|
2125 | Object.defineProperty(exports, '__esModule', { value: true });
|
2126 |
|
2127 |
|
2128 |
|
2129 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
2130 |
|
2131 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
2132 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
2133 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
2134 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
2135 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
2136 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
2137 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
2138 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
2139 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
2140 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
2141 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
2142 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
2143 |
|
2144 | function isValidElementType(type) {
|
2145 | return typeof type === 'string' || typeof type === 'function' ||
|
2146 |
|
2147 | 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);
|
2148 | }
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 | var lowPriorityWarning = function () {};
|
2165 |
|
2166 | {
|
2167 | var printWarning = function (format) {
|
2168 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2169 | args[_key - 1] = arguments[_key];
|
2170 | }
|
2171 |
|
2172 | var argIndex = 0;
|
2173 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
2174 | return args[argIndex++];
|
2175 | });
|
2176 | if (typeof console !== 'undefined') {
|
2177 | console.warn(message);
|
2178 | }
|
2179 | try {
|
2180 |
|
2181 |
|
2182 |
|
2183 | throw new Error(message);
|
2184 | } catch (x) {}
|
2185 | };
|
2186 |
|
2187 | lowPriorityWarning = function (condition, format) {
|
2188 | if (format === undefined) {
|
2189 | throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
|
2190 | }
|
2191 | if (!condition) {
|
2192 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
2193 | args[_key2 - 2] = arguments[_key2];
|
2194 | }
|
2195 |
|
2196 | printWarning.apply(undefined, [format].concat(args));
|
2197 | }
|
2198 | };
|
2199 | }
|
2200 |
|
2201 | var lowPriorityWarning$1 = lowPriorityWarning;
|
2202 |
|
2203 | function typeOf(object) {
|
2204 | if (typeof object === 'object' && object !== null) {
|
2205 | var $$typeof = object.$$typeof;
|
2206 |
|
2207 | switch ($$typeof) {
|
2208 | case REACT_ELEMENT_TYPE:
|
2209 | var type = object.type;
|
2210 |
|
2211 | switch (type) {
|
2212 | case REACT_CONCURRENT_MODE_TYPE:
|
2213 | case REACT_FRAGMENT_TYPE:
|
2214 | case REACT_PROFILER_TYPE:
|
2215 | case REACT_STRICT_MODE_TYPE:
|
2216 | return type;
|
2217 | default:
|
2218 | var $$typeofType = type && type.$$typeof;
|
2219 |
|
2220 | switch ($$typeofType) {
|
2221 | case REACT_CONTEXT_TYPE:
|
2222 | case REACT_FORWARD_REF_TYPE:
|
2223 | case REACT_PROVIDER_TYPE:
|
2224 | return $$typeofType;
|
2225 | default:
|
2226 | return $$typeof;
|
2227 | }
|
2228 | }
|
2229 | case REACT_PORTAL_TYPE:
|
2230 | return $$typeof;
|
2231 | }
|
2232 | }
|
2233 |
|
2234 | return undefined;
|
2235 | }
|
2236 |
|
2237 |
|
2238 | var AsyncMode = REACT_CONCURRENT_MODE_TYPE;
|
2239 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
2240 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
2241 | var ContextProvider = REACT_PROVIDER_TYPE;
|
2242 | var Element = REACT_ELEMENT_TYPE;
|
2243 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
2244 | var Fragment = REACT_FRAGMENT_TYPE;
|
2245 | var Profiler = REACT_PROFILER_TYPE;
|
2246 | var Portal = REACT_PORTAL_TYPE;
|
2247 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
2248 |
|
2249 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
2250 |
|
2251 |
|
2252 | function isAsyncMode(object) {
|
2253 | {
|
2254 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
2255 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
2256 | 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.');
|
2257 | }
|
2258 | }
|
2259 | return isConcurrentMode(object);
|
2260 | }
|
2261 | function isConcurrentMode(object) {
|
2262 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
2263 | }
|
2264 | function isContextConsumer(object) {
|
2265 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
2266 | }
|
2267 | function isContextProvider(object) {
|
2268 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
2269 | }
|
2270 | function isElement(object) {
|
2271 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
2272 | }
|
2273 | function isForwardRef(object) {
|
2274 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
2275 | }
|
2276 | function isFragment(object) {
|
2277 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
2278 | }
|
2279 | function isProfiler(object) {
|
2280 | return typeOf(object) === REACT_PROFILER_TYPE;
|
2281 | }
|
2282 | function isPortal(object) {
|
2283 | return typeOf(object) === REACT_PORTAL_TYPE;
|
2284 | }
|
2285 | function isStrictMode(object) {
|
2286 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
2287 | }
|
2288 |
|
2289 | exports.typeOf = typeOf;
|
2290 | exports.AsyncMode = AsyncMode;
|
2291 | exports.ConcurrentMode = ConcurrentMode;
|
2292 | exports.ContextConsumer = ContextConsumer;
|
2293 | exports.ContextProvider = ContextProvider;
|
2294 | exports.Element = Element;
|
2295 | exports.ForwardRef = ForwardRef;
|
2296 | exports.Fragment = Fragment;
|
2297 | exports.Profiler = Profiler;
|
2298 | exports.Portal = Portal;
|
2299 | exports.StrictMode = StrictMode;
|
2300 | exports.isValidElementType = isValidElementType;
|
2301 | exports.isAsyncMode = isAsyncMode;
|
2302 | exports.isConcurrentMode = isConcurrentMode;
|
2303 | exports.isContextConsumer = isContextConsumer;
|
2304 | exports.isContextProvider = isContextProvider;
|
2305 | exports.isElement = isElement;
|
2306 | exports.isForwardRef = isForwardRef;
|
2307 | exports.isFragment = isFragment;
|
2308 | exports.isProfiler = isProfiler;
|
2309 | exports.isPortal = isPortal;
|
2310 | exports.isStrictMode = isStrictMode;
|
2311 | })();
|
2312 | }
|
2313 | });
|
2314 |
|
2315 | var reactIs = createCommonjsModule(function (module) {
|
2316 |
|
2317 | {
|
2318 | module.exports = reactIs_development;
|
2319 | }
|
2320 | });
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 | var REACT_STATICS = {
|
2328 | childContextTypes: true,
|
2329 | contextType: true,
|
2330 | contextTypes: true,
|
2331 | defaultProps: true,
|
2332 | displayName: true,
|
2333 | getDefaultProps: true,
|
2334 | getDerivedStateFromError: true,
|
2335 | getDerivedStateFromProps: true,
|
2336 | mixins: true,
|
2337 | propTypes: true,
|
2338 | type: true
|
2339 | };
|
2340 |
|
2341 | var KNOWN_STATICS = {
|
2342 | name: true,
|
2343 | length: true,
|
2344 | prototype: true,
|
2345 | caller: true,
|
2346 | callee: true,
|
2347 | arguments: true,
|
2348 | arity: true
|
2349 | };
|
2350 |
|
2351 | var FORWARD_REF_STATICS = {
|
2352 | '$$typeof': true,
|
2353 | render: true
|
2354 | };
|
2355 |
|
2356 | var TYPE_STATICS = {};
|
2357 | TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
2358 |
|
2359 | var defineProperty = Object.defineProperty;
|
2360 | var getOwnPropertyNames = Object.getOwnPropertyNames;
|
2361 | var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
|
2362 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
2363 | var getPrototypeOf = Object.getPrototypeOf;
|
2364 | var objectPrototype = Object.prototype;
|
2365 |
|
2366 | function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
2367 | if (typeof sourceComponent !== 'string') {
|
2368 |
|
2369 |
|
2370 | if (objectPrototype) {
|
2371 | var inheritedComponent = getPrototypeOf(sourceComponent);
|
2372 | if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
2373 | hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
2374 | }
|
2375 | }
|
2376 |
|
2377 | var keys = getOwnPropertyNames(sourceComponent);
|
2378 |
|
2379 | if (getOwnPropertySymbols$1) {
|
2380 | keys = keys.concat(getOwnPropertySymbols$1(sourceComponent));
|
2381 | }
|
2382 |
|
2383 | var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS;
|
2384 | var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS;
|
2385 |
|
2386 | for (var i = 0; i < keys.length; ++i) {
|
2387 | var key = keys[i];
|
2388 | if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
2389 | var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
2390 | try {
|
2391 |
|
2392 | defineProperty(targetComponent, key, descriptor);
|
2393 | } catch (e) {}
|
2394 | }
|
2395 | }
|
2396 |
|
2397 | return targetComponent;
|
2398 | }
|
2399 |
|
2400 | return targetComponent;
|
2401 | }
|
2402 |
|
2403 | var hoistNonReactStatics_cjs = hoistNonReactStatics;
|
2404 |
|
2405 | function warning(condition, message) {
|
2406 | {
|
2407 | if (condition) {
|
2408 | return;
|
2409 | }
|
2410 |
|
2411 | var text = "Warning: " + message;
|
2412 |
|
2413 | if (typeof console !== 'undefined') {
|
2414 | console.warn(text);
|
2415 | }
|
2416 |
|
2417 | try {
|
2418 | throw Error(text);
|
2419 | } catch (x) {}
|
2420 | }
|
2421 | }
|
2422 |
|
2423 | var printWarning$1 = function() {};
|
2424 |
|
2425 | {
|
2426 | printWarning$1 = function(text) {
|
2427 | var message = 'Warning: ' + text;
|
2428 | if (typeof console !== 'undefined') {
|
2429 | console.error(message);
|
2430 | }
|
2431 | try {
|
2432 |
|
2433 |
|
2434 |
|
2435 | throw new Error(message);
|
2436 | } catch (x) {}
|
2437 | };
|
2438 | }
|
2439 |
|
2440 | function emptyFunctionThatReturnsNull() {
|
2441 | return null;
|
2442 | }
|
2443 |
|
2444 | var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
2445 |
|
2446 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
2447 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
2448 |
|
2449 | |
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 | function getIteratorFn(maybeIterable) {
|
2464 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
2465 | if (typeof iteratorFn === 'function') {
|
2466 | return iteratorFn;
|
2467 | }
|
2468 | }
|
2469 |
|
2470 | |
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 | var ANONYMOUS = '<<anonymous>>';
|
2518 |
|
2519 |
|
2520 |
|
2521 | var ReactPropTypes = {
|
2522 | array: createPrimitiveTypeChecker('array'),
|
2523 | bool: createPrimitiveTypeChecker('boolean'),
|
2524 | func: createPrimitiveTypeChecker('function'),
|
2525 | number: createPrimitiveTypeChecker('number'),
|
2526 | object: createPrimitiveTypeChecker('object'),
|
2527 | string: createPrimitiveTypeChecker('string'),
|
2528 | symbol: createPrimitiveTypeChecker('symbol'),
|
2529 |
|
2530 | any: createAnyTypeChecker(),
|
2531 | arrayOf: createArrayOfTypeChecker,
|
2532 | element: createElementTypeChecker(),
|
2533 | instanceOf: createInstanceTypeChecker,
|
2534 | node: createNodeChecker(),
|
2535 | objectOf: createObjectOfTypeChecker,
|
2536 | oneOf: createEnumTypeChecker,
|
2537 | oneOfType: createUnionTypeChecker,
|
2538 | shape: createShapeTypeChecker,
|
2539 | exact: createStrictShapeTypeChecker,
|
2540 | };
|
2541 |
|
2542 | |
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 | function is(x, y) {
|
2548 |
|
2549 | if (x === y) {
|
2550 |
|
2551 |
|
2552 | return x !== 0 || 1 / x === 1 / y;
|
2553 | } else {
|
2554 |
|
2555 | return x !== x && y !== y;
|
2556 | }
|
2557 | }
|
2558 |
|
2559 |
|
2560 | |
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 | function PropTypeError(message) {
|
2568 | this.message = message;
|
2569 | this.stack = '';
|
2570 | }
|
2571 |
|
2572 | PropTypeError.prototype = Error.prototype;
|
2573 |
|
2574 | function createChainableTypeChecker(validate) {
|
2575 | {
|
2576 | var manualPropTypeCallCache = {};
|
2577 | var manualPropTypeWarningCount = 0;
|
2578 | }
|
2579 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
2580 | componentName = componentName || ANONYMOUS;
|
2581 | propFullName = propFullName || propName;
|
2582 |
|
2583 | if (secret !== ReactPropTypesSecret_1) {
|
2584 | if (throwOnDirectAccess) {
|
2585 |
|
2586 | var err = new Error(
|
2587 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
2588 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
2589 | 'Read more at http://fb.me/use-check-prop-types'
|
2590 | );
|
2591 | err.name = 'Invariant Violation';
|
2592 | throw err;
|
2593 | } else if ( typeof console !== 'undefined') {
|
2594 |
|
2595 | var cacheKey = componentName + ':' + propName;
|
2596 | if (
|
2597 | !manualPropTypeCallCache[cacheKey] &&
|
2598 |
|
2599 | manualPropTypeWarningCount < 3
|
2600 | ) {
|
2601 | printWarning$1(
|
2602 | 'You are manually calling a React.PropTypes validation ' +
|
2603 | 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
2604 | 'and will throw in the standalone `prop-types` package. ' +
|
2605 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
2606 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
2607 | );
|
2608 | manualPropTypeCallCache[cacheKey] = true;
|
2609 | manualPropTypeWarningCount++;
|
2610 | }
|
2611 | }
|
2612 | }
|
2613 | if (props[propName] == null) {
|
2614 | if (isRequired) {
|
2615 | if (props[propName] === null) {
|
2616 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
2617 | }
|
2618 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
2619 | }
|
2620 | return null;
|
2621 | } else {
|
2622 | return validate(props, propName, componentName, location, propFullName);
|
2623 | }
|
2624 | }
|
2625 |
|
2626 | var chainedCheckType = checkType.bind(null, false);
|
2627 | chainedCheckType.isRequired = checkType.bind(null, true);
|
2628 |
|
2629 | return chainedCheckType;
|
2630 | }
|
2631 |
|
2632 | function createPrimitiveTypeChecker(expectedType) {
|
2633 | function validate(props, propName, componentName, location, propFullName, secret) {
|
2634 | var propValue = props[propName];
|
2635 | var propType = getPropType(propValue);
|
2636 | if (propType !== expectedType) {
|
2637 |
|
2638 |
|
2639 |
|
2640 | var preciseType = getPreciseType(propValue);
|
2641 |
|
2642 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
2643 | }
|
2644 | return null;
|
2645 | }
|
2646 | return createChainableTypeChecker(validate);
|
2647 | }
|
2648 |
|
2649 | function createAnyTypeChecker() {
|
2650 | return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
2651 | }
|
2652 |
|
2653 | function createArrayOfTypeChecker(typeChecker) {
|
2654 | function validate(props, propName, componentName, location, propFullName) {
|
2655 | if (typeof typeChecker !== 'function') {
|
2656 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
2657 | }
|
2658 | var propValue = props[propName];
|
2659 | if (!Array.isArray(propValue)) {
|
2660 | var propType = getPropType(propValue);
|
2661 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
2662 | }
|
2663 | for (var i = 0; i < propValue.length; i++) {
|
2664 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
2665 | if (error instanceof Error) {
|
2666 | return error;
|
2667 | }
|
2668 | }
|
2669 | return null;
|
2670 | }
|
2671 | return createChainableTypeChecker(validate);
|
2672 | }
|
2673 |
|
2674 | function createElementTypeChecker() {
|
2675 | function validate(props, propName, componentName, location, propFullName) {
|
2676 | var propValue = props[propName];
|
2677 | if (!isValidElement(propValue)) {
|
2678 | var propType = getPropType(propValue);
|
2679 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
2680 | }
|
2681 | return null;
|
2682 | }
|
2683 | return createChainableTypeChecker(validate);
|
2684 | }
|
2685 |
|
2686 | function createInstanceTypeChecker(expectedClass) {
|
2687 | function validate(props, propName, componentName, location, propFullName) {
|
2688 | if (!(props[propName] instanceof expectedClass)) {
|
2689 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
2690 | var actualClassName = getClassName(props[propName]);
|
2691 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
2692 | }
|
2693 | return null;
|
2694 | }
|
2695 | return createChainableTypeChecker(validate);
|
2696 | }
|
2697 |
|
2698 | function createEnumTypeChecker(expectedValues) {
|
2699 | if (!Array.isArray(expectedValues)) {
|
2700 | printWarning$1('Invalid argument supplied to oneOf, expected an instance of array.') ;
|
2701 | return emptyFunctionThatReturnsNull;
|
2702 | }
|
2703 |
|
2704 | function validate(props, propName, componentName, location, propFullName) {
|
2705 | var propValue = props[propName];
|
2706 | for (var i = 0; i < expectedValues.length; i++) {
|
2707 | if (is(propValue, expectedValues[i])) {
|
2708 | return null;
|
2709 | }
|
2710 | }
|
2711 |
|
2712 | var valuesString = JSON.stringify(expectedValues);
|
2713 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
2714 | }
|
2715 | return createChainableTypeChecker(validate);
|
2716 | }
|
2717 |
|
2718 | function createObjectOfTypeChecker(typeChecker) {
|
2719 | function validate(props, propName, componentName, location, propFullName) {
|
2720 | if (typeof typeChecker !== 'function') {
|
2721 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
2722 | }
|
2723 | var propValue = props[propName];
|
2724 | var propType = getPropType(propValue);
|
2725 | if (propType !== 'object') {
|
2726 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
2727 | }
|
2728 | for (var key in propValue) {
|
2729 | if (propValue.hasOwnProperty(key)) {
|
2730 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
2731 | if (error instanceof Error) {
|
2732 | return error;
|
2733 | }
|
2734 | }
|
2735 | }
|
2736 | return null;
|
2737 | }
|
2738 | return createChainableTypeChecker(validate);
|
2739 | }
|
2740 |
|
2741 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
2742 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
2743 | printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') ;
|
2744 | return emptyFunctionThatReturnsNull;
|
2745 | }
|
2746 |
|
2747 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
2748 | var checker = arrayOfTypeCheckers[i];
|
2749 | if (typeof checker !== 'function') {
|
2750 | printWarning$1(
|
2751 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
2752 | 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
2753 | );
|
2754 | return emptyFunctionThatReturnsNull;
|
2755 | }
|
2756 | }
|
2757 |
|
2758 | function validate(props, propName, componentName, location, propFullName) {
|
2759 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
2760 | var checker = arrayOfTypeCheckers[i];
|
2761 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
2762 | return null;
|
2763 | }
|
2764 | }
|
2765 |
|
2766 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
2767 | }
|
2768 | return createChainableTypeChecker(validate);
|
2769 | }
|
2770 |
|
2771 | function createNodeChecker() {
|
2772 | function validate(props, propName, componentName, location, propFullName) {
|
2773 | if (!isNode(props[propName])) {
|
2774 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
2775 | }
|
2776 | return null;
|
2777 | }
|
2778 | return createChainableTypeChecker(validate);
|
2779 | }
|
2780 |
|
2781 | function createShapeTypeChecker(shapeTypes) {
|
2782 | function validate(props, propName, componentName, location, propFullName) {
|
2783 | var propValue = props[propName];
|
2784 | var propType = getPropType(propValue);
|
2785 | if (propType !== 'object') {
|
2786 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
2787 | }
|
2788 | for (var key in shapeTypes) {
|
2789 | var checker = shapeTypes[key];
|
2790 | if (!checker) {
|
2791 | continue;
|
2792 | }
|
2793 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
2794 | if (error) {
|
2795 | return error;
|
2796 | }
|
2797 | }
|
2798 | return null;
|
2799 | }
|
2800 | return createChainableTypeChecker(validate);
|
2801 | }
|
2802 |
|
2803 | function createStrictShapeTypeChecker(shapeTypes) {
|
2804 | function validate(props, propName, componentName, location, propFullName) {
|
2805 | var propValue = props[propName];
|
2806 | var propType = getPropType(propValue);
|
2807 | if (propType !== 'object') {
|
2808 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
2809 | }
|
2810 |
|
2811 |
|
2812 | var allKeys = assign({}, props[propName], shapeTypes);
|
2813 | for (var key in allKeys) {
|
2814 | var checker = shapeTypes[key];
|
2815 | if (!checker) {
|
2816 | return new PropTypeError(
|
2817 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
2818 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
2819 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
2820 | );
|
2821 | }
|
2822 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
2823 | if (error) {
|
2824 | return error;
|
2825 | }
|
2826 | }
|
2827 | return null;
|
2828 | }
|
2829 |
|
2830 | return createChainableTypeChecker(validate);
|
2831 | }
|
2832 |
|
2833 | function isNode(propValue) {
|
2834 | switch (typeof propValue) {
|
2835 | case 'number':
|
2836 | case 'string':
|
2837 | case 'undefined':
|
2838 | return true;
|
2839 | case 'boolean':
|
2840 | return !propValue;
|
2841 | case 'object':
|
2842 | if (Array.isArray(propValue)) {
|
2843 | return propValue.every(isNode);
|
2844 | }
|
2845 | if (propValue === null || isValidElement(propValue)) {
|
2846 | return true;
|
2847 | }
|
2848 |
|
2849 | var iteratorFn = getIteratorFn(propValue);
|
2850 | if (iteratorFn) {
|
2851 | var iterator = iteratorFn.call(propValue);
|
2852 | var step;
|
2853 | if (iteratorFn !== propValue.entries) {
|
2854 | while (!(step = iterator.next()).done) {
|
2855 | if (!isNode(step.value)) {
|
2856 | return false;
|
2857 | }
|
2858 | }
|
2859 | } else {
|
2860 |
|
2861 | while (!(step = iterator.next()).done) {
|
2862 | var entry = step.value;
|
2863 | if (entry) {
|
2864 | if (!isNode(entry[1])) {
|
2865 | return false;
|
2866 | }
|
2867 | }
|
2868 | }
|
2869 | }
|
2870 | } else {
|
2871 | return false;
|
2872 | }
|
2873 |
|
2874 | return true;
|
2875 | default:
|
2876 | return false;
|
2877 | }
|
2878 | }
|
2879 |
|
2880 | function isSymbol(propType, propValue) {
|
2881 |
|
2882 | if (propType === 'symbol') {
|
2883 | return true;
|
2884 | }
|
2885 |
|
2886 |
|
2887 | if (propValue['@@toStringTag'] === 'Symbol') {
|
2888 | return true;
|
2889 | }
|
2890 |
|
2891 |
|
2892 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
2893 | return true;
|
2894 | }
|
2895 |
|
2896 | return false;
|
2897 | }
|
2898 |
|
2899 |
|
2900 | function getPropType(propValue) {
|
2901 | var propType = typeof propValue;
|
2902 | if (Array.isArray(propValue)) {
|
2903 | return 'array';
|
2904 | }
|
2905 | if (propValue instanceof RegExp) {
|
2906 |
|
2907 |
|
2908 |
|
2909 | return 'object';
|
2910 | }
|
2911 | if (isSymbol(propType, propValue)) {
|
2912 | return 'symbol';
|
2913 | }
|
2914 | return propType;
|
2915 | }
|
2916 |
|
2917 |
|
2918 |
|
2919 | function getPreciseType(propValue) {
|
2920 | if (typeof propValue === 'undefined' || propValue === null) {
|
2921 | return '' + propValue;
|
2922 | }
|
2923 | var propType = getPropType(propValue);
|
2924 | if (propType === 'object') {
|
2925 | if (propValue instanceof Date) {
|
2926 | return 'date';
|
2927 | } else if (propValue instanceof RegExp) {
|
2928 | return 'regexp';
|
2929 | }
|
2930 | }
|
2931 | return propType;
|
2932 | }
|
2933 |
|
2934 |
|
2935 |
|
2936 | function getPostfixForTypeWarning(value) {
|
2937 | var type = getPreciseType(value);
|
2938 | switch (type) {
|
2939 | case 'array':
|
2940 | case 'object':
|
2941 | return 'an ' + type;
|
2942 | case 'boolean':
|
2943 | case 'date':
|
2944 | case 'regexp':
|
2945 | return 'a ' + type;
|
2946 | default:
|
2947 | return type;
|
2948 | }
|
2949 | }
|
2950 |
|
2951 |
|
2952 | function getClassName(propValue) {
|
2953 | if (!propValue.constructor || !propValue.constructor.name) {
|
2954 | return ANONYMOUS;
|
2955 | }
|
2956 | return propValue.constructor.name;
|
2957 | }
|
2958 |
|
2959 | ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
2960 | ReactPropTypes.PropTypes = ReactPropTypes;
|
2961 |
|
2962 | return ReactPropTypes;
|
2963 | };
|
2964 |
|
2965 | var propTypes = createCommonjsModule(function (module) {
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 |
|
2971 |
|
2972 |
|
2973 | {
|
2974 | var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
2975 | Symbol.for &&
|
2976 | Symbol.for('react.element')) ||
|
2977 | 0xeac7;
|
2978 |
|
2979 | var isValidElement = function(object) {
|
2980 | return typeof object === 'object' &&
|
2981 | object !== null &&
|
2982 | object.$$typeof === REACT_ELEMENT_TYPE;
|
2983 | };
|
2984 |
|
2985 |
|
2986 |
|
2987 | var throwOnDirectAccess = true;
|
2988 | module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
|
2989 | }
|
2990 | });
|
2991 |
|
2992 | {
|
2993 | module.exports = require('./cjs/react-is.development.js');
|
2994 | }
|
2995 |
|
2996 | var reactIs$1 = Object.freeze({
|
2997 | __proto__: null
|
2998 | });
|
2999 |
|
3000 | var ReactIs = getAugmentedNamespace(reactIs$1);
|
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 | var REACT_STATICS$1 = {
|
3008 | childContextTypes: true,
|
3009 | contextType: true,
|
3010 | contextTypes: true,
|
3011 | defaultProps: true,
|
3012 | displayName: true,
|
3013 | getDefaultProps: true,
|
3014 | getDerivedStateFromError: true,
|
3015 | getDerivedStateFromProps: true,
|
3016 | mixins: true,
|
3017 | propTypes: true,
|
3018 | type: true
|
3019 | };
|
3020 |
|
3021 | var KNOWN_STATICS$1 = {
|
3022 | name: true,
|
3023 | length: true,
|
3024 | prototype: true,
|
3025 | caller: true,
|
3026 | callee: true,
|
3027 | arguments: true,
|
3028 | arity: true
|
3029 | };
|
3030 |
|
3031 | var FORWARD_REF_STATICS$1 = {
|
3032 | '$$typeof': true,
|
3033 | render: true,
|
3034 | defaultProps: true,
|
3035 | displayName: true,
|
3036 | propTypes: true
|
3037 | };
|
3038 |
|
3039 | var MEMO_STATICS = {
|
3040 | '$$typeof': true,
|
3041 | compare: true,
|
3042 | defaultProps: true,
|
3043 | displayName: true,
|
3044 | propTypes: true,
|
3045 | type: true
|
3046 | };
|
3047 |
|
3048 | var TYPE_STATICS$1 = {};
|
3049 | TYPE_STATICS$1[ReactIs.ForwardRef] = FORWARD_REF_STATICS$1;
|
3050 |
|
3051 | function getStatics(component) {
|
3052 | if (ReactIs.isMemo(component)) {
|
3053 | return MEMO_STATICS;
|
3054 | }
|
3055 | return TYPE_STATICS$1[component['$$typeof']] || REACT_STATICS$1;
|
3056 | }
|
3057 |
|
3058 | var defineProperty$1 = Object.defineProperty;
|
3059 | var getOwnPropertyNames$1 = Object.getOwnPropertyNames;
|
3060 | var getOwnPropertySymbols$2 = Object.getOwnPropertySymbols;
|
3061 | var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
3062 | var getPrototypeOf$1 = Object.getPrototypeOf;
|
3063 | var objectPrototype$1 = Object.prototype;
|
3064 |
|
3065 | function hoistNonReactStatics$1(targetComponent, sourceComponent, blacklist) {
|
3066 | if (typeof sourceComponent !== 'string') {
|
3067 |
|
3068 |
|
3069 | if (objectPrototype$1) {
|
3070 | var inheritedComponent = getPrototypeOf$1(sourceComponent);
|
3071 | if (inheritedComponent && inheritedComponent !== objectPrototype$1) {
|
3072 | hoistNonReactStatics$1(targetComponent, inheritedComponent, blacklist);
|
3073 | }
|
3074 | }
|
3075 |
|
3076 | var keys = getOwnPropertyNames$1(sourceComponent);
|
3077 |
|
3078 | if (getOwnPropertySymbols$2) {
|
3079 | keys = keys.concat(getOwnPropertySymbols$2(sourceComponent));
|
3080 | }
|
3081 |
|
3082 | var targetStatics = getStatics(targetComponent);
|
3083 | var sourceStatics = getStatics(sourceComponent);
|
3084 |
|
3085 | for (var i = 0; i < keys.length; ++i) {
|
3086 | var key = keys[i];
|
3087 | if (!KNOWN_STATICS$1[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
3088 | var descriptor = getOwnPropertyDescriptor$1(sourceComponent, key);
|
3089 | try {
|
3090 |
|
3091 | defineProperty$1(targetComponent, key, descriptor);
|
3092 | } catch (e) {}
|
3093 | }
|
3094 | }
|
3095 |
|
3096 | return targetComponent;
|
3097 | }
|
3098 |
|
3099 | return targetComponent;
|
3100 | }
|
3101 |
|
3102 | var hoistNonReactStatics_cjs$1 = hoistNonReactStatics$1;
|
3103 |
|
3104 | var getDisplayName_1 = createCommonjsModule(function (module, exports) {
|
3105 |
|
3106 | Object.defineProperty(exports, "__esModule", {
|
3107 | value: true
|
3108 | });
|
3109 | exports.default = getDisplayName;
|
3110 | function getDisplayName(Component) {
|
3111 | return Component.displayName || Component.name || (typeof Component === 'string' && Component.length > 0 ? Component : 'Unknown');
|
3112 | }
|
3113 | });
|
3114 |
|
3115 | var getDisplayName = getDefaultExportFromCjs(getDisplayName_1);
|
3116 |
|
3117 | function _defineProperty(obj, key, value) {
|
3118 | if (key in obj) {
|
3119 | Object.defineProperty(obj, key, {
|
3120 | value: value,
|
3121 | enumerable: true,
|
3122 | configurable: true,
|
3123 | writable: true
|
3124 | });
|
3125 | } else {
|
3126 | obj[key] = value;
|
3127 | }
|
3128 |
|
3129 | return obj;
|
3130 | }
|
3131 |
|
3132 | function _extends$1() {
|
3133 | _extends$1 = Object.assign || function (target) {
|
3134 | for (var i = 1; i < arguments.length; i++) {
|
3135 | var source = arguments[i];
|
3136 |
|
3137 | for (var key in source) {
|
3138 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
3139 | target[key] = source[key];
|
3140 | }
|
3141 | }
|
3142 | }
|
3143 |
|
3144 | return target;
|
3145 | };
|
3146 |
|
3147 | return _extends$1.apply(this, arguments);
|
3148 | }
|
3149 |
|
3150 | function _inheritsLoose(subClass, superClass) {
|
3151 | subClass.prototype = Object.create(superClass.prototype);
|
3152 | subClass.prototype.constructor = subClass;
|
3153 | subClass.__proto__ = superClass;
|
3154 | }
|
3155 |
|
3156 | function _assertThisInitialized(self) {
|
3157 | if (self === void 0) {
|
3158 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
3159 | }
|
3160 |
|
3161 | return self;
|
3162 | }
|
3163 |
|
3164 | function isObject(obj) {
|
3165 | return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
3166 | }
|
3167 |
|
3168 | function createThemeProvider(context) {
|
3169 | var ThemeProvider =
|
3170 |
|
3171 | function (_React$Component) {
|
3172 | _inheritsLoose(ThemeProvider, _React$Component);
|
3173 |
|
3174 | function ThemeProvider() {
|
3175 | var _this;
|
3176 |
|
3177 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
3178 | args[_key] = arguments[_key];
|
3179 | }
|
3180 |
|
3181 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
3182 |
|
3183 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "cachedTheme", void 0);
|
3184 |
|
3185 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastOuterTheme", void 0);
|
3186 |
|
3187 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "lastTheme", void 0);
|
3188 |
|
3189 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderProvider", function (outerTheme) {
|
3190 | var children = _this.props.children;
|
3191 | return react.createElement(context.Provider, {
|
3192 | value: _this.getTheme(outerTheme)
|
3193 | }, children);
|
3194 | });
|
3195 |
|
3196 | return _this;
|
3197 | }
|
3198 |
|
3199 | var _proto = ThemeProvider.prototype;
|
3200 |
|
3201 |
|
3202 | _proto.getTheme = function getTheme(outerTheme) {
|
3203 | if (this.props.theme !== this.lastTheme || outerTheme !== this.lastOuterTheme || !this.cachedTheme) {
|
3204 | this.lastOuterTheme = outerTheme;
|
3205 | this.lastTheme = this.props.theme;
|
3206 |
|
3207 | if (typeof this.lastTheme === 'function') {
|
3208 | var theme = this.props.theme;
|
3209 | this.cachedTheme = theme(outerTheme);
|
3210 | warning(isObject(this.cachedTheme), '[ThemeProvider] Please return an object from your theme function') ;
|
3211 | } else {
|
3212 | var _theme = this.props.theme;
|
3213 | warning(isObject(_theme), '[ThemeProvider] Please make your theme prop a plain object') ;
|
3214 | this.cachedTheme = outerTheme ? _extends$1({}, outerTheme, _theme) : _theme;
|
3215 | }
|
3216 | }
|
3217 |
|
3218 | return this.cachedTheme;
|
3219 | };
|
3220 |
|
3221 | _proto.render = function render() {
|
3222 | var children = this.props.children;
|
3223 |
|
3224 | if (!children) {
|
3225 | return null;
|
3226 | }
|
3227 |
|
3228 | return react.createElement(context.Consumer, null, this.renderProvider);
|
3229 | };
|
3230 |
|
3231 | return ThemeProvider;
|
3232 | }(react.Component);
|
3233 |
|
3234 | {
|
3235 | ThemeProvider.propTypes = {
|
3236 |
|
3237 | children: propTypes.node,
|
3238 | theme: propTypes.oneOfType([propTypes.shape({}), propTypes.func]).isRequired
|
3239 | };
|
3240 | }
|
3241 |
|
3242 | return ThemeProvider;
|
3243 | }
|
3244 |
|
3245 | function createWithTheme(context) {
|
3246 | return function hoc(Component) {
|
3247 | var withTheme = react.forwardRef(function (props, ref) {
|
3248 | return react.createElement(context.Consumer, null, function (theme) {
|
3249 | warning(isObject(theme), '[theming] Please use withTheme only with the ThemeProvider') ;
|
3250 | return react.createElement(Component, _extends$1({
|
3251 | theme: theme,
|
3252 | ref: ref
|
3253 | }, props));
|
3254 | });
|
3255 | });
|
3256 |
|
3257 | {
|
3258 | withTheme.displayName = "WithTheme(" + getDisplayName(Component) + ")";
|
3259 | }
|
3260 |
|
3261 | hoistNonReactStatics_cjs$1(withTheme, Component);
|
3262 | return withTheme;
|
3263 | };
|
3264 | }
|
3265 |
|
3266 | function createUseTheme(context) {
|
3267 | var useTheme = function useTheme() {
|
3268 | var theme = react.useContext(context);
|
3269 | warning(isObject(theme), '[theming] Please use useTheme only with the ThemeProvider') ;
|
3270 | return theme;
|
3271 | };
|
3272 |
|
3273 | return useTheme;
|
3274 | }
|
3275 |
|
3276 | function createTheming(context) {
|
3277 | return {
|
3278 | context: context,
|
3279 | withTheme: createWithTheme(context),
|
3280 | useTheme: createUseTheme(context),
|
3281 | ThemeProvider: createThemeProvider(context)
|
3282 | };
|
3283 | }
|
3284 |
|
3285 | var ThemeContext = react.createContext();
|
3286 |
|
3287 | var _createTheming = createTheming(ThemeContext),
|
3288 | withTheme = _createTheming.withTheme,
|
3289 | ThemeProvider = _createTheming.ThemeProvider,
|
3290 | useTheme = _createTheming.useTheme;
|
3291 |
|
3292 | var getDisplayName$1 = function getDisplayName(Component) {
|
3293 | return Component.displayName || Component.name || 'Component';
|
3294 | };
|
3295 |
|
3296 | var memoize = function memoize(fn) {
|
3297 | var lastArgs;
|
3298 | var lastResult;
|
3299 | return function () {
|
3300 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
3301 | args[_key] = arguments[_key];
|
3302 | }
|
3303 |
|
3304 | if (Array.isArray(lastArgs) && args.length === lastArgs.length) {
|
3305 | var isSame = true;
|
3306 |
|
3307 | for (var i = 0; i < args.length; i++) {
|
3308 | if (args[i] !== lastArgs[i]) {
|
3309 | isSame = false;
|
3310 | }
|
3311 | }
|
3312 |
|
3313 | if (isSame) {
|
3314 | return lastResult;
|
3315 | }
|
3316 | }
|
3317 |
|
3318 | lastArgs = args;
|
3319 | lastResult = fn.apply(void 0, args);
|
3320 | return lastResult;
|
3321 | };
|
3322 | };
|
3323 |
|
3324 | var mergeClasses = function mergeClasses(baseClasses, additionalClasses) {
|
3325 | var combinedClasses = _extends({}, baseClasses);
|
3326 |
|
3327 | for (var name in additionalClasses) {
|
3328 | combinedClasses[name] = name in combinedClasses ? combinedClasses[name] + " " + additionalClasses[name] : additionalClasses[name];
|
3329 | }
|
3330 |
|
3331 | return combinedClasses;
|
3332 | };
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 |
|
3344 |
|
3345 |
|
3346 |
|
3347 | var index = Number.MIN_SAFE_INTEGER || -1e9;
|
3348 |
|
3349 | var getSheetIndex = function getSheetIndex() {
|
3350 | return index++;
|
3351 | };
|
3352 |
|
3353 | 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; };
|
3354 |
|
3355 | var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9;
|
3356 |
|
3357 | var JssContext = react.createContext({
|
3358 | classNamePrefix: '',
|
3359 | disableStylesGeneration: false,
|
3360 | isSSR: !isBrowser
|
3361 | });
|
3362 |
|
3363 | function _defineProperties(target, props) {
|
3364 | for (var i = 0; i < props.length; i++) {
|
3365 | var descriptor = props[i];
|
3366 | descriptor.enumerable = descriptor.enumerable || false;
|
3367 | descriptor.configurable = true;
|
3368 | if ("value" in descriptor) descriptor.writable = true;
|
3369 | Object.defineProperty(target, descriptor.key, descriptor);
|
3370 | }
|
3371 | }
|
3372 |
|
3373 | function _createClass(Constructor, protoProps, staticProps) {
|
3374 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
3375 | if (staticProps) _defineProperties(Constructor, staticProps);
|
3376 | return Constructor;
|
3377 | }
|
3378 |
|
3379 | function _inheritsLoose$1(subClass, superClass) {
|
3380 | subClass.prototype = Object.create(superClass.prototype);
|
3381 | subClass.prototype.constructor = subClass;
|
3382 | subClass.__proto__ = superClass;
|
3383 | }
|
3384 |
|
3385 | function _assertThisInitialized$1(self) {
|
3386 | if (self === void 0) {
|
3387 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
3388 | }
|
3389 |
|
3390 | return self;
|
3391 | }
|
3392 |
|
3393 | var plainObjectConstrurctor = {}.constructor;
|
3394 |
|
3395 | function cloneStyle(style) {
|
3396 | if (style == null || typeof style !== 'object') return style;
|
3397 | if (Array.isArray(style)) return style.map(cloneStyle);
|
3398 | if (style.constructor !== plainObjectConstrurctor) return style;
|
3399 | var newStyle = {};
|
3400 |
|
3401 | for (var name in style) {
|
3402 | newStyle[name] = cloneStyle(style[name]);
|
3403 | }
|
3404 |
|
3405 | return newStyle;
|
3406 | }
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 | function createRule(name, decl, options) {
|
3413 | if (name === void 0) {
|
3414 | name = 'unnamed';
|
3415 | }
|
3416 |
|
3417 | var jss = options.jss;
|
3418 | var declCopy = cloneStyle(decl);
|
3419 | var rule = jss.plugins.onCreateRule(name, declCopy, options);
|
3420 | if (rule) return rule;
|
3421 |
|
3422 | if (name[0] === '@') {
|
3423 | warning(false, "[JSS] Unknown rule " + name) ;
|
3424 | }
|
3425 |
|
3426 | return null;
|
3427 | }
|
3428 |
|
3429 | var join = function join(value, by) {
|
3430 | var result = '';
|
3431 |
|
3432 | for (var i = 0; i < value.length; i++) {
|
3433 |
|
3434 | if (value[i] === '!important') break;
|
3435 | if (result) result += by;
|
3436 | result += value[i];
|
3437 | }
|
3438 |
|
3439 | return result;
|
3440 | };
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 | var toCssValue = function toCssValue(value) {
|
3452 | if (!Array.isArray(value)) return value;
|
3453 | var cssValue = '';
|
3454 |
|
3455 | if (Array.isArray(value[0])) {
|
3456 | for (var i = 0; i < value.length; i++) {
|
3457 | if (value[i] === '!important') break;
|
3458 | if (cssValue) cssValue += ', ';
|
3459 | cssValue += join(value[i], ' ');
|
3460 | }
|
3461 | } else cssValue = join(value, ', ');
|
3462 |
|
3463 |
|
3464 | if (value[value.length - 1] === '!important') {
|
3465 | cssValue += ' !important';
|
3466 | }
|
3467 |
|
3468 | return cssValue;
|
3469 | };
|
3470 |
|
3471 | function getWhitespaceSymbols(options) {
|
3472 | if (options && options.format === false) {
|
3473 | return {
|
3474 | linebreak: '',
|
3475 | space: ''
|
3476 | };
|
3477 | }
|
3478 |
|
3479 | return {
|
3480 | linebreak: '\n',
|
3481 | space: ' '
|
3482 | };
|
3483 | }
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 |
|
3490 | function indentStr(str, indent) {
|
3491 | var result = '';
|
3492 |
|
3493 | for (var index = 0; index < indent; index++) {
|
3494 | result += ' ';
|
3495 | }
|
3496 |
|
3497 | return result + str;
|
3498 | }
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 | function toCss(selector, style, options) {
|
3505 | if (options === void 0) {
|
3506 | options = {};
|
3507 | }
|
3508 |
|
3509 | var result = '';
|
3510 | if (!style) return result;
|
3511 | var _options = options,
|
3512 | _options$indent = _options.indent,
|
3513 | indent = _options$indent === void 0 ? 0 : _options$indent;
|
3514 | var fallbacks = style.fallbacks;
|
3515 |
|
3516 | if (options.format === false) {
|
3517 | indent = -Infinity;
|
3518 | }
|
3519 |
|
3520 | var _getWhitespaceSymbols = getWhitespaceSymbols(options),
|
3521 | linebreak = _getWhitespaceSymbols.linebreak,
|
3522 | space = _getWhitespaceSymbols.space;
|
3523 |
|
3524 | if (selector) indent++;
|
3525 |
|
3526 | if (fallbacks) {
|
3527 |
|
3528 | if (Array.isArray(fallbacks)) {
|
3529 | for (var index = 0; index < fallbacks.length; index++) {
|
3530 | var fallback = fallbacks[index];
|
3531 |
|
3532 | for (var prop in fallback) {
|
3533 | var value = fallback[prop];
|
3534 |
|
3535 | if (value != null) {
|
3536 | if (result) result += linebreak;
|
3537 | result += indentStr(prop + ":" + space + toCssValue(value) + ";", indent);
|
3538 | }
|
3539 | }
|
3540 | }
|
3541 | } else {
|
3542 |
|
3543 | for (var _prop in fallbacks) {
|
3544 | var _value = fallbacks[_prop];
|
3545 |
|
3546 | if (_value != null) {
|
3547 | if (result) result += linebreak;
|
3548 | result += indentStr(_prop + ":" + space + toCssValue(_value) + ";", indent);
|
3549 | }
|
3550 | }
|
3551 | }
|
3552 | }
|
3553 |
|
3554 | for (var _prop2 in style) {
|
3555 | var _value2 = style[_prop2];
|
3556 |
|
3557 | if (_value2 != null && _prop2 !== 'fallbacks') {
|
3558 | if (result) result += linebreak;
|
3559 | result += indentStr(_prop2 + ":" + space + toCssValue(_value2) + ";", indent);
|
3560 | }
|
3561 | }
|
3562 |
|
3563 |
|
3564 | if (!result && !options.allowEmpty) return result;
|
3565 |
|
3566 | if (!selector) return result;
|
3567 | indent--;
|
3568 | if (result) result = "" + linebreak + result + linebreak;
|
3569 | return indentStr("" + selector + space + "{" + result, indent) + indentStr('}', indent);
|
3570 | }
|
3571 |
|
3572 | var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g;
|
3573 | var nativeEscape = typeof CSS !== 'undefined' && CSS.escape;
|
3574 |
|
3575 | var escape = function escape(str) {
|
3576 | return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, '\\$1');
|
3577 | };
|
3578 |
|
3579 | var BaseStyleRule =
|
3580 |
|
3581 | function () {
|
3582 | function BaseStyleRule(key, style, options) {
|
3583 | this.type = 'style';
|
3584 | this.isProcessed = false;
|
3585 | var sheet = options.sheet,
|
3586 | Renderer = options.Renderer;
|
3587 | this.key = key;
|
3588 | this.options = options;
|
3589 | this.style = style;
|
3590 | if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer();
|
3591 | }
|
3592 | |
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 | var _proto = BaseStyleRule.prototype;
|
3598 |
|
3599 | _proto.prop = function prop(name, value, options) {
|
3600 |
|
3601 | if (value === undefined) return this.style[name];
|
3602 |
|
3603 | var force = options ? options.force : false;
|
3604 | if (!force && this.style[name] === value) return this;
|
3605 | var newValue = value;
|
3606 |
|
3607 | if (!options || options.process !== false) {
|
3608 | newValue = this.options.jss.plugins.onChangeValue(value, name, this);
|
3609 | }
|
3610 |
|
3611 | var isEmpty = newValue == null || newValue === false;
|
3612 | var isDefined = name in this.style;
|
3613 |
|
3614 | if (isEmpty && !isDefined && !force) return this;
|
3615 |
|
3616 | var remove = isEmpty && isDefined;
|
3617 | if (remove) delete this.style[name];else this.style[name] = newValue;
|
3618 |
|
3619 | if (this.renderable && this.renderer) {
|
3620 | if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue);
|
3621 | return this;
|
3622 | }
|
3623 |
|
3624 | var sheet = this.options.sheet;
|
3625 |
|
3626 | if (sheet && sheet.attached) {
|
3627 | warning(false, '[JSS] Rule is not linked. Missing sheet option "link: true".') ;
|
3628 | }
|
3629 |
|
3630 | return this;
|
3631 | };
|
3632 |
|
3633 | return BaseStyleRule;
|
3634 | }();
|
3635 |
|
3636 | var StyleRule =
|
3637 |
|
3638 | function (_BaseStyleRule) {
|
3639 | _inheritsLoose$1(StyleRule, _BaseStyleRule);
|
3640 |
|
3641 | function StyleRule(key, style, options) {
|
3642 | var _this;
|
3643 |
|
3644 | _this = _BaseStyleRule.call(this, key, style, options) || this;
|
3645 | var selector = options.selector,
|
3646 | scoped = options.scoped,
|
3647 | sheet = options.sheet,
|
3648 | generateId = options.generateId;
|
3649 |
|
3650 | if (selector) {
|
3651 | _this.selectorText = selector;
|
3652 | } else if (scoped !== false) {
|
3653 | _this.id = generateId(_assertThisInitialized$1(_assertThisInitialized$1(_this)), sheet);
|
3654 | _this.selectorText = "." + escape(_this.id);
|
3655 | }
|
3656 |
|
3657 | return _this;
|
3658 | }
|
3659 | |
3660 |
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 | var _proto2 = StyleRule.prototype;
|
3667 | |
3668 |
|
3669 |
|
3670 |
|
3671 | _proto2.applyTo = function applyTo(renderable) {
|
3672 | var renderer = this.renderer;
|
3673 |
|
3674 | if (renderer) {
|
3675 | var json = this.toJSON();
|
3676 |
|
3677 | for (var prop in json) {
|
3678 | renderer.setProperty(renderable, prop, json[prop]);
|
3679 | }
|
3680 | }
|
3681 |
|
3682 | return this;
|
3683 | }
|
3684 | |
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 | ;
|
3690 |
|
3691 | _proto2.toJSON = function toJSON() {
|
3692 | var json = {};
|
3693 |
|
3694 | for (var prop in this.style) {
|
3695 | var value = this.style[prop];
|
3696 | if (typeof value !== 'object') json[prop] = value;else if (Array.isArray(value)) json[prop] = toCssValue(value);
|
3697 | }
|
3698 |
|
3699 | return json;
|
3700 | }
|
3701 | |
3702 |
|
3703 |
|
3704 | ;
|
3705 |
|
3706 | _proto2.toString = function toString(options) {
|
3707 | var sheet = this.options.sheet;
|
3708 | var link = sheet ? sheet.options.link : false;
|
3709 | var opts = link ? _extends({}, options, {
|
3710 | allowEmpty: true
|
3711 | }) : options;
|
3712 | return toCss(this.selectorText, this.style, opts);
|
3713 | };
|
3714 |
|
3715 | _createClass(StyleRule, [{
|
3716 | key: "selector",
|
3717 | set: function set(selector) {
|
3718 | if (selector === this.selectorText) return;
|
3719 | this.selectorText = selector;
|
3720 | var renderer = this.renderer,
|
3721 | renderable = this.renderable;
|
3722 | if (!renderable || !renderer) return;
|
3723 | var hasChanged = renderer.setSelector(renderable, selector);
|
3724 |
|
3725 | if (!hasChanged) {
|
3726 | renderer.replaceRule(renderable, this);
|
3727 | }
|
3728 | }
|
3729 | |
3730 |
|
3731 |
|
3732 | ,
|
3733 | get: function get() {
|
3734 | return this.selectorText;
|
3735 | }
|
3736 | }]);
|
3737 |
|
3738 | return StyleRule;
|
3739 | }(BaseStyleRule);
|
3740 |
|
3741 | var pluginStyleRule = {
|
3742 | onCreateRule: function onCreateRule(key, style, options) {
|
3743 | if (key[0] === '@' || options.parent && options.parent.type === 'keyframes') {
|
3744 | return null;
|
3745 | }
|
3746 |
|
3747 | return new StyleRule(key, style, options);
|
3748 | }
|
3749 | };
|
3750 | var defaultToStringOptions = {
|
3751 | indent: 1,
|
3752 | children: true
|
3753 | };
|
3754 | var atRegExp = /@([\w-]+)/;
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 | var ConditionalRule =
|
3760 |
|
3761 | function () {
|
3762 | function ConditionalRule(key, styles, options) {
|
3763 | this.type = 'conditional';
|
3764 | this.isProcessed = false;
|
3765 | this.key = key;
|
3766 | var atMatch = key.match(atRegExp);
|
3767 | this.at = atMatch ? atMatch[1] : 'unknown';
|
3768 |
|
3769 | this.query = options.name || "@" + this.at;
|
3770 | this.options = options;
|
3771 | this.rules = new RuleList(_extends({}, options, {
|
3772 | parent: this
|
3773 | }));
|
3774 |
|
3775 | for (var name in styles) {
|
3776 | this.rules.add(name, styles[name]);
|
3777 | }
|
3778 |
|
3779 | this.rules.process();
|
3780 | }
|
3781 | |
3782 |
|
3783 |
|
3784 |
|
3785 |
|
3786 | var _proto = ConditionalRule.prototype;
|
3787 |
|
3788 | _proto.getRule = function getRule(name) {
|
3789 | return this.rules.get(name);
|
3790 | }
|
3791 | |
3792 |
|
3793 |
|
3794 | ;
|
3795 |
|
3796 | _proto.indexOf = function indexOf(rule) {
|
3797 | return this.rules.indexOf(rule);
|
3798 | }
|
3799 | |
3800 |
|
3801 |
|
3802 | ;
|
3803 |
|
3804 | _proto.addRule = function addRule(name, style, options) {
|
3805 | var rule = this.rules.add(name, style, options);
|
3806 | if (!rule) return null;
|
3807 | this.options.jss.plugins.onProcessRule(rule);
|
3808 | return rule;
|
3809 | }
|
3810 | |
3811 |
|
3812 |
|
3813 | ;
|
3814 |
|
3815 | _proto.replaceRule = function replaceRule(name, style, options) {
|
3816 | var newRule = this.rules.replace(name, style, options);
|
3817 | if (newRule) this.options.jss.plugins.onProcessRule(newRule);
|
3818 | return newRule;
|
3819 | }
|
3820 | |
3821 |
|
3822 |
|
3823 | ;
|
3824 |
|
3825 | _proto.toString = function toString(options) {
|
3826 | if (options === void 0) {
|
3827 | options = defaultToStringOptions;
|
3828 | }
|
3829 |
|
3830 | var _getWhitespaceSymbols = getWhitespaceSymbols(options),
|
3831 | linebreak = _getWhitespaceSymbols.linebreak;
|
3832 |
|
3833 | if (options.indent == null) options.indent = defaultToStringOptions.indent;
|
3834 | if (options.children == null) options.children = defaultToStringOptions.children;
|
3835 |
|
3836 | if (options.children === false) {
|
3837 | return this.query + " {}";
|
3838 | }
|
3839 |
|
3840 | var children = this.rules.toString(options);
|
3841 | return children ? this.query + " {" + linebreak + children + linebreak + "}" : '';
|
3842 | };
|
3843 |
|
3844 | return ConditionalRule;
|
3845 | }();
|
3846 |
|
3847 | var keyRegExp = /@media|@supports\s+/;
|
3848 | var pluginConditionalRule = {
|
3849 | onCreateRule: function onCreateRule(key, styles, options) {
|
3850 | return keyRegExp.test(key) ? new ConditionalRule(key, styles, options) : null;
|
3851 | }
|
3852 | };
|
3853 | var defaultToStringOptions$1 = {
|
3854 | indent: 1,
|
3855 | children: true
|
3856 | };
|
3857 | var nameRegExp = /@keyframes\s+([\w-]+)/;
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 | var KeyframesRule =
|
3863 |
|
3864 | function () {
|
3865 | function KeyframesRule(key, frames, options) {
|
3866 | this.type = 'keyframes';
|
3867 | this.at = '@keyframes';
|
3868 | this.isProcessed = false;
|
3869 | var nameMatch = key.match(nameRegExp);
|
3870 |
|
3871 | if (nameMatch && nameMatch[1]) {
|
3872 | this.name = nameMatch[1];
|
3873 | } else {
|
3874 | this.name = 'noname';
|
3875 | warning(false, "[JSS] Bad keyframes name " + key) ;
|
3876 | }
|
3877 |
|
3878 | this.key = this.type + "-" + this.name;
|
3879 | this.options = options;
|
3880 | var scoped = options.scoped,
|
3881 | sheet = options.sheet,
|
3882 | generateId = options.generateId;
|
3883 | this.id = scoped === false ? this.name : escape(generateId(this, sheet));
|
3884 | this.rules = new RuleList(_extends({}, options, {
|
3885 | parent: this
|
3886 | }));
|
3887 |
|
3888 | for (var name in frames) {
|
3889 | this.rules.add(name, frames[name], _extends({}, options, {
|
3890 | parent: this
|
3891 | }));
|
3892 | }
|
3893 |
|
3894 | this.rules.process();
|
3895 | }
|
3896 | |
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 | var _proto = KeyframesRule.prototype;
|
3902 |
|
3903 | _proto.toString = function toString(options) {
|
3904 | if (options === void 0) {
|
3905 | options = defaultToStringOptions$1;
|
3906 | }
|
3907 |
|
3908 | var _getWhitespaceSymbols = getWhitespaceSymbols(options),
|
3909 | linebreak = _getWhitespaceSymbols.linebreak;
|
3910 |
|
3911 | if (options.indent == null) options.indent = defaultToStringOptions$1.indent;
|
3912 | if (options.children == null) options.children = defaultToStringOptions$1.children;
|
3913 |
|
3914 | if (options.children === false) {
|
3915 | return this.at + " " + this.id + " {}";
|
3916 | }
|
3917 |
|
3918 | var children = this.rules.toString(options);
|
3919 | if (children) children = "" + linebreak + children + linebreak;
|
3920 | return this.at + " " + this.id + " {" + children + "}";
|
3921 | };
|
3922 |
|
3923 | return KeyframesRule;
|
3924 | }();
|
3925 |
|
3926 | var keyRegExp$1 = /@keyframes\s+/;
|
3927 | var refRegExp = /\$([\w-]+)/g;
|
3928 |
|
3929 | var findReferencedKeyframe = function findReferencedKeyframe(val, keyframes) {
|
3930 | if (typeof val === 'string') {
|
3931 | return val.replace(refRegExp, function (match, name) {
|
3932 | if (name in keyframes) {
|
3933 | return keyframes[name];
|
3934 | }
|
3935 |
|
3936 | warning(false, "[JSS] Referenced keyframes rule \"" + name + "\" is not defined.") ;
|
3937 | return match;
|
3938 | });
|
3939 | }
|
3940 |
|
3941 | return val;
|
3942 | };
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 | var replaceRef = function replaceRef(style, prop, keyframes) {
|
3949 | var value = style[prop];
|
3950 | var refKeyframe = findReferencedKeyframe(value, keyframes);
|
3951 |
|
3952 | if (refKeyframe !== value) {
|
3953 | style[prop] = refKeyframe;
|
3954 | }
|
3955 | };
|
3956 |
|
3957 | var pluginKeyframesRule = {
|
3958 | onCreateRule: function onCreateRule(key, frames, options) {
|
3959 | return typeof key === 'string' && keyRegExp$1.test(key) ? new KeyframesRule(key, frames, options) : null;
|
3960 | },
|
3961 |
|
3962 | onProcessStyle: function onProcessStyle(style, rule, sheet) {
|
3963 | if (rule.type !== 'style' || !sheet) return style;
|
3964 | if ('animation-name' in style) replaceRef(style, 'animation-name', sheet.keyframes);
|
3965 | if ('animation' in style) replaceRef(style, 'animation', sheet.keyframes);
|
3966 | return style;
|
3967 | },
|
3968 | onChangeValue: function onChangeValue(val, prop, rule) {
|
3969 | var sheet = rule.options.sheet;
|
3970 |
|
3971 | if (!sheet) {
|
3972 | return val;
|
3973 | }
|
3974 |
|
3975 | switch (prop) {
|
3976 | case 'animation':
|
3977 | return findReferencedKeyframe(val, sheet.keyframes);
|
3978 |
|
3979 | case 'animation-name':
|
3980 | return findReferencedKeyframe(val, sheet.keyframes);
|
3981 |
|
3982 | default:
|
3983 | return val;
|
3984 | }
|
3985 | }
|
3986 | };
|
3987 |
|
3988 | var KeyframeRule =
|
3989 |
|
3990 | function (_BaseStyleRule) {
|
3991 | _inheritsLoose$1(KeyframeRule, _BaseStyleRule);
|
3992 |
|
3993 | function KeyframeRule() {
|
3994 | return _BaseStyleRule.apply(this, arguments) || this;
|
3995 | }
|
3996 |
|
3997 | var _proto = KeyframeRule.prototype;
|
3998 | |
3999 |
|
4000 |
|
4001 |
|
4002 | _proto.toString = function toString(options) {
|
4003 | var sheet = this.options.sheet;
|
4004 | var link = sheet ? sheet.options.link : false;
|
4005 | var opts = link ? _extends({}, options, {
|
4006 | allowEmpty: true
|
4007 | }) : options;
|
4008 | return toCss(this.key, this.style, opts);
|
4009 | };
|
4010 |
|
4011 | return KeyframeRule;
|
4012 | }(BaseStyleRule);
|
4013 |
|
4014 | var pluginKeyframeRule = {
|
4015 | onCreateRule: function onCreateRule(key, style, options) {
|
4016 | if (options.parent && options.parent.type === 'keyframes') {
|
4017 | return new KeyframeRule(key, style, options);
|
4018 | }
|
4019 |
|
4020 | return null;
|
4021 | }
|
4022 | };
|
4023 |
|
4024 | var FontFaceRule =
|
4025 |
|
4026 | function () {
|
4027 | function FontFaceRule(key, style, options) {
|
4028 | this.type = 'font-face';
|
4029 | this.at = '@font-face';
|
4030 | this.isProcessed = false;
|
4031 | this.key = key;
|
4032 | this.style = style;
|
4033 | this.options = options;
|
4034 | }
|
4035 | |
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 | var _proto = FontFaceRule.prototype;
|
4041 |
|
4042 | _proto.toString = function toString(options) {
|
4043 | var _getWhitespaceSymbols = getWhitespaceSymbols(options),
|
4044 | linebreak = _getWhitespaceSymbols.linebreak;
|
4045 |
|
4046 | if (Array.isArray(this.style)) {
|
4047 | var str = '';
|
4048 |
|
4049 | for (var index = 0; index < this.style.length; index++) {
|
4050 | str += toCss(this.at, this.style[index]);
|
4051 | if (this.style[index + 1]) str += linebreak;
|
4052 | }
|
4053 |
|
4054 | return str;
|
4055 | }
|
4056 |
|
4057 | return toCss(this.at, this.style, options);
|
4058 | };
|
4059 |
|
4060 | return FontFaceRule;
|
4061 | }();
|
4062 |
|
4063 | var keyRegExp$2 = /@font-face/;
|
4064 | var pluginFontFaceRule = {
|
4065 | onCreateRule: function onCreateRule(key, style, options) {
|
4066 | return keyRegExp$2.test(key) ? new FontFaceRule(key, style, options) : null;
|
4067 | }
|
4068 | };
|
4069 |
|
4070 | var ViewportRule =
|
4071 |
|
4072 | function () {
|
4073 | function ViewportRule(key, style, options) {
|
4074 | this.type = 'viewport';
|
4075 | this.at = '@viewport';
|
4076 | this.isProcessed = false;
|
4077 | this.key = key;
|
4078 | this.style = style;
|
4079 | this.options = options;
|
4080 | }
|
4081 | |
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 | var _proto = ViewportRule.prototype;
|
4087 |
|
4088 | _proto.toString = function toString(options) {
|
4089 | return toCss(this.key, this.style, options);
|
4090 | };
|
4091 |
|
4092 | return ViewportRule;
|
4093 | }();
|
4094 |
|
4095 | var pluginViewportRule = {
|
4096 | onCreateRule: function onCreateRule(key, style, options) {
|
4097 | return key === '@viewport' || key === '@-ms-viewport' ? new ViewportRule(key, style, options) : null;
|
4098 | }
|
4099 | };
|
4100 |
|
4101 | var SimpleRule =
|
4102 |
|
4103 | function () {
|
4104 | function SimpleRule(key, value, options) {
|
4105 | this.type = 'simple';
|
4106 | this.isProcessed = false;
|
4107 | this.key = key;
|
4108 | this.value = value;
|
4109 | this.options = options;
|
4110 | }
|
4111 | |
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 | var _proto = SimpleRule.prototype;
|
4118 |
|
4119 | _proto.toString = function toString(options) {
|
4120 | if (Array.isArray(this.value)) {
|
4121 | var str = '';
|
4122 |
|
4123 | for (var index = 0; index < this.value.length; index++) {
|
4124 | str += this.key + " " + this.value[index] + ";";
|
4125 | if (this.value[index + 1]) str += '\n';
|
4126 | }
|
4127 |
|
4128 | return str;
|
4129 | }
|
4130 |
|
4131 | return this.key + " " + this.value + ";";
|
4132 | };
|
4133 |
|
4134 | return SimpleRule;
|
4135 | }();
|
4136 |
|
4137 | var keysMap = {
|
4138 | '@charset': true,
|
4139 | '@import': true,
|
4140 | '@namespace': true
|
4141 | };
|
4142 | var pluginSimpleRule = {
|
4143 | onCreateRule: function onCreateRule(key, value, options) {
|
4144 | return key in keysMap ? new SimpleRule(key, value, options) : null;
|
4145 | }
|
4146 | };
|
4147 | var plugins = [pluginStyleRule, pluginConditionalRule, pluginKeyframesRule, pluginKeyframeRule, pluginFontFaceRule, pluginViewportRule, pluginSimpleRule];
|
4148 | var defaultUpdateOptions = {
|
4149 | process: true
|
4150 | };
|
4151 | var forceUpdateOptions = {
|
4152 | force: true,
|
4153 | process: true
|
4154 | |
4155 |
|
4156 |
|
4157 |
|
4158 |
|
4159 | };
|
4160 |
|
4161 | var RuleList =
|
4162 |
|
4163 | function () {
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 | function RuleList(options) {
|
4169 | this.map = {};
|
4170 | this.raw = {};
|
4171 | this.index = [];
|
4172 | this.counter = 0;
|
4173 | this.options = options;
|
4174 | this.classes = options.classes;
|
4175 | this.keyframes = options.keyframes;
|
4176 | }
|
4177 | |
4178 |
|
4179 |
|
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 | var _proto = RuleList.prototype;
|
4185 |
|
4186 | _proto.add = function add(name, decl, ruleOptions) {
|
4187 | var _this$options = this.options,
|
4188 | parent = _this$options.parent,
|
4189 | sheet = _this$options.sheet,
|
4190 | jss = _this$options.jss,
|
4191 | Renderer = _this$options.Renderer,
|
4192 | generateId = _this$options.generateId,
|
4193 | scoped = _this$options.scoped;
|
4194 |
|
4195 | var options = _extends({
|
4196 | classes: this.classes,
|
4197 | parent: parent,
|
4198 | sheet: sheet,
|
4199 | jss: jss,
|
4200 | Renderer: Renderer,
|
4201 | generateId: generateId,
|
4202 | scoped: scoped,
|
4203 | name: name,
|
4204 | keyframes: this.keyframes,
|
4205 | selector: undefined
|
4206 | }, ruleOptions);
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 | var key = name;
|
4212 |
|
4213 | if (name in this.raw) {
|
4214 | key = name + "-d" + this.counter++;
|
4215 | }
|
4216 |
|
4217 |
|
4218 |
|
4219 | this.raw[key] = decl;
|
4220 |
|
4221 | if (key in this.classes) {
|
4222 |
|
4223 | options.selector = "." + escape(this.classes[key]);
|
4224 | }
|
4225 |
|
4226 | var rule = createRule(key, decl, options);
|
4227 | if (!rule) return null;
|
4228 | this.register(rule);
|
4229 | var index = options.index === undefined ? this.index.length : options.index;
|
4230 | this.index.splice(index, 0, rule);
|
4231 | return rule;
|
4232 | }
|
4233 | |
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 | ;
|
4239 |
|
4240 | _proto.replace = function replace(name, decl, ruleOptions) {
|
4241 | var oldRule = this.get(name);
|
4242 | var oldIndex = this.index.indexOf(oldRule);
|
4243 |
|
4244 | if (oldRule) {
|
4245 | this.remove(oldRule);
|
4246 | }
|
4247 |
|
4248 | var options = ruleOptions;
|
4249 | if (oldIndex !== -1) options = _extends({}, ruleOptions, {
|
4250 | index: oldIndex
|
4251 | });
|
4252 | return this.add(name, decl, options);
|
4253 | }
|
4254 | |
4255 |
|
4256 |
|
4257 | ;
|
4258 |
|
4259 | _proto.get = function get(nameOrSelector) {
|
4260 | return this.map[nameOrSelector];
|
4261 | }
|
4262 | |
4263 |
|
4264 |
|
4265 | ;
|
4266 |
|
4267 | _proto.remove = function remove(rule) {
|
4268 | this.unregister(rule);
|
4269 | delete this.raw[rule.key];
|
4270 | this.index.splice(this.index.indexOf(rule), 1);
|
4271 | }
|
4272 | |
4273 |
|
4274 |
|
4275 | ;
|
4276 |
|
4277 | _proto.indexOf = function indexOf(rule) {
|
4278 | return this.index.indexOf(rule);
|
4279 | }
|
4280 | |
4281 |
|
4282 |
|
4283 | ;
|
4284 |
|
4285 | _proto.process = function process() {
|
4286 | var plugins = this.options.jss.plugins;
|
4287 |
|
4288 |
|
4289 | this.index.slice(0).forEach(plugins.onProcessRule, plugins);
|
4290 | }
|
4291 | |
4292 |
|
4293 |
|
4294 | ;
|
4295 |
|
4296 | _proto.register = function register(rule) {
|
4297 | this.map[rule.key] = rule;
|
4298 |
|
4299 | if (rule instanceof StyleRule) {
|
4300 | this.map[rule.selector] = rule;
|
4301 | if (rule.id) this.classes[rule.key] = rule.id;
|
4302 | } else if (rule instanceof KeyframesRule && this.keyframes) {
|
4303 | this.keyframes[rule.name] = rule.id;
|
4304 | }
|
4305 | }
|
4306 | |
4307 |
|
4308 |
|
4309 | ;
|
4310 |
|
4311 | _proto.unregister = function unregister(rule) {
|
4312 | delete this.map[rule.key];
|
4313 |
|
4314 | if (rule instanceof StyleRule) {
|
4315 | delete this.map[rule.selector];
|
4316 | delete this.classes[rule.key];
|
4317 | } else if (rule instanceof KeyframesRule) {
|
4318 | delete this.keyframes[rule.name];
|
4319 | }
|
4320 | }
|
4321 | |
4322 |
|
4323 |
|
4324 | ;
|
4325 |
|
4326 | _proto.update = function update() {
|
4327 | var name;
|
4328 | var data;
|
4329 | var options;
|
4330 |
|
4331 | if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
|
4332 | name = arguments.length <= 0 ? undefined : arguments[0];
|
4333 | data = arguments.length <= 1 ? undefined : arguments[1];
|
4334 | options = arguments.length <= 2 ? undefined : arguments[2];
|
4335 | } else {
|
4336 | data = arguments.length <= 0 ? undefined : arguments[0];
|
4337 | options = arguments.length <= 1 ? undefined : arguments[1];
|
4338 | name = null;
|
4339 | }
|
4340 |
|
4341 | if (name) {
|
4342 | this.updateOne(this.get(name), data, options);
|
4343 | } else {
|
4344 | for (var index = 0; index < this.index.length; index++) {
|
4345 | this.updateOne(this.index[index], data, options);
|
4346 | }
|
4347 | }
|
4348 | }
|
4349 | |
4350 |
|
4351 |
|
4352 | ;
|
4353 |
|
4354 | _proto.updateOne = function updateOne(rule, data, options) {
|
4355 | if (options === void 0) {
|
4356 | options = defaultUpdateOptions;
|
4357 | }
|
4358 |
|
4359 | var _this$options2 = this.options,
|
4360 | plugins = _this$options2.jss.plugins,
|
4361 | sheet = _this$options2.sheet;
|
4362 |
|
4363 | if (rule.rules instanceof RuleList) {
|
4364 | rule.rules.update(data, options);
|
4365 | return;
|
4366 | }
|
4367 |
|
4368 | var style = rule.style;
|
4369 | plugins.onUpdate(data, rule, sheet, options);
|
4370 |
|
4371 | if (options.process && style && style !== rule.style) {
|
4372 |
|
4373 | plugins.onProcessStyle(rule.style, rule, sheet);
|
4374 |
|
4375 | for (var prop in rule.style) {
|
4376 | var nextValue = rule.style[prop];
|
4377 | var prevValue = style[prop];
|
4378 |
|
4379 |
|
4380 | if (nextValue !== prevValue) {
|
4381 | rule.prop(prop, nextValue, forceUpdateOptions);
|
4382 | }
|
4383 | }
|
4384 |
|
4385 |
|
4386 | for (var _prop in style) {
|
4387 | var _nextValue = rule.style[_prop];
|
4388 | var _prevValue = style[_prop];
|
4389 |
|
4390 |
|
4391 | if (_nextValue == null && _nextValue !== _prevValue) {
|
4392 | rule.prop(_prop, null, forceUpdateOptions);
|
4393 | }
|
4394 | }
|
4395 | }
|
4396 | }
|
4397 | |
4398 |
|
4399 |
|
4400 | ;
|
4401 |
|
4402 | _proto.toString = function toString(options) {
|
4403 | var str = '';
|
4404 | var sheet = this.options.sheet;
|
4405 | var link = sheet ? sheet.options.link : false;
|
4406 |
|
4407 | var _getWhitespaceSymbols = getWhitespaceSymbols(options),
|
4408 | linebreak = _getWhitespaceSymbols.linebreak;
|
4409 |
|
4410 | for (var index = 0; index < this.index.length; index++) {
|
4411 | var rule = this.index[index];
|
4412 | var css = rule.toString(options);
|
4413 |
|
4414 | if (!css && !link) continue;
|
4415 | if (str) str += linebreak;
|
4416 | str += css;
|
4417 | }
|
4418 |
|
4419 | return str;
|
4420 | };
|
4421 |
|
4422 | return RuleList;
|
4423 | }();
|
4424 |
|
4425 | var StyleSheet =
|
4426 |
|
4427 | function () {
|
4428 | function StyleSheet(styles, options) {
|
4429 | this.attached = false;
|
4430 | this.deployed = false;
|
4431 | this.classes = {};
|
4432 | this.keyframes = {};
|
4433 | this.options = _extends({}, options, {
|
4434 | sheet: this,
|
4435 | parent: this,
|
4436 | classes: this.classes,
|
4437 | keyframes: this.keyframes
|
4438 | });
|
4439 |
|
4440 | if (options.Renderer) {
|
4441 | this.renderer = new options.Renderer(this);
|
4442 | }
|
4443 |
|
4444 | this.rules = new RuleList(this.options);
|
4445 |
|
4446 | for (var name in styles) {
|
4447 | this.rules.add(name, styles[name]);
|
4448 | }
|
4449 |
|
4450 | this.rules.process();
|
4451 | }
|
4452 | |
4453 |
|
4454 |
|
4455 |
|
4456 |
|
4457 | var _proto = StyleSheet.prototype;
|
4458 |
|
4459 | _proto.attach = function attach() {
|
4460 | if (this.attached) return this;
|
4461 | if (this.renderer) this.renderer.attach();
|
4462 | this.attached = true;
|
4463 |
|
4464 | if (!this.deployed) this.deploy();
|
4465 | return this;
|
4466 | }
|
4467 | |
4468 |
|
4469 |
|
4470 | ;
|
4471 |
|
4472 | _proto.detach = function detach() {
|
4473 | if (!this.attached) return this;
|
4474 | if (this.renderer) this.renderer.detach();
|
4475 | this.attached = false;
|
4476 | return this;
|
4477 | }
|
4478 | |
4479 |
|
4480 |
|
4481 |
|
4482 | ;
|
4483 |
|
4484 | _proto.addRule = function addRule(name, decl, options) {
|
4485 | var queue = this.queue;
|
4486 |
|
4487 |
|
4488 |
|
4489 | if (this.attached && !queue) this.queue = [];
|
4490 | var rule = this.rules.add(name, decl, options);
|
4491 | if (!rule) return null;
|
4492 | this.options.jss.plugins.onProcessRule(rule);
|
4493 |
|
4494 | if (this.attached) {
|
4495 | if (!this.deployed) return rule;
|
4496 |
|
4497 |
|
4498 | if (queue) queue.push(rule);else {
|
4499 | this.insertRule(rule);
|
4500 |
|
4501 | if (this.queue) {
|
4502 | this.queue.forEach(this.insertRule, this);
|
4503 | this.queue = undefined;
|
4504 | }
|
4505 | }
|
4506 | return rule;
|
4507 | }
|
4508 |
|
4509 |
|
4510 |
|
4511 | this.deployed = false;
|
4512 | return rule;
|
4513 | }
|
4514 | |
4515 |
|
4516 |
|
4517 | ;
|
4518 |
|
4519 | _proto.replaceRule = function replaceRule(nameOrSelector, decl, options) {
|
4520 | var oldRule = this.rules.get(nameOrSelector);
|
4521 | if (!oldRule) return this.addRule(nameOrSelector, decl, options);
|
4522 | var newRule = this.rules.replace(nameOrSelector, decl, options);
|
4523 |
|
4524 | if (newRule) {
|
4525 | this.options.jss.plugins.onProcessRule(newRule);
|
4526 | }
|
4527 |
|
4528 | if (this.attached) {
|
4529 | if (!this.deployed) return newRule;
|
4530 |
|
4531 |
|
4532 | if (this.renderer) {
|
4533 | if (!newRule) {
|
4534 | this.renderer.deleteRule(oldRule);
|
4535 | } else if (oldRule.renderable) {
|
4536 | this.renderer.replaceRule(oldRule.renderable, newRule);
|
4537 | }
|
4538 | }
|
4539 |
|
4540 | return newRule;
|
4541 | }
|
4542 |
|
4543 |
|
4544 |
|
4545 | this.deployed = false;
|
4546 | return newRule;
|
4547 | }
|
4548 | |
4549 |
|
4550 |
|
4551 | ;
|
4552 |
|
4553 | _proto.insertRule = function insertRule(rule) {
|
4554 | if (this.renderer) {
|
4555 | this.renderer.insertRule(rule);
|
4556 | }
|
4557 | }
|
4558 | |
4559 |
|
4560 |
|
4561 |
|
4562 | ;
|
4563 |
|
4564 | _proto.addRules = function addRules(styles, options) {
|
4565 | var added = [];
|
4566 |
|
4567 | for (var name in styles) {
|
4568 | var rule = this.addRule(name, styles[name], options);
|
4569 | if (rule) added.push(rule);
|
4570 | }
|
4571 |
|
4572 | return added;
|
4573 | }
|
4574 | |
4575 |
|
4576 |
|
4577 | ;
|
4578 |
|
4579 | _proto.getRule = function getRule(nameOrSelector) {
|
4580 | return this.rules.get(nameOrSelector);
|
4581 | }
|
4582 | |
4583 |
|
4584 |
|
4585 |
|
4586 | ;
|
4587 |
|
4588 | _proto.deleteRule = function deleteRule(name) {
|
4589 | var rule = typeof name === 'object' ? name : this.rules.get(name);
|
4590 |
|
4591 | if (!rule ||
|
4592 |
|
4593 | this.attached && !rule.renderable) {
|
4594 | return false;
|
4595 | }
|
4596 |
|
4597 | this.rules.remove(rule);
|
4598 |
|
4599 | if (this.attached && rule.renderable && this.renderer) {
|
4600 | return this.renderer.deleteRule(rule.renderable);
|
4601 | }
|
4602 |
|
4603 | return true;
|
4604 | }
|
4605 | |
4606 |
|
4607 |
|
4608 | ;
|
4609 |
|
4610 | _proto.indexOf = function indexOf(rule) {
|
4611 | return this.rules.indexOf(rule);
|
4612 | }
|
4613 | |
4614 |
|
4615 |
|
4616 | ;
|
4617 |
|
4618 | _proto.deploy = function deploy() {
|
4619 | if (this.renderer) this.renderer.deploy();
|
4620 | this.deployed = true;
|
4621 | return this;
|
4622 | }
|
4623 | |
4624 |
|
4625 |
|
4626 | ;
|
4627 |
|
4628 | _proto.update = function update() {
|
4629 | var _this$rules;
|
4630 |
|
4631 | (_this$rules = this.rules).update.apply(_this$rules, arguments);
|
4632 |
|
4633 | return this;
|
4634 | }
|
4635 | |
4636 |
|
4637 |
|
4638 | ;
|
4639 |
|
4640 | _proto.updateOne = function updateOne(rule, data, options) {
|
4641 | this.rules.updateOne(rule, data, options);
|
4642 | return this;
|
4643 | }
|
4644 | |
4645 |
|
4646 |
|
4647 | ;
|
4648 |
|
4649 | _proto.toString = function toString(options) {
|
4650 | return this.rules.toString(options);
|
4651 | };
|
4652 |
|
4653 | return StyleSheet;
|
4654 | }();
|
4655 |
|
4656 | var PluginsRegistry =
|
4657 |
|
4658 | function () {
|
4659 | function PluginsRegistry() {
|
4660 | this.plugins = {
|
4661 | internal: [],
|
4662 | external: []
|
4663 | };
|
4664 | this.registry = {};
|
4665 | }
|
4666 |
|
4667 | var _proto = PluginsRegistry.prototype;
|
4668 | |
4669 |
|
4670 |
|
4671 |
|
4672 | _proto.onCreateRule = function onCreateRule(name, decl, options) {
|
4673 | for (var i = 0; i < this.registry.onCreateRule.length; i++) {
|
4674 | var rule = this.registry.onCreateRule[i](name, decl, options);
|
4675 | if (rule) return rule;
|
4676 | }
|
4677 |
|
4678 | return null;
|
4679 | }
|
4680 | |
4681 |
|
4682 |
|
4683 | ;
|
4684 |
|
4685 | _proto.onProcessRule = function onProcessRule(rule) {
|
4686 | if (rule.isProcessed) return;
|
4687 | var sheet = rule.options.sheet;
|
4688 |
|
4689 | for (var i = 0; i < this.registry.onProcessRule.length; i++) {
|
4690 | this.registry.onProcessRule[i](rule, sheet);
|
4691 | }
|
4692 |
|
4693 | if (rule.style) this.onProcessStyle(rule.style, rule, sheet);
|
4694 | rule.isProcessed = true;
|
4695 | }
|
4696 | |
4697 |
|
4698 |
|
4699 | ;
|
4700 |
|
4701 | _proto.onProcessStyle = function onProcessStyle(style, rule, sheet) {
|
4702 | for (var i = 0; i < this.registry.onProcessStyle.length; i++) {
|
4703 | rule.style = this.registry.onProcessStyle[i](rule.style, rule, sheet);
|
4704 | }
|
4705 | }
|
4706 | |
4707 |
|
4708 |
|
4709 | ;
|
4710 |
|
4711 | _proto.onProcessSheet = function onProcessSheet(sheet) {
|
4712 | for (var i = 0; i < this.registry.onProcessSheet.length; i++) {
|
4713 | this.registry.onProcessSheet[i](sheet);
|
4714 | }
|
4715 | }
|
4716 | |
4717 |
|
4718 |
|
4719 | ;
|
4720 |
|
4721 | _proto.onUpdate = function onUpdate(data, rule, sheet, options) {
|
4722 | for (var i = 0; i < this.registry.onUpdate.length; i++) {
|
4723 | this.registry.onUpdate[i](data, rule, sheet, options);
|
4724 | }
|
4725 | }
|
4726 | |
4727 |
|
4728 |
|
4729 | ;
|
4730 |
|
4731 | _proto.onChangeValue = function onChangeValue(value, prop, rule) {
|
4732 | var processedValue = value;
|
4733 |
|
4734 | for (var i = 0; i < this.registry.onChangeValue.length; i++) {
|
4735 | processedValue = this.registry.onChangeValue[i](processedValue, prop, rule);
|
4736 | }
|
4737 |
|
4738 | return processedValue;
|
4739 | }
|
4740 | |
4741 |
|
4742 |
|
4743 | ;
|
4744 |
|
4745 | _proto.use = function use(newPlugin, options) {
|
4746 | if (options === void 0) {
|
4747 | options = {
|
4748 | queue: 'external'
|
4749 | };
|
4750 | }
|
4751 |
|
4752 | var plugins = this.plugins[options.queue];
|
4753 |
|
4754 | if (plugins.indexOf(newPlugin) !== -1) {
|
4755 | return;
|
4756 | }
|
4757 |
|
4758 | plugins.push(newPlugin);
|
4759 | this.registry = [].concat(this.plugins.external, this.plugins.internal).reduce(function (registry, plugin) {
|
4760 | for (var name in plugin) {
|
4761 | if (name in registry) {
|
4762 | registry[name].push(plugin[name]);
|
4763 | } else {
|
4764 | warning(false, "[JSS] Unknown hook \"" + name + "\".") ;
|
4765 | }
|
4766 | }
|
4767 |
|
4768 | return registry;
|
4769 | }, {
|
4770 | onCreateRule: [],
|
4771 | onProcessRule: [],
|
4772 | onProcessStyle: [],
|
4773 | onProcessSheet: [],
|
4774 | onChangeValue: [],
|
4775 | onUpdate: []
|
4776 | });
|
4777 | };
|
4778 |
|
4779 | return PluginsRegistry;
|
4780 | }();
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 |
|
4786 | var SheetsRegistry =
|
4787 |
|
4788 | function () {
|
4789 | function SheetsRegistry() {
|
4790 | this.registry = [];
|
4791 | }
|
4792 |
|
4793 | var _proto = SheetsRegistry.prototype;
|
4794 | |
4795 |
|
4796 |
|
4797 |
|
4798 | _proto.add = function add(sheet) {
|
4799 | var registry = this.registry;
|
4800 | var index = sheet.options.index;
|
4801 | if (registry.indexOf(sheet) !== -1) return;
|
4802 |
|
4803 | if (registry.length === 0 || index >= this.index) {
|
4804 | registry.push(sheet);
|
4805 | return;
|
4806 | }
|
4807 |
|
4808 |
|
4809 | for (var i = 0; i < registry.length; i++) {
|
4810 | if (registry[i].options.index > index) {
|
4811 | registry.splice(i, 0, sheet);
|
4812 | return;
|
4813 | }
|
4814 | }
|
4815 | }
|
4816 | |
4817 |
|
4818 |
|
4819 | ;
|
4820 |
|
4821 | _proto.reset = function reset() {
|
4822 | this.registry = [];
|
4823 | }
|
4824 | |
4825 |
|
4826 |
|
4827 | ;
|
4828 |
|
4829 | _proto.remove = function remove(sheet) {
|
4830 | var index = this.registry.indexOf(sheet);
|
4831 | this.registry.splice(index, 1);
|
4832 | }
|
4833 | |
4834 |
|
4835 |
|
4836 | ;
|
4837 |
|
4838 | _proto.toString = function toString(_temp) {
|
4839 | var _ref = _temp === void 0 ? {} : _temp,
|
4840 | attached = _ref.attached,
|
4841 | options = _objectWithoutPropertiesLoose(_ref, ["attached"]);
|
4842 |
|
4843 | var _getWhitespaceSymbols = getWhitespaceSymbols(options),
|
4844 | linebreak = _getWhitespaceSymbols.linebreak;
|
4845 |
|
4846 | var css = '';
|
4847 |
|
4848 | for (var i = 0; i < this.registry.length; i++) {
|
4849 | var sheet = this.registry[i];
|
4850 |
|
4851 | if (attached != null && sheet.attached !== attached) {
|
4852 | continue;
|
4853 | }
|
4854 |
|
4855 | if (css) css += linebreak;
|
4856 | css += sheet.toString(options);
|
4857 | }
|
4858 |
|
4859 | return css;
|
4860 | };
|
4861 |
|
4862 | _createClass(SheetsRegistry, [{
|
4863 | key: "index",
|
4864 |
|
4865 | |
4866 |
|
4867 |
|
4868 | get: function get() {
|
4869 | return this.registry.length === 0 ? 0 : this.registry[this.registry.length - 1].options.index;
|
4870 | }
|
4871 | }]);
|
4872 |
|
4873 | return SheetsRegistry;
|
4874 | }();
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 | var sheets = new SheetsRegistry();
|
4884 |
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 | var globalThis$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' && window.Math === Math ? window : typeof self !== 'undefined' && self.Math === Math ? self : Function('return this')();
|
4898 | var ns = '2f1acc6c3a606b082e5eef5e54414ffb';
|
4899 | if (globalThis$1[ns] == null) globalThis$1[ns] = 0;
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 | var moduleId = globalThis$1[ns]++;
|
4905 | var maxRules = 1e10;
|
4906 |
|
4907 |
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 | var createGenerateId = function createGenerateId(options) {
|
4913 | if (options === void 0) {
|
4914 | options = {};
|
4915 | }
|
4916 |
|
4917 | var ruleCounter = 0;
|
4918 |
|
4919 | var generateId = function generateId(rule, sheet) {
|
4920 | ruleCounter += 1;
|
4921 |
|
4922 | if (ruleCounter > maxRules) {
|
4923 | warning(false, "[JSS] You might have a memory leak. Rule counter is at " + ruleCounter + ".") ;
|
4924 | }
|
4925 |
|
4926 | var jssId = '';
|
4927 | var prefix = '';
|
4928 |
|
4929 | if (sheet) {
|
4930 | if (sheet.options.classNamePrefix) {
|
4931 | prefix = sheet.options.classNamePrefix;
|
4932 | }
|
4933 |
|
4934 | if (sheet.options.jss.id != null) {
|
4935 | jssId = String(sheet.options.jss.id);
|
4936 | }
|
4937 | }
|
4938 |
|
4939 | if (options.minify) {
|
4940 |
|
4941 | return "" + (prefix || 'c') + moduleId + jssId + ruleCounter;
|
4942 | }
|
4943 |
|
4944 | return prefix + rule.key + "-" + moduleId + (jssId ? "-" + jssId : '') + "-" + ruleCounter;
|
4945 | };
|
4946 |
|
4947 | return generateId;
|
4948 | };
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 | var memoize$1 = function memoize(fn) {
|
4955 | var value;
|
4956 | return function () {
|
4957 | if (!value) value = fn();
|
4958 | return value;
|
4959 | };
|
4960 | };
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 | var getPropertyValue = function getPropertyValue(cssRule, prop) {
|
4967 | try {
|
4968 |
|
4969 | if (cssRule.attributeStyleMap) {
|
4970 | return cssRule.attributeStyleMap.get(prop);
|
4971 | }
|
4972 |
|
4973 | return cssRule.style.getPropertyValue(prop);
|
4974 | } catch (err) {
|
4975 |
|
4976 | return '';
|
4977 | }
|
4978 | };
|
4979 |
|
4980 |
|
4981 |
|
4982 |
|
4983 |
|
4984 | var setProperty = function setProperty(cssRule, prop, value) {
|
4985 | try {
|
4986 | var cssValue = value;
|
4987 |
|
4988 | if (Array.isArray(value)) {
|
4989 | cssValue = toCssValue(value);
|
4990 | }
|
4991 |
|
4992 |
|
4993 | if (cssRule.attributeStyleMap) {
|
4994 | cssRule.attributeStyleMap.set(prop, cssValue);
|
4995 | } else {
|
4996 | var indexOfImportantFlag = cssValue ? cssValue.indexOf('!important') : -1;
|
4997 | var cssValueWithoutImportantFlag = indexOfImportantFlag > -1 ? cssValue.substr(0, indexOfImportantFlag - 1) : cssValue;
|
4998 | cssRule.style.setProperty(prop, cssValueWithoutImportantFlag, indexOfImportantFlag > -1 ? 'important' : '');
|
4999 | }
|
5000 | } catch (err) {
|
5001 |
|
5002 | return false;
|
5003 | }
|
5004 |
|
5005 | return true;
|
5006 | };
|
5007 |
|
5008 |
|
5009 |
|
5010 |
|
5011 |
|
5012 | var removeProperty = function removeProperty(cssRule, prop) {
|
5013 | try {
|
5014 |
|
5015 | if (cssRule.attributeStyleMap) {
|
5016 | cssRule.attributeStyleMap.delete(prop);
|
5017 | } else {
|
5018 | cssRule.style.removeProperty(prop);
|
5019 | }
|
5020 | } catch (err) {
|
5021 | warning(false, "[JSS] DOMException \"" + err.message + "\" was thrown. Tried to remove property \"" + prop + "\".") ;
|
5022 | }
|
5023 | };
|
5024 |
|
5025 |
|
5026 |
|
5027 |
|
5028 |
|
5029 | var setSelector = function setSelector(cssRule, selectorText) {
|
5030 | cssRule.selectorText = selectorText;
|
5031 |
|
5032 |
|
5033 | return cssRule.selectorText === selectorText;
|
5034 | };
|
5035 |
|
5036 |
|
5037 |
|
5038 |
|
5039 |
|
5040 |
|
5041 | var getHead = memoize$1(function () {
|
5042 | return document.querySelector('head');
|
5043 | });
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 | function findHigherSheet(registry, options) {
|
5049 | for (var i = 0; i < registry.length; i++) {
|
5050 | var sheet = registry[i];
|
5051 |
|
5052 | if (sheet.attached && sheet.options.index > options.index && sheet.options.insertionPoint === options.insertionPoint) {
|
5053 | return sheet;
|
5054 | }
|
5055 | }
|
5056 |
|
5057 | return null;
|
5058 | }
|
5059 |
|
5060 |
|
5061 |
|
5062 |
|
5063 |
|
5064 | function findHighestSheet(registry, options) {
|
5065 | for (var i = registry.length - 1; i >= 0; i--) {
|
5066 | var sheet = registry[i];
|
5067 |
|
5068 | if (sheet.attached && sheet.options.insertionPoint === options.insertionPoint) {
|
5069 | return sheet;
|
5070 | }
|
5071 | }
|
5072 |
|
5073 | return null;
|
5074 | }
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 | function findCommentNode(text) {
|
5081 | var head = getHead();
|
5082 |
|
5083 | for (var i = 0; i < head.childNodes.length; i++) {
|
5084 | var node = head.childNodes[i];
|
5085 |
|
5086 | if (node.nodeType === 8 && node.nodeValue.trim() === text) {
|
5087 | return node;
|
5088 | }
|
5089 | }
|
5090 |
|
5091 | return null;
|
5092 | }
|
5093 |
|
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 | function findPrevNode(options) {
|
5099 | var registry = sheets.registry;
|
5100 |
|
5101 | if (registry.length > 0) {
|
5102 |
|
5103 | var sheet = findHigherSheet(registry, options);
|
5104 |
|
5105 | if (sheet && sheet.renderer) {
|
5106 | return {
|
5107 | parent: sheet.renderer.element.parentNode,
|
5108 | node: sheet.renderer.element
|
5109 | };
|
5110 | }
|
5111 |
|
5112 |
|
5113 | sheet = findHighestSheet(registry, options);
|
5114 |
|
5115 | if (sheet && sheet.renderer) {
|
5116 | return {
|
5117 | parent: sheet.renderer.element.parentNode,
|
5118 | node: sheet.renderer.element.nextSibling
|
5119 | };
|
5120 | }
|
5121 | }
|
5122 |
|
5123 |
|
5124 | var insertionPoint = options.insertionPoint;
|
5125 |
|
5126 | if (insertionPoint && typeof insertionPoint === 'string') {
|
5127 | var comment = findCommentNode(insertionPoint);
|
5128 |
|
5129 | if (comment) {
|
5130 | return {
|
5131 | parent: comment.parentNode,
|
5132 | node: comment.nextSibling
|
5133 | };
|
5134 | }
|
5135 |
|
5136 |
|
5137 |
|
5138 | warning(false, "[JSS] Insertion point \"" + insertionPoint + "\" not found.") ;
|
5139 | }
|
5140 |
|
5141 | return false;
|
5142 | }
|
5143 |
|
5144 |
|
5145 |
|
5146 |
|
5147 |
|
5148 | function insertStyle(style, options) {
|
5149 | var insertionPoint = options.insertionPoint;
|
5150 | var nextNode = findPrevNode(options);
|
5151 |
|
5152 | if (nextNode !== false && nextNode.parent) {
|
5153 | nextNode.parent.insertBefore(style, nextNode.node);
|
5154 | return;
|
5155 | }
|
5156 |
|
5157 |
|
5158 | if (insertionPoint && typeof insertionPoint.nodeType === 'number') {
|
5159 | var insertionPointElement = insertionPoint;
|
5160 | var parentNode = insertionPointElement.parentNode;
|
5161 | if (parentNode) parentNode.insertBefore(style, insertionPointElement.nextSibling);else warning(false, '[JSS] Insertion point is not in the DOM.') ;
|
5162 | return;
|
5163 | }
|
5164 |
|
5165 | getHead().appendChild(style);
|
5166 | }
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 | var getNonce = memoize$1(function () {
|
5173 | var node = document.querySelector('meta[property="csp-nonce"]');
|
5174 | return node ? node.getAttribute('content') : null;
|
5175 | });
|
5176 |
|
5177 | var _insertRule = function insertRule(container, rule, index) {
|
5178 | try {
|
5179 | if ('insertRule' in container) {
|
5180 | container.insertRule(rule, index);
|
5181 | }
|
5182 | else if ('appendRule' in container) {
|
5183 | container.appendRule(rule);
|
5184 | }
|
5185 | } catch (err) {
|
5186 | warning(false, "[JSS] " + err.message) ;
|
5187 | return false;
|
5188 | }
|
5189 |
|
5190 | return container.cssRules[index];
|
5191 | };
|
5192 |
|
5193 | var getValidRuleInsertionIndex = function getValidRuleInsertionIndex(container, index) {
|
5194 | var maxIndex = container.cssRules.length;
|
5195 |
|
5196 | if (index === undefined || index > maxIndex) {
|
5197 |
|
5198 | return maxIndex;
|
5199 | }
|
5200 |
|
5201 | return index;
|
5202 | };
|
5203 |
|
5204 | var createStyle = function createStyle() {
|
5205 | var el = document.createElement('style');
|
5206 |
|
5207 |
|
5208 |
|
5209 | el.textContent = '\n';
|
5210 | return el;
|
5211 | };
|
5212 |
|
5213 | var DomRenderer =
|
5214 |
|
5215 | function () {
|
5216 |
|
5217 |
|
5218 | function DomRenderer(sheet) {
|
5219 | this.getPropertyValue = getPropertyValue;
|
5220 | this.setProperty = setProperty;
|
5221 | this.removeProperty = removeProperty;
|
5222 | this.setSelector = setSelector;
|
5223 | this.hasInsertedRules = false;
|
5224 | this.cssRules = [];
|
5225 |
|
5226 | if (sheet) sheets.add(sheet);
|
5227 | this.sheet = sheet;
|
5228 |
|
5229 | var _ref = this.sheet ? this.sheet.options : {},
|
5230 | media = _ref.media,
|
5231 | meta = _ref.meta,
|
5232 | element = _ref.element;
|
5233 |
|
5234 | this.element = element || createStyle();
|
5235 | this.element.setAttribute('data-jss', '');
|
5236 | if (media) this.element.setAttribute('media', media);
|
5237 | if (meta) this.element.setAttribute('data-meta', meta);
|
5238 | var nonce = getNonce();
|
5239 | if (nonce) this.element.setAttribute('nonce', nonce);
|
5240 | }
|
5241 | |
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 | var _proto = DomRenderer.prototype;
|
5247 |
|
5248 | _proto.attach = function attach() {
|
5249 |
|
5250 | if (this.element.parentNode || !this.sheet) return;
|
5251 | insertStyle(this.element, this.sheet.options);
|
5252 |
|
5253 |
|
5254 | var deployed = Boolean(this.sheet && this.sheet.deployed);
|
5255 |
|
5256 | if (this.hasInsertedRules && deployed) {
|
5257 | this.hasInsertedRules = false;
|
5258 | this.deploy();
|
5259 | }
|
5260 | }
|
5261 | |
5262 |
|
5263 |
|
5264 | ;
|
5265 |
|
5266 | _proto.detach = function detach() {
|
5267 | if (!this.sheet) return;
|
5268 | var parentNode = this.element.parentNode;
|
5269 | if (parentNode) parentNode.removeChild(this.element);
|
5270 |
|
5271 |
|
5272 | if (this.sheet.options.link) {
|
5273 | this.cssRules = [];
|
5274 | this.element.textContent = '\n';
|
5275 | }
|
5276 | }
|
5277 | |
5278 |
|
5279 |
|
5280 | ;
|
5281 |
|
5282 | _proto.deploy = function deploy() {
|
5283 | var sheet = this.sheet;
|
5284 | if (!sheet) return;
|
5285 |
|
5286 | if (sheet.options.link) {
|
5287 | this.insertRules(sheet.rules);
|
5288 | return;
|
5289 | }
|
5290 |
|
5291 | this.element.textContent = "\n" + sheet.toString() + "\n";
|
5292 | }
|
5293 | |
5294 |
|
5295 |
|
5296 | ;
|
5297 |
|
5298 | _proto.insertRules = function insertRules(rules, nativeParent) {
|
5299 | for (var i = 0; i < rules.index.length; i++) {
|
5300 | this.insertRule(rules.index[i], i, nativeParent);
|
5301 | }
|
5302 | }
|
5303 | |
5304 |
|
5305 |
|
5306 | ;
|
5307 |
|
5308 | _proto.insertRule = function insertRule(rule, index, nativeParent) {
|
5309 | if (nativeParent === void 0) {
|
5310 | nativeParent = this.element.sheet;
|
5311 | }
|
5312 |
|
5313 | if (rule.rules) {
|
5314 | var parent = rule;
|
5315 | var latestNativeParent = nativeParent;
|
5316 |
|
5317 | if (rule.type === 'conditional' || rule.type === 'keyframes') {
|
5318 | var _insertionIndex = getValidRuleInsertionIndex(nativeParent, index);
|
5319 |
|
5320 |
|
5321 | latestNativeParent = _insertRule(nativeParent, parent.toString({
|
5322 | children: false
|
5323 | }), _insertionIndex);
|
5324 |
|
5325 | if (latestNativeParent === false) {
|
5326 | return false;
|
5327 | }
|
5328 |
|
5329 | this.refCssRule(rule, _insertionIndex, latestNativeParent);
|
5330 | }
|
5331 |
|
5332 | this.insertRules(parent.rules, latestNativeParent);
|
5333 | return latestNativeParent;
|
5334 | }
|
5335 |
|
5336 | var ruleStr = rule.toString();
|
5337 | if (!ruleStr) return false;
|
5338 | var insertionIndex = getValidRuleInsertionIndex(nativeParent, index);
|
5339 |
|
5340 | var nativeRule = _insertRule(nativeParent, ruleStr, insertionIndex);
|
5341 |
|
5342 | if (nativeRule === false) {
|
5343 | return false;
|
5344 | }
|
5345 |
|
5346 | this.hasInsertedRules = true;
|
5347 | this.refCssRule(rule, insertionIndex, nativeRule);
|
5348 | return nativeRule;
|
5349 | };
|
5350 |
|
5351 | _proto.refCssRule = function refCssRule(rule, index, cssRule) {
|
5352 | rule.renderable = cssRule;
|
5353 |
|
5354 |
|
5355 | if (rule.options.parent instanceof StyleSheet) {
|
5356 | this.cssRules.splice(index, 0, cssRule);
|
5357 | }
|
5358 | }
|
5359 | |
5360 |
|
5361 |
|
5362 | ;
|
5363 |
|
5364 | _proto.deleteRule = function deleteRule(cssRule) {
|
5365 | var sheet = this.element.sheet;
|
5366 | var index = this.indexOf(cssRule);
|
5367 | if (index === -1) return false;
|
5368 | sheet.deleteRule(index);
|
5369 | this.cssRules.splice(index, 1);
|
5370 | return true;
|
5371 | }
|
5372 | |
5373 |
|
5374 |
|
5375 | ;
|
5376 |
|
5377 | _proto.indexOf = function indexOf(cssRule) {
|
5378 | return this.cssRules.indexOf(cssRule);
|
5379 | }
|
5380 | |
5381 |
|
5382 |
|
5383 | ;
|
5384 |
|
5385 | _proto.replaceRule = function replaceRule(cssRule, rule) {
|
5386 | var index = this.indexOf(cssRule);
|
5387 | if (index === -1) return false;
|
5388 | this.element.sheet.deleteRule(index);
|
5389 | this.cssRules.splice(index, 1);
|
5390 | return this.insertRule(rule, index);
|
5391 | }
|
5392 | |
5393 |
|
5394 |
|
5395 | ;
|
5396 |
|
5397 | _proto.getRules = function getRules() {
|
5398 | return this.element.sheet.cssRules;
|
5399 | };
|
5400 |
|
5401 | return DomRenderer;
|
5402 | }();
|
5403 |
|
5404 | var instanceCounter = 0;
|
5405 |
|
5406 | var Jss =
|
5407 |
|
5408 | function () {
|
5409 | function Jss(options) {
|
5410 | this.id = instanceCounter++;
|
5411 | this.version = "10.9.2";
|
5412 | this.plugins = new PluginsRegistry();
|
5413 | this.options = {
|
5414 | id: {
|
5415 | minify: false
|
5416 | },
|
5417 | createGenerateId: createGenerateId,
|
5418 | Renderer: isBrowser ? DomRenderer : null,
|
5419 | plugins: []
|
5420 | };
|
5421 | this.generateId = createGenerateId({
|
5422 | minify: false
|
5423 | });
|
5424 |
|
5425 | for (var i = 0; i < plugins.length; i++) {
|
5426 | this.plugins.use(plugins[i], {
|
5427 | queue: 'internal'
|
5428 | });
|
5429 | }
|
5430 |
|
5431 | this.setup(options);
|
5432 | }
|
5433 | |
5434 |
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 | var _proto = Jss.prototype;
|
5441 |
|
5442 | _proto.setup = function setup(options) {
|
5443 | if (options === void 0) {
|
5444 | options = {};
|
5445 | }
|
5446 |
|
5447 | if (options.createGenerateId) {
|
5448 | this.options.createGenerateId = options.createGenerateId;
|
5449 | }
|
5450 |
|
5451 | if (options.id) {
|
5452 | this.options.id = _extends({}, this.options.id, options.id);
|
5453 | }
|
5454 |
|
5455 | if (options.createGenerateId || options.id) {
|
5456 | this.generateId = this.options.createGenerateId(this.options.id);
|
5457 | }
|
5458 |
|
5459 | if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint;
|
5460 |
|
5461 | if ('Renderer' in options) {
|
5462 | this.options.Renderer = options.Renderer;
|
5463 | }
|
5464 |
|
5465 |
|
5466 | if (options.plugins) this.use.apply(this, options.plugins);
|
5467 | return this;
|
5468 | }
|
5469 | |
5470 |
|
5471 |
|
5472 | ;
|
5473 |
|
5474 | _proto.createStyleSheet = function createStyleSheet(styles, options) {
|
5475 | if (options === void 0) {
|
5476 | options = {};
|
5477 | }
|
5478 |
|
5479 | var _options = options,
|
5480 | index = _options.index;
|
5481 |
|
5482 | if (typeof index !== 'number') {
|
5483 | index = sheets.index === 0 ? 0 : sheets.index + 1;
|
5484 | }
|
5485 |
|
5486 | var sheet = new StyleSheet(styles, _extends({}, options, {
|
5487 | jss: this,
|
5488 | generateId: options.generateId || this.generateId,
|
5489 | insertionPoint: this.options.insertionPoint,
|
5490 | Renderer: this.options.Renderer,
|
5491 | index: index
|
5492 | }));
|
5493 | this.plugins.onProcessSheet(sheet);
|
5494 | return sheet;
|
5495 | }
|
5496 | |
5497 |
|
5498 |
|
5499 | ;
|
5500 |
|
5501 | _proto.removeStyleSheet = function removeStyleSheet(sheet) {
|
5502 | sheet.detach();
|
5503 | sheets.remove(sheet);
|
5504 | return this;
|
5505 | }
|
5506 | |
5507 |
|
5508 |
|
5509 |
|
5510 | ;
|
5511 |
|
5512 | _proto.createRule = function createRule$1(name, style, options) {
|
5513 | if (style === void 0) {
|
5514 | style = {};
|
5515 | }
|
5516 |
|
5517 | if (options === void 0) {
|
5518 | options = {};
|
5519 | }
|
5520 |
|
5521 |
|
5522 | if (typeof name === 'object') {
|
5523 | return this.createRule(undefined, name, style);
|
5524 | }
|
5525 |
|
5526 | var ruleOptions = _extends({}, options, {
|
5527 | name: name,
|
5528 | jss: this,
|
5529 | Renderer: this.options.Renderer
|
5530 | });
|
5531 |
|
5532 | if (!ruleOptions.generateId) ruleOptions.generateId = this.generateId;
|
5533 | if (!ruleOptions.classes) ruleOptions.classes = {};
|
5534 | if (!ruleOptions.keyframes) ruleOptions.keyframes = {};
|
5535 | var rule = createRule(name, style, ruleOptions);
|
5536 | if (rule) this.plugins.onProcessRule(rule);
|
5537 | return rule;
|
5538 | }
|
5539 | |
5540 |
|
5541 |
|
5542 | ;
|
5543 |
|
5544 | _proto.use = function use() {
|
5545 | var _this = this;
|
5546 |
|
5547 | for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
|
5548 | plugins[_key] = arguments[_key];
|
5549 | }
|
5550 |
|
5551 | plugins.forEach(function (plugin) {
|
5552 | _this.plugins.use(plugin);
|
5553 | });
|
5554 | return this;
|
5555 | };
|
5556 |
|
5557 | return Jss;
|
5558 | }();
|
5559 |
|
5560 | var createJss = function createJss(options) {
|
5561 | return new Jss(options);
|
5562 | };
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 | var SheetsManager =
|
5571 |
|
5572 | function () {
|
5573 | function SheetsManager() {
|
5574 | this.length = 0;
|
5575 | this.sheets = new WeakMap();
|
5576 | }
|
5577 |
|
5578 | var _proto = SheetsManager.prototype;
|
5579 |
|
5580 | _proto.get = function get(key) {
|
5581 | var entry = this.sheets.get(key);
|
5582 | return entry && entry.sheet;
|
5583 | };
|
5584 |
|
5585 | _proto.add = function add(key, sheet) {
|
5586 | if (this.sheets.has(key)) return;
|
5587 | this.length++;
|
5588 | this.sheets.set(key, {
|
5589 | sheet: sheet,
|
5590 | refs: 0
|
5591 | });
|
5592 | };
|
5593 |
|
5594 | _proto.manage = function manage(key) {
|
5595 | var entry = this.sheets.get(key);
|
5596 |
|
5597 | if (entry) {
|
5598 | if (entry.refs === 0) {
|
5599 | entry.sheet.attach();
|
5600 | }
|
5601 |
|
5602 | entry.refs++;
|
5603 | return entry.sheet;
|
5604 | }
|
5605 |
|
5606 | warning(false, "[JSS] SheetsManager: can't find sheet to manage") ;
|
5607 | return undefined;
|
5608 | };
|
5609 |
|
5610 | _proto.unmanage = function unmanage(key) {
|
5611 | var entry = this.sheets.get(key);
|
5612 |
|
5613 | if (entry) {
|
5614 | if (entry.refs > 0) {
|
5615 | entry.refs--;
|
5616 | if (entry.refs === 0) entry.sheet.detach();
|
5617 | }
|
5618 | } else {
|
5619 | warning(false, "SheetsManager: can't find sheet to unmanage") ;
|
5620 | }
|
5621 | };
|
5622 |
|
5623 | _createClass(SheetsManager, [{
|
5624 | key: "size",
|
5625 | get: function get() {
|
5626 | return this.length;
|
5627 | }
|
5628 | }]);
|
5629 |
|
5630 | return SheetsManager;
|
5631 | }();
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 | var hasCSSTOMSupport = typeof CSS === 'object' && CSS != null && 'number' in CSS;
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 | function getDynamicStyles(styles) {
|
5644 | var to = null;
|
5645 |
|
5646 | for (var key in styles) {
|
5647 | var value = styles[key];
|
5648 | var type = typeof value;
|
5649 |
|
5650 | if (type === 'function') {
|
5651 | if (!to) to = {};
|
5652 | to[key] = value;
|
5653 | } else if (type === 'object' && value !== null && !Array.isArray(value)) {
|
5654 | var extracted = getDynamicStyles(value);
|
5655 |
|
5656 | if (extracted) {
|
5657 | if (!to) to = {};
|
5658 | to[key] = extracted;
|
5659 | }
|
5660 | }
|
5661 | }
|
5662 |
|
5663 | return to;
|
5664 | }
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 | var index$1 = createJss();
|
5675 |
|
5676 | var defaultManagers = new Map();
|
5677 | var getManager = function getManager(context, managerId) {
|
5678 |
|
5679 |
|
5680 | var managers = context.managers;
|
5681 |
|
5682 | if (managers) {
|
5683 | if (!managers[managerId]) {
|
5684 | managers[managerId] = new SheetsManager();
|
5685 | }
|
5686 |
|
5687 | return managers[managerId];
|
5688 | }
|
5689 |
|
5690 | var manager = defaultManagers.get(managerId);
|
5691 |
|
5692 | if (!manager) {
|
5693 | manager = new SheetsManager();
|
5694 | defaultManagers.set(managerId, manager);
|
5695 | }
|
5696 |
|
5697 | return manager;
|
5698 | };
|
5699 | var manageSheet = function manageSheet(options) {
|
5700 | var sheet = options.sheet,
|
5701 | context = options.context,
|
5702 | index = options.index,
|
5703 | theme = options.theme;
|
5704 |
|
5705 | if (!sheet) {
|
5706 | return;
|
5707 | }
|
5708 |
|
5709 | var manager = getManager(context, index);
|
5710 | manager.manage(theme);
|
5711 |
|
5712 | if (context.registry) {
|
5713 | context.registry.add(sheet);
|
5714 | }
|
5715 | };
|
5716 | var unmanageSheet = function unmanageSheet(options) {
|
5717 | if (!options.sheet) {
|
5718 | return;
|
5719 | }
|
5720 |
|
5721 | var manager = getManager(options.context, options.index);
|
5722 | manager.unmanage(options.theme);
|
5723 | };
|
5724 |
|
5725 | var now = Date.now();
|
5726 | var fnValuesNs = "fnValues" + now;
|
5727 | var fnRuleNs = "fnStyle" + ++now;
|
5728 |
|
5729 | var functionPlugin = function functionPlugin() {
|
5730 | return {
|
5731 | onCreateRule: function onCreateRule(name, decl, options) {
|
5732 | if (typeof decl !== 'function') return null;
|
5733 | var rule = createRule(name, {}, options);
|
5734 | rule[fnRuleNs] = decl;
|
5735 | return rule;
|
5736 | },
|
5737 | onProcessStyle: function onProcessStyle(style, rule) {
|
5738 |
|
5739 |
|
5740 |
|
5741 |
|
5742 | if (fnValuesNs in rule || fnRuleNs in rule) return style;
|
5743 | var fnValues = {};
|
5744 |
|
5745 | for (var prop in style) {
|
5746 | var value = style[prop];
|
5747 | if (typeof value !== 'function') continue;
|
5748 | delete style[prop];
|
5749 | fnValues[prop] = value;
|
5750 | }
|
5751 |
|
5752 | rule[fnValuesNs] = fnValues;
|
5753 | return style;
|
5754 | },
|
5755 | onUpdate: function onUpdate(data, rule, sheet, options) {
|
5756 | var styleRule = rule;
|
5757 | var fnRule = styleRule[fnRuleNs];
|
5758 |
|
5759 |
|
5760 | if (fnRule) {
|
5761 |
|
5762 |
|
5763 | styleRule.style = fnRule(data) || {};
|
5764 |
|
5765 | {
|
5766 | for (var prop in styleRule.style) {
|
5767 | if (typeof styleRule.style[prop] === 'function') {
|
5768 | warning(false, '[JSS] Function values inside function rules are not supported.') ;
|
5769 | break;
|
5770 | }
|
5771 | }
|
5772 | }
|
5773 | }
|
5774 |
|
5775 | var fnValues = styleRule[fnValuesNs];
|
5776 |
|
5777 | if (fnValues) {
|
5778 | for (var _prop in fnValues) {
|
5779 | styleRule.prop(_prop, fnValues[_prop](data), options);
|
5780 | }
|
5781 | }
|
5782 | }
|
5783 | };
|
5784 | };
|
5785 |
|
5786 | function symbolObservablePonyfill(root) {
|
5787 | var result;
|
5788 | var Symbol = root.Symbol;
|
5789 |
|
5790 | if (typeof Symbol === 'function') {
|
5791 | if (Symbol.observable) {
|
5792 | result = Symbol.observable;
|
5793 | } else {
|
5794 | result = Symbol('observable');
|
5795 | Symbol.observable = result;
|
5796 | }
|
5797 | } else {
|
5798 | result = '@@observable';
|
5799 | }
|
5800 |
|
5801 | return result;
|
5802 | }
|
5803 |
|
5804 |
|
5805 |
|
5806 | var root;
|
5807 |
|
5808 | if (typeof self !== 'undefined') {
|
5809 | root = self;
|
5810 | } else if (typeof window !== 'undefined') {
|
5811 | root = window;
|
5812 | } else if (typeof global !== 'undefined') {
|
5813 | root = global;
|
5814 | } else if (typeof module !== 'undefined') {
|
5815 | root = module;
|
5816 | } else {
|
5817 | root = Function('return this')();
|
5818 | }
|
5819 |
|
5820 | var result = symbolObservablePonyfill(root);
|
5821 |
|
5822 | var isObservable = function isObservable(value) {
|
5823 | return value && value[result] && value === value[result]();
|
5824 | };
|
5825 |
|
5826 | var observablePlugin = function observablePlugin(updateOptions) {
|
5827 | return {
|
5828 | onCreateRule: function onCreateRule(name, decl, options) {
|
5829 | if (!isObservable(decl)) return null;
|
5830 | var style$ = decl;
|
5831 | var rule = createRule(name, {}, options);
|
5832 |
|
5833 |
|
5834 |
|
5835 | style$.subscribe(function (style) {
|
5836 | for (var prop in style) {
|
5837 | rule.prop(prop, style[prop], updateOptions);
|
5838 | }
|
5839 | });
|
5840 | return rule;
|
5841 | },
|
5842 | onProcessRule: function onProcessRule(rule) {
|
5843 | if (rule && rule.type !== 'style') return;
|
5844 | var styleRule = rule;
|
5845 | var style = styleRule.style;
|
5846 |
|
5847 | var _loop = function _loop(prop) {
|
5848 | var value = style[prop];
|
5849 | if (!isObservable(value)) return "continue";
|
5850 | delete style[prop];
|
5851 | value.subscribe({
|
5852 | next: function next(nextValue) {
|
5853 | styleRule.prop(prop, nextValue, updateOptions);
|
5854 | }
|
5855 | });
|
5856 | };
|
5857 |
|
5858 | for (var prop in style) {
|
5859 | var _ret = _loop(prop);
|
5860 |
|
5861 | if (_ret === "continue") continue;
|
5862 | }
|
5863 | }
|
5864 | };
|
5865 | };
|
5866 |
|
5867 | var semiWithNl = /;\n/;
|
5868 |
|
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 | var parse = function parse(cssText) {
|
5876 | var style = {};
|
5877 | var split = cssText.split(semiWithNl);
|
5878 |
|
5879 | for (var i = 0; i < split.length; i++) {
|
5880 | var decl = (split[i] || '').trim();
|
5881 | if (!decl) continue;
|
5882 | var colonIndex = decl.indexOf(':');
|
5883 |
|
5884 | if (colonIndex === -1) {
|
5885 | warning(false, "[JSS] Malformed CSS string \"" + decl + "\"") ;
|
5886 | continue;
|
5887 | }
|
5888 |
|
5889 | var prop = decl.substr(0, colonIndex).trim();
|
5890 | var value = decl.substr(colonIndex + 1).trim();
|
5891 | style[prop] = value;
|
5892 | }
|
5893 |
|
5894 | return style;
|
5895 | };
|
5896 |
|
5897 | var onProcessRule = function onProcessRule(rule) {
|
5898 | if (typeof rule.style === 'string') {
|
5899 | rule.style = parse(rule.style);
|
5900 | }
|
5901 | };
|
5902 |
|
5903 | function templatePlugin() {
|
5904 | return {
|
5905 | onProcessRule: onProcessRule
|
5906 | };
|
5907 | }
|
5908 |
|
5909 | var at = '@global';
|
5910 | var atPrefix = '@global ';
|
5911 |
|
5912 | var GlobalContainerRule =
|
5913 |
|
5914 | function () {
|
5915 | function GlobalContainerRule(key, styles, options) {
|
5916 | this.type = 'global';
|
5917 | this.at = at;
|
5918 | this.isProcessed = false;
|
5919 | this.key = key;
|
5920 | this.options = options;
|
5921 | this.rules = new RuleList(_extends({}, options, {
|
5922 | parent: this
|
5923 | }));
|
5924 |
|
5925 | for (var selector in styles) {
|
5926 | this.rules.add(selector, styles[selector]);
|
5927 | }
|
5928 |
|
5929 | this.rules.process();
|
5930 | }
|
5931 | |
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 | var _proto = GlobalContainerRule.prototype;
|
5937 |
|
5938 | _proto.getRule = function getRule(name) {
|
5939 | return this.rules.get(name);
|
5940 | }
|
5941 | |
5942 |
|
5943 |
|
5944 | ;
|
5945 |
|
5946 | _proto.addRule = function addRule(name, style, options) {
|
5947 | var rule = this.rules.add(name, style, options);
|
5948 | if (rule) this.options.jss.plugins.onProcessRule(rule);
|
5949 | return rule;
|
5950 | }
|
5951 | |
5952 |
|
5953 |
|
5954 | ;
|
5955 |
|
5956 | _proto.replaceRule = function replaceRule(name, style, options) {
|
5957 | var newRule = this.rules.replace(name, style, options);
|
5958 | if (newRule) this.options.jss.plugins.onProcessRule(newRule);
|
5959 | return newRule;
|
5960 | }
|
5961 | |
5962 |
|
5963 |
|
5964 | ;
|
5965 |
|
5966 | _proto.indexOf = function indexOf(rule) {
|
5967 | return this.rules.indexOf(rule);
|
5968 | }
|
5969 | |
5970 |
|
5971 |
|
5972 | ;
|
5973 |
|
5974 | _proto.toString = function toString(options) {
|
5975 | return this.rules.toString(options);
|
5976 | };
|
5977 |
|
5978 | return GlobalContainerRule;
|
5979 | }();
|
5980 |
|
5981 | var GlobalPrefixedRule =
|
5982 |
|
5983 | function () {
|
5984 | function GlobalPrefixedRule(key, style, options) {
|
5985 | this.type = 'global';
|
5986 | this.at = at;
|
5987 | this.isProcessed = false;
|
5988 | this.key = key;
|
5989 | this.options = options;
|
5990 | var selector = key.substr(atPrefix.length);
|
5991 | this.rule = options.jss.createRule(selector, style, _extends({}, options, {
|
5992 | parent: this
|
5993 | }));
|
5994 | }
|
5995 |
|
5996 | var _proto2 = GlobalPrefixedRule.prototype;
|
5997 |
|
5998 | _proto2.toString = function toString(options) {
|
5999 | return this.rule ? this.rule.toString(options) : '';
|
6000 | };
|
6001 |
|
6002 | return GlobalPrefixedRule;
|
6003 | }();
|
6004 |
|
6005 | var separatorRegExp = /\s*,\s*/g;
|
6006 |
|
6007 | function addScope(selector, scope) {
|
6008 | var parts = selector.split(separatorRegExp);
|
6009 | var scoped = '';
|
6010 |
|
6011 | for (var i = 0; i < parts.length; i++) {
|
6012 | scoped += scope + " " + parts[i].trim();
|
6013 | if (parts[i + 1]) scoped += ', ';
|
6014 | }
|
6015 |
|
6016 | return scoped;
|
6017 | }
|
6018 |
|
6019 | function handleNestedGlobalContainerRule(rule, sheet) {
|
6020 | var options = rule.options,
|
6021 | style = rule.style;
|
6022 | var rules = style ? style[at] : null;
|
6023 | if (!rules) return;
|
6024 |
|
6025 | for (var name in rules) {
|
6026 | sheet.addRule(name, rules[name], _extends({}, options, {
|
6027 | selector: addScope(name, rule.selector)
|
6028 | }));
|
6029 | }
|
6030 |
|
6031 | delete style[at];
|
6032 | }
|
6033 |
|
6034 | function handlePrefixedGlobalRule(rule, sheet) {
|
6035 | var options = rule.options,
|
6036 | style = rule.style;
|
6037 |
|
6038 | for (var prop in style) {
|
6039 | if (prop[0] !== '@' || prop.substr(0, at.length) !== at) continue;
|
6040 | var selector = addScope(prop.substr(at.length), rule.selector);
|
6041 | sheet.addRule(selector, style[prop], _extends({}, options, {
|
6042 | selector: selector
|
6043 | }));
|
6044 | delete style[prop];
|
6045 | }
|
6046 | }
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 | function jssGlobal() {
|
6053 | function onCreateRule(name, styles, options) {
|
6054 | if (!name) return null;
|
6055 |
|
6056 | if (name === at) {
|
6057 | return new GlobalContainerRule(name, styles, options);
|
6058 | }
|
6059 |
|
6060 | if (name[0] === '@' && name.substr(0, atPrefix.length) === atPrefix) {
|
6061 | return new GlobalPrefixedRule(name, styles, options);
|
6062 | }
|
6063 |
|
6064 | var parent = options.parent;
|
6065 |
|
6066 | if (parent) {
|
6067 | if (parent.type === 'global' || parent.options.parent && parent.options.parent.type === 'global') {
|
6068 | options.scoped = false;
|
6069 | }
|
6070 | }
|
6071 |
|
6072 | if (!options.selector && options.scoped === false) {
|
6073 | options.selector = name;
|
6074 | }
|
6075 |
|
6076 | return null;
|
6077 | }
|
6078 |
|
6079 | function onProcessRule(rule, sheet) {
|
6080 | if (rule.type !== 'style' || !sheet) return;
|
6081 | handleNestedGlobalContainerRule(rule, sheet);
|
6082 | handlePrefixedGlobalRule(rule, sheet);
|
6083 | }
|
6084 |
|
6085 | return {
|
6086 | onCreateRule: onCreateRule,
|
6087 | onProcessRule: onProcessRule
|
6088 | };
|
6089 | }
|
6090 |
|
6091 | var isObject$1 = function isObject(obj) {
|
6092 | return obj && typeof obj === 'object' && !Array.isArray(obj);
|
6093 | };
|
6094 |
|
6095 | var valueNs = "extendCurrValue" + Date.now();
|
6096 |
|
6097 | function mergeExtend(style, rule, sheet, newStyle) {
|
6098 | var extendType = typeof style.extend;
|
6099 |
|
6100 | if (extendType === 'string') {
|
6101 | if (!sheet) return;
|
6102 | var refRule = sheet.getRule(style.extend);
|
6103 | if (!refRule) return;
|
6104 |
|
6105 | if (refRule === rule) {
|
6106 | warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString()) ;
|
6107 | return;
|
6108 | }
|
6109 |
|
6110 | var parent = refRule.options.parent;
|
6111 |
|
6112 | if (parent) {
|
6113 | var originalStyle = parent.rules.raw[style.extend];
|
6114 | extend(originalStyle, rule, sheet, newStyle);
|
6115 | }
|
6116 |
|
6117 | return;
|
6118 | }
|
6119 |
|
6120 |
|
6121 | if (Array.isArray(style.extend)) {
|
6122 | for (var index = 0; index < style.extend.length; index++) {
|
6123 | var singleExtend = style.extend[index];
|
6124 | var singleStyle = typeof singleExtend === 'string' ? _extends({}, style, {
|
6125 | extend: singleExtend
|
6126 | }) : style.extend[index];
|
6127 | extend(singleStyle, rule, sheet, newStyle);
|
6128 | }
|
6129 |
|
6130 | return;
|
6131 | }
|
6132 |
|
6133 |
|
6134 | for (var prop in style.extend) {
|
6135 | if (prop === 'extend') {
|
6136 | extend(style.extend.extend, rule, sheet, newStyle);
|
6137 | continue;
|
6138 | }
|
6139 |
|
6140 | if (isObject$1(style.extend[prop])) {
|
6141 | if (!(prop in newStyle)) newStyle[prop] = {};
|
6142 | extend(style.extend[prop], rule, sheet, newStyle[prop]);
|
6143 | continue;
|
6144 | }
|
6145 |
|
6146 | newStyle[prop] = style.extend[prop];
|
6147 | }
|
6148 | }
|
6149 |
|
6150 | function mergeRest(style, rule, sheet, newStyle) {
|
6151 |
|
6152 | for (var prop in style) {
|
6153 | if (prop === 'extend') continue;
|
6154 |
|
6155 | if (isObject$1(newStyle[prop]) && isObject$1(style[prop])) {
|
6156 | extend(style[prop], rule, sheet, newStyle[prop]);
|
6157 | continue;
|
6158 | }
|
6159 |
|
6160 | if (isObject$1(style[prop])) {
|
6161 | newStyle[prop] = extend(style[prop], rule, sheet);
|
6162 | continue;
|
6163 | }
|
6164 |
|
6165 | newStyle[prop] = style[prop];
|
6166 | }
|
6167 | }
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 |
|
6173 | function extend(style, rule, sheet, newStyle) {
|
6174 | if (newStyle === void 0) {
|
6175 | newStyle = {};
|
6176 | }
|
6177 |
|
6178 | mergeExtend(style, rule, sheet, newStyle);
|
6179 | mergeRest(style, rule, sheet, newStyle);
|
6180 | return newStyle;
|
6181 | }
|
6182 |
|
6183 |
|
6184 |
|
6185 |
|
6186 |
|
6187 | function jssExtend() {
|
6188 | function onProcessStyle(style, rule, sheet) {
|
6189 | if ('extend' in style) return extend(style, rule, sheet);
|
6190 | return style;
|
6191 | }
|
6192 |
|
6193 | function onChangeValue(value, prop, rule) {
|
6194 | if (prop !== 'extend') return value;
|
6195 |
|
6196 | if (value == null || value === false) {
|
6197 | for (var key in rule[valueNs]) {
|
6198 | rule.prop(key, null);
|
6199 | }
|
6200 |
|
6201 | rule[valueNs] = null;
|
6202 | return null;
|
6203 | }
|
6204 |
|
6205 | if (typeof value === 'object') {
|
6206 | for (var _key in value) {
|
6207 | rule.prop(_key, value[_key]);
|
6208 | }
|
6209 |
|
6210 | rule[valueNs] = value;
|
6211 | }
|
6212 |
|
6213 |
|
6214 | return null;
|
6215 | }
|
6216 |
|
6217 | return {
|
6218 | onProcessStyle: onProcessStyle,
|
6219 | onChangeValue: onChangeValue
|
6220 | };
|
6221 | }
|
6222 |
|
6223 | var separatorRegExp$1 = /\s*,\s*/g;
|
6224 | var parentRegExp = /&/g;
|
6225 | var refRegExp$1 = /\$([\w-]+)/g;
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 | function jssNested() {
|
6231 |
|
6232 | function getReplaceRef(container, sheet) {
|
6233 | return function (match, key) {
|
6234 | var rule = container.getRule(key) || sheet && sheet.getRule(key);
|
6235 |
|
6236 | if (rule) {
|
6237 | return rule.selector;
|
6238 | }
|
6239 |
|
6240 | warning(false, "[JSS] Could not find the referenced rule \"" + key + "\" in \"" + (container.options.meta || container.toString()) + "\".") ;
|
6241 | return key;
|
6242 | };
|
6243 | }
|
6244 |
|
6245 | function replaceParentRefs(nestedProp, parentProp) {
|
6246 | var parentSelectors = parentProp.split(separatorRegExp$1);
|
6247 | var nestedSelectors = nestedProp.split(separatorRegExp$1);
|
6248 | var result = '';
|
6249 |
|
6250 | for (var i = 0; i < parentSelectors.length; i++) {
|
6251 | var parent = parentSelectors[i];
|
6252 |
|
6253 | for (var j = 0; j < nestedSelectors.length; j++) {
|
6254 | var nested = nestedSelectors[j];
|
6255 | if (result) result += ', ';
|
6256 |
|
6257 | result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + " " + nested;
|
6258 | }
|
6259 | }
|
6260 |
|
6261 | return result;
|
6262 | }
|
6263 |
|
6264 | function getOptions(rule, container, prevOptions) {
|
6265 |
|
6266 | if (prevOptions) return _extends({}, prevOptions, {
|
6267 | index: prevOptions.index + 1
|
6268 | });
|
6269 | var nestingLevel = rule.options.nestingLevel;
|
6270 | nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;
|
6271 |
|
6272 | var options = _extends({}, rule.options, {
|
6273 | nestingLevel: nestingLevel,
|
6274 | index: container.indexOf(rule) + 1
|
6275 |
|
6276 | });
|
6277 |
|
6278 | delete options.name;
|
6279 | return options;
|
6280 | }
|
6281 |
|
6282 | function onProcessStyle(style, rule, sheet) {
|
6283 | if (rule.type !== 'style') return style;
|
6284 | var styleRule = rule;
|
6285 | var container = styleRule.options.parent;
|
6286 | var options;
|
6287 | var replaceRef;
|
6288 |
|
6289 | for (var prop in style) {
|
6290 | var isNested = prop.indexOf('&') !== -1;
|
6291 | var isNestedConditional = prop[0] === '@';
|
6292 | if (!isNested && !isNestedConditional) continue;
|
6293 | options = getOptions(styleRule, container, options);
|
6294 |
|
6295 | if (isNested) {
|
6296 | var selector = replaceParentRefs(prop, styleRule.selector);
|
6297 |
|
6298 |
|
6299 | if (!replaceRef) replaceRef = getReplaceRef(container, sheet);
|
6300 |
|
6301 | selector = selector.replace(refRegExp$1, replaceRef);
|
6302 | var name = styleRule.key + "-" + prop;
|
6303 |
|
6304 | if ('replaceRule' in container) {
|
6305 |
|
6306 | container.replaceRule(name, style[prop], _extends({}, options, {
|
6307 | selector: selector
|
6308 | }));
|
6309 | } else {
|
6310 | container.addRule(name, style[prop], _extends({}, options, {
|
6311 | selector: selector
|
6312 | }));
|
6313 | }
|
6314 | } else if (isNestedConditional) {
|
6315 |
|
6316 | container.addRule(prop, {}, options).addRule(styleRule.key, style[prop], {
|
6317 | selector: styleRule.selector
|
6318 | });
|
6319 | }
|
6320 |
|
6321 | delete style[prop];
|
6322 | }
|
6323 |
|
6324 | return style;
|
6325 | }
|
6326 |
|
6327 | return {
|
6328 | onProcessStyle: onProcessStyle
|
6329 | };
|
6330 | }
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 |
|
6338 |
|
6339 |
|
6340 | function registerClass(rule, className) {
|
6341 |
|
6342 | if (!className) return true;
|
6343 |
|
6344 | if (Array.isArray(className)) {
|
6345 | for (var index = 0; index < className.length; index++) {
|
6346 | var isSetted = registerClass(rule, className[index]);
|
6347 | if (!isSetted) return false;
|
6348 | }
|
6349 |
|
6350 | return true;
|
6351 | }
|
6352 |
|
6353 |
|
6354 | if (className.indexOf(' ') > -1) {
|
6355 | return registerClass(rule, className.split(' '));
|
6356 | }
|
6357 |
|
6358 | var parent = rule.options.parent;
|
6359 |
|
6360 | if (className[0] === '$') {
|
6361 | var refRule = parent.getRule(className.substr(1));
|
6362 |
|
6363 | if (!refRule) {
|
6364 | warning(false, "[JSS] Referenced rule is not defined. \n" + rule.toString()) ;
|
6365 | return false;
|
6366 | }
|
6367 |
|
6368 | if (refRule === rule) {
|
6369 | warning(false, "[JSS] Cyclic composition detected. \n" + rule.toString()) ;
|
6370 | return false;
|
6371 | }
|
6372 |
|
6373 | parent.classes[rule.key] += " " + parent.classes[refRule.key];
|
6374 | return true;
|
6375 | }
|
6376 |
|
6377 | parent.classes[rule.key] += " " + className;
|
6378 | return true;
|
6379 | }
|
6380 |
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 | function jssCompose() {
|
6386 | function onProcessStyle(style, rule) {
|
6387 | if (!('composes' in style)) return style;
|
6388 | registerClass(rule, style.composes);
|
6389 |
|
6390 | delete style.composes;
|
6391 | return style;
|
6392 | }
|
6393 |
|
6394 | return {
|
6395 | onProcessStyle: onProcessStyle
|
6396 | };
|
6397 | }
|
6398 |
|
6399 |
|
6400 | var uppercasePattern = /[A-Z]/g;
|
6401 | var msPattern = /^ms-/;
|
6402 | var cache = {};
|
6403 |
|
6404 | function toHyphenLower(match) {
|
6405 | return '-' + match.toLowerCase()
|
6406 | }
|
6407 |
|
6408 | function hyphenateStyleName(name) {
|
6409 | if (cache.hasOwnProperty(name)) {
|
6410 | return cache[name]
|
6411 | }
|
6412 |
|
6413 | var hName = name.replace(uppercasePattern, toHyphenLower);
|
6414 | return (cache[name] = msPattern.test(hName) ? '-' + hName : hName)
|
6415 | }
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 | function convertCase(style) {
|
6422 | var converted = {};
|
6423 |
|
6424 | for (var prop in style) {
|
6425 | var key = prop.indexOf('--') === 0 ? prop : hyphenateStyleName(prop);
|
6426 | converted[key] = style[prop];
|
6427 | }
|
6428 |
|
6429 | if (style.fallbacks) {
|
6430 | if (Array.isArray(style.fallbacks)) converted.fallbacks = style.fallbacks.map(convertCase);else converted.fallbacks = convertCase(style.fallbacks);
|
6431 | }
|
6432 |
|
6433 | return converted;
|
6434 | }
|
6435 |
|
6436 |
|
6437 |
|
6438 |
|
6439 |
|
6440 | function camelCase() {
|
6441 | function onProcessStyle(style) {
|
6442 | if (Array.isArray(style)) {
|
6443 |
|
6444 | for (var index = 0; index < style.length; index++) {
|
6445 | style[index] = convertCase(style[index]);
|
6446 | }
|
6447 |
|
6448 | return style;
|
6449 | }
|
6450 |
|
6451 | return convertCase(style);
|
6452 | }
|
6453 |
|
6454 | function onChangeValue(value, prop, rule) {
|
6455 | if (prop.indexOf('--') === 0) {
|
6456 | return value;
|
6457 | }
|
6458 |
|
6459 | var hyphenatedProp = hyphenateStyleName(prop);
|
6460 |
|
6461 | if (prop === hyphenatedProp) return value;
|
6462 | rule.prop(hyphenatedProp, value);
|
6463 |
|
6464 | return null;
|
6465 | }
|
6466 |
|
6467 | return {
|
6468 | onProcessStyle: onProcessStyle,
|
6469 | onChangeValue: onChangeValue
|
6470 | };
|
6471 | }
|
6472 |
|
6473 | var px = hasCSSTOMSupport && CSS ? CSS.px : 'px';
|
6474 | var ms = hasCSSTOMSupport && CSS ? CSS.ms : 'ms';
|
6475 | var percent = hasCSSTOMSupport && CSS ? CSS.percent : '%';
|
6476 |
|
6477 |
|
6478 |
|
6479 |
|
6480 | var defaultUnits = {
|
6481 |
|
6482 | 'animation-delay': ms,
|
6483 | 'animation-duration': ms,
|
6484 |
|
6485 | 'background-position': px,
|
6486 | 'background-position-x': px,
|
6487 | 'background-position-y': px,
|
6488 | 'background-size': px,
|
6489 |
|
6490 | border: px,
|
6491 | 'border-bottom': px,
|
6492 | 'border-bottom-left-radius': px,
|
6493 | 'border-bottom-right-radius': px,
|
6494 | 'border-bottom-width': px,
|
6495 | 'border-left': px,
|
6496 | 'border-left-width': px,
|
6497 | 'border-radius': px,
|
6498 | 'border-right': px,
|
6499 | 'border-right-width': px,
|
6500 | 'border-top': px,
|
6501 | 'border-top-left-radius': px,
|
6502 | 'border-top-right-radius': px,
|
6503 | 'border-top-width': px,
|
6504 | 'border-width': px,
|
6505 | 'border-block': px,
|
6506 | 'border-block-end': px,
|
6507 | 'border-block-end-width': px,
|
6508 | 'border-block-start': px,
|
6509 | 'border-block-start-width': px,
|
6510 | 'border-block-width': px,
|
6511 | 'border-inline': px,
|
6512 | 'border-inline-end': px,
|
6513 | 'border-inline-end-width': px,
|
6514 | 'border-inline-start': px,
|
6515 | 'border-inline-start-width': px,
|
6516 | 'border-inline-width': px,
|
6517 | 'border-start-start-radius': px,
|
6518 | 'border-start-end-radius': px,
|
6519 | 'border-end-start-radius': px,
|
6520 | 'border-end-end-radius': px,
|
6521 |
|
6522 | margin: px,
|
6523 | 'margin-bottom': px,
|
6524 | 'margin-left': px,
|
6525 | 'margin-right': px,
|
6526 | 'margin-top': px,
|
6527 | 'margin-block': px,
|
6528 | 'margin-block-end': px,
|
6529 | 'margin-block-start': px,
|
6530 | 'margin-inline': px,
|
6531 | 'margin-inline-end': px,
|
6532 | 'margin-inline-start': px,
|
6533 |
|
6534 | padding: px,
|
6535 | 'padding-bottom': px,
|
6536 | 'padding-left': px,
|
6537 | 'padding-right': px,
|
6538 | 'padding-top': px,
|
6539 | 'padding-block': px,
|
6540 | 'padding-block-end': px,
|
6541 | 'padding-block-start': px,
|
6542 | 'padding-inline': px,
|
6543 | 'padding-inline-end': px,
|
6544 | 'padding-inline-start': px,
|
6545 |
|
6546 | 'mask-position-x': px,
|
6547 | 'mask-position-y': px,
|
6548 | 'mask-size': px,
|
6549 |
|
6550 | height: px,
|
6551 | width: px,
|
6552 | 'min-height': px,
|
6553 | 'max-height': px,
|
6554 | 'min-width': px,
|
6555 | 'max-width': px,
|
6556 |
|
6557 | bottom: px,
|
6558 | left: px,
|
6559 | top: px,
|
6560 | right: px,
|
6561 | inset: px,
|
6562 | 'inset-block': px,
|
6563 | 'inset-block-end': px,
|
6564 | 'inset-block-start': px,
|
6565 | 'inset-inline': px,
|
6566 | 'inset-inline-end': px,
|
6567 | 'inset-inline-start': px,
|
6568 |
|
6569 | 'box-shadow': px,
|
6570 | 'text-shadow': px,
|
6571 |
|
6572 | 'column-gap': px,
|
6573 | 'column-rule': px,
|
6574 | 'column-rule-width': px,
|
6575 | 'column-width': px,
|
6576 |
|
6577 | 'font-size': px,
|
6578 | 'font-size-delta': px,
|
6579 | 'letter-spacing': px,
|
6580 | 'text-decoration-thickness': px,
|
6581 | 'text-indent': px,
|
6582 | 'text-stroke': px,
|
6583 | 'text-stroke-width': px,
|
6584 | 'word-spacing': px,
|
6585 |
|
6586 | motion: px,
|
6587 | 'motion-offset': px,
|
6588 |
|
6589 | outline: px,
|
6590 | 'outline-offset': px,
|
6591 | 'outline-width': px,
|
6592 |
|
6593 | perspective: px,
|
6594 | 'perspective-origin-x': percent,
|
6595 | 'perspective-origin-y': percent,
|
6596 |
|
6597 | 'transform-origin': percent,
|
6598 | 'transform-origin-x': percent,
|
6599 | 'transform-origin-y': percent,
|
6600 | 'transform-origin-z': percent,
|
6601 |
|
6602 | 'transition-delay': ms,
|
6603 | 'transition-duration': ms,
|
6604 |
|
6605 | 'vertical-align': px,
|
6606 | 'flex-basis': px,
|
6607 |
|
6608 | 'shape-margin': px,
|
6609 | size: px,
|
6610 | gap: px,
|
6611 |
|
6612 | grid: px,
|
6613 | 'grid-gap': px,
|
6614 | 'row-gap': px,
|
6615 | 'grid-row-gap': px,
|
6616 | 'grid-column-gap': px,
|
6617 | 'grid-template-rows': px,
|
6618 | 'grid-template-columns': px,
|
6619 | 'grid-auto-rows': px,
|
6620 | 'grid-auto-columns': px,
|
6621 |
|
6622 |
|
6623 | 'box-shadow-x': px,
|
6624 | 'box-shadow-y': px,
|
6625 | 'box-shadow-blur': px,
|
6626 | 'box-shadow-spread': px,
|
6627 | 'font-line-height': px,
|
6628 | 'text-shadow-x': px,
|
6629 | 'text-shadow-y': px,
|
6630 | 'text-shadow-blur': px
|
6631 | };
|
6632 |
|
6633 |
|
6634 |
|
6635 |
|
6636 | function addCamelCasedVersion(obj) {
|
6637 | var regExp = /(-[a-z])/g;
|
6638 |
|
6639 | var replace = function replace(str) {
|
6640 | return str[1].toUpperCase();
|
6641 | };
|
6642 |
|
6643 | var newObj = {};
|
6644 |
|
6645 | for (var key in obj) {
|
6646 | newObj[key] = obj[key];
|
6647 | newObj[key.replace(regExp, replace)] = obj[key];
|
6648 | }
|
6649 |
|
6650 | return newObj;
|
6651 | }
|
6652 |
|
6653 | var units = addCamelCasedVersion(defaultUnits);
|
6654 |
|
6655 |
|
6656 |
|
6657 |
|
6658 | function iterate(prop, value, options) {
|
6659 | if (value == null) return value;
|
6660 |
|
6661 | if (Array.isArray(value)) {
|
6662 | for (var i = 0; i < value.length; i++) {
|
6663 | value[i] = iterate(prop, value[i], options);
|
6664 | }
|
6665 | } else if (typeof value === 'object') {
|
6666 | if (prop === 'fallbacks') {
|
6667 | for (var innerProp in value) {
|
6668 | value[innerProp] = iterate(innerProp, value[innerProp], options);
|
6669 | }
|
6670 | } else {
|
6671 | for (var _innerProp in value) {
|
6672 | value[_innerProp] = iterate(prop + "-" + _innerProp, value[_innerProp], options);
|
6673 | }
|
6674 | }
|
6675 |
|
6676 | } else if (typeof value === 'number' && isNaN(value) === false) {
|
6677 | var unit = options[prop] || units[prop];
|
6678 |
|
6679 | if (unit && !(value === 0 && unit === px)) {
|
6680 | return typeof unit === 'function' ? unit(value).toString() : "" + value + unit;
|
6681 | }
|
6682 |
|
6683 | return value.toString();
|
6684 | }
|
6685 |
|
6686 | return value;
|
6687 | }
|
6688 |
|
6689 |
|
6690 |
|
6691 |
|
6692 |
|
6693 | function defaultUnit(options) {
|
6694 | if (options === void 0) {
|
6695 | options = {};
|
6696 | }
|
6697 |
|
6698 | var camelCasedOptions = addCamelCasedVersion(options);
|
6699 |
|
6700 | function onProcessStyle(style, rule) {
|
6701 | if (rule.type !== 'style') return style;
|
6702 |
|
6703 | for (var prop in style) {
|
6704 | style[prop] = iterate(prop, style[prop], camelCasedOptions);
|
6705 | }
|
6706 |
|
6707 | return style;
|
6708 | }
|
6709 |
|
6710 | function onChangeValue(value, prop) {
|
6711 | return iterate(prop, value, camelCasedOptions);
|
6712 | }
|
6713 |
|
6714 | return {
|
6715 | onProcessStyle: onProcessStyle,
|
6716 | onChangeValue: onChangeValue
|
6717 | };
|
6718 | }
|
6719 |
|
6720 |
|
6721 |
|
6722 |
|
6723 |
|
6724 | var propArray = {
|
6725 | 'background-size': true,
|
6726 | 'background-position': true,
|
6727 | border: true,
|
6728 | 'border-bottom': true,
|
6729 | 'border-left': true,
|
6730 | 'border-top': true,
|
6731 | 'border-right': true,
|
6732 | 'border-radius': true,
|
6733 | 'border-image': true,
|
6734 | 'border-width': true,
|
6735 | 'border-style': true,
|
6736 | 'border-color': true,
|
6737 | 'box-shadow': true,
|
6738 | flex: true,
|
6739 | margin: true,
|
6740 | padding: true,
|
6741 | outline: true,
|
6742 | 'transform-origin': true,
|
6743 | transform: true,
|
6744 | transition: true
|
6745 | |
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 | };
|
6751 | var propArrayInObj = {
|
6752 | position: true,
|
6753 |
|
6754 | size: true
|
6755 |
|
6756 | |
6757 |
|
6758 |
|
6759 |
|
6760 | };
|
6761 | var propObj = {
|
6762 | padding: {
|
6763 | top: 0,
|
6764 | right: 0,
|
6765 | bottom: 0,
|
6766 | left: 0
|
6767 | },
|
6768 | margin: {
|
6769 | top: 0,
|
6770 | right: 0,
|
6771 | bottom: 0,
|
6772 | left: 0
|
6773 | },
|
6774 | background: {
|
6775 | attachment: null,
|
6776 | color: null,
|
6777 | image: null,
|
6778 | position: null,
|
6779 | repeat: null
|
6780 | },
|
6781 | border: {
|
6782 | width: null,
|
6783 | style: null,
|
6784 | color: null
|
6785 | },
|
6786 | 'border-top': {
|
6787 | width: null,
|
6788 | style: null,
|
6789 | color: null
|
6790 | },
|
6791 | 'border-right': {
|
6792 | width: null,
|
6793 | style: null,
|
6794 | color: null
|
6795 | },
|
6796 | 'border-bottom': {
|
6797 | width: null,
|
6798 | style: null,
|
6799 | color: null
|
6800 | },
|
6801 | 'border-left': {
|
6802 | width: null,
|
6803 | style: null,
|
6804 | color: null
|
6805 | },
|
6806 | outline: {
|
6807 | width: null,
|
6808 | style: null,
|
6809 | color: null
|
6810 | },
|
6811 | 'list-style': {
|
6812 | type: null,
|
6813 | position: null,
|
6814 | image: null
|
6815 | },
|
6816 | transition: {
|
6817 | property: null,
|
6818 | duration: null,
|
6819 | 'timing-function': null,
|
6820 | timingFunction: null,
|
6821 |
|
6822 | delay: null
|
6823 | },
|
6824 | animation: {
|
6825 | name: null,
|
6826 | duration: null,
|
6827 | 'timing-function': null,
|
6828 | timingFunction: null,
|
6829 |
|
6830 | delay: null,
|
6831 | 'iteration-count': null,
|
6832 | iterationCount: null,
|
6833 |
|
6834 | direction: null,
|
6835 | 'fill-mode': null,
|
6836 | fillMode: null,
|
6837 |
|
6838 | 'play-state': null,
|
6839 | playState: null
|
6840 |
|
6841 | },
|
6842 | 'box-shadow': {
|
6843 | x: 0,
|
6844 | y: 0,
|
6845 | blur: 0,
|
6846 | spread: 0,
|
6847 | color: null,
|
6848 | inset: null
|
6849 | },
|
6850 | 'text-shadow': {
|
6851 | x: 0,
|
6852 | y: 0,
|
6853 | blur: null,
|
6854 | color: null
|
6855 | |
6856 |
|
6857 |
|
6858 |
|
6859 |
|
6860 | }
|
6861 | };
|
6862 | var customPropObj = {
|
6863 | border: {
|
6864 | radius: 'border-radius',
|
6865 | image: 'border-image',
|
6866 | width: 'border-width',
|
6867 | style: 'border-style',
|
6868 | color: 'border-color'
|
6869 | },
|
6870 | 'border-bottom': {
|
6871 | width: 'border-bottom-width',
|
6872 | style: 'border-bottom-style',
|
6873 | color: 'border-bottom-color'
|
6874 | },
|
6875 | 'border-top': {
|
6876 | width: 'border-top-width',
|
6877 | style: 'border-top-style',
|
6878 | color: 'border-top-color'
|
6879 | },
|
6880 | 'border-left': {
|
6881 | width: 'border-left-width',
|
6882 | style: 'border-left-style',
|
6883 | color: 'border-left-color'
|
6884 | },
|
6885 | 'border-right': {
|
6886 | width: 'border-right-width',
|
6887 | style: 'border-right-style',
|
6888 | color: 'border-right-color'
|
6889 | },
|
6890 | background: {
|
6891 | size: 'background-size',
|
6892 | image: 'background-image'
|
6893 | },
|
6894 | font: {
|
6895 | style: 'font-style',
|
6896 | variant: 'font-variant',
|
6897 | weight: 'font-weight',
|
6898 | stretch: 'font-stretch',
|
6899 | size: 'font-size',
|
6900 | family: 'font-family',
|
6901 | lineHeight: 'line-height',
|
6902 |
|
6903 | 'line-height': 'line-height'
|
6904 | },
|
6905 | flex: {
|
6906 | grow: 'flex-grow',
|
6907 | basis: 'flex-basis',
|
6908 | direction: 'flex-direction',
|
6909 | wrap: 'flex-wrap',
|
6910 | flow: 'flex-flow',
|
6911 | shrink: 'flex-shrink'
|
6912 | },
|
6913 | align: {
|
6914 | self: 'align-self',
|
6915 | items: 'align-items',
|
6916 | content: 'align-content'
|
6917 | },
|
6918 | grid: {
|
6919 | 'template-columns': 'grid-template-columns',
|
6920 | templateColumns: 'grid-template-columns',
|
6921 | 'template-rows': 'grid-template-rows',
|
6922 | templateRows: 'grid-template-rows',
|
6923 | 'template-areas': 'grid-template-areas',
|
6924 | templateAreas: 'grid-template-areas',
|
6925 | template: 'grid-template',
|
6926 | 'auto-columns': 'grid-auto-columns',
|
6927 | autoColumns: 'grid-auto-columns',
|
6928 | 'auto-rows': 'grid-auto-rows',
|
6929 | autoRows: 'grid-auto-rows',
|
6930 | 'auto-flow': 'grid-auto-flow',
|
6931 | autoFlow: 'grid-auto-flow',
|
6932 | row: 'grid-row',
|
6933 | column: 'grid-column',
|
6934 | 'row-start': 'grid-row-start',
|
6935 | rowStart: 'grid-row-start',
|
6936 | 'row-end': 'grid-row-end',
|
6937 | rowEnd: 'grid-row-end',
|
6938 | 'column-start': 'grid-column-start',
|
6939 | columnStart: 'grid-column-start',
|
6940 | 'column-end': 'grid-column-end',
|
6941 | columnEnd: 'grid-column-end',
|
6942 | area: 'grid-area',
|
6943 | gap: 'grid-gap',
|
6944 | 'row-gap': 'grid-row-gap',
|
6945 | rowGap: 'grid-row-gap',
|
6946 | 'column-gap': 'grid-column-gap',
|
6947 | columnGap: 'grid-column-gap'
|
6948 | }
|
6949 | };
|
6950 |
|
6951 |
|
6952 |
|
6953 |
|
6954 |
|
6955 |
|
6956 |
|
6957 |
|
6958 |
|
6959 |
|
6960 |
|
6961 | function mapValuesByProp(value, prop, rule) {
|
6962 | return value.map(function (item) {
|
6963 | return objectToArray(item, prop, rule, false, true);
|
6964 | });
|
6965 | }
|
6966 |
|
6967 |
|
6968 |
|
6969 |
|
6970 |
|
6971 | function processArray(value, prop, scheme, rule) {
|
6972 | if (scheme[prop] == null) return value;
|
6973 | if (value.length === 0) return [];
|
6974 | if (Array.isArray(value[0])) return processArray(value[0], prop, scheme, rule);
|
6975 |
|
6976 | if (typeof value[0] === 'object') {
|
6977 | return mapValuesByProp(value, prop, rule);
|
6978 | }
|
6979 |
|
6980 | return [value];
|
6981 | }
|
6982 |
|
6983 |
|
6984 |
|
6985 |
|
6986 |
|
6987 | function objectToArray(value, prop, rule, isFallback, isInArray) {
|
6988 | if (!(propObj[prop] || customPropObj[prop])) return [];
|
6989 | var result = [];
|
6990 |
|
6991 | if (customPropObj[prop]) {
|
6992 |
|
6993 | value = customPropsToStyle(value, rule, customPropObj[prop], isFallback);
|
6994 | }
|
6995 |
|
6996 |
|
6997 | if (Object.keys(value).length) {
|
6998 | for (var baseProp in propObj[prop]) {
|
6999 | if (value[baseProp]) {
|
7000 | if (Array.isArray(value[baseProp])) {
|
7001 | result.push(propArrayInObj[baseProp] === null ? value[baseProp] : value[baseProp].join(' '));
|
7002 | } else result.push(value[baseProp]);
|
7003 |
|
7004 | continue;
|
7005 | }
|
7006 |
|
7007 |
|
7008 | if (propObj[prop][baseProp] != null) {
|
7009 | result.push(propObj[prop][baseProp]);
|
7010 | }
|
7011 | }
|
7012 | }
|
7013 |
|
7014 | if (!result.length || isInArray) return result;
|
7015 | return [result];
|
7016 | }
|
7017 |
|
7018 |
|
7019 |
|
7020 |
|
7021 |
|
7022 | function customPropsToStyle(value, rule, customProps, isFallback) {
|
7023 | for (var prop in customProps) {
|
7024 | var propName = customProps[prop];
|
7025 |
|
7026 | if (typeof value[prop] !== 'undefined' && (isFallback || !rule.prop(propName))) {
|
7027 | var _styleDetector;
|
7028 |
|
7029 | var appendedValue = styleDetector((_styleDetector = {}, _styleDetector[propName] = value[prop], _styleDetector), rule)[propName];
|
7030 |
|
7031 | if (isFallback) rule.style.fallbacks[propName] = appendedValue;else rule.style[propName] = appendedValue;
|
7032 | }
|
7033 |
|
7034 |
|
7035 | delete value[prop];
|
7036 | }
|
7037 |
|
7038 | return value;
|
7039 | }
|
7040 |
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 | function styleDetector(style, rule, isFallback) {
|
7046 | for (var prop in style) {
|
7047 | var value = style[prop];
|
7048 |
|
7049 | if (Array.isArray(value)) {
|
7050 |
|
7051 | if (!Array.isArray(value[0])) {
|
7052 | if (prop === 'fallbacks') {
|
7053 | for (var index = 0; index < style.fallbacks.length; index++) {
|
7054 | style.fallbacks[index] = styleDetector(style.fallbacks[index], rule, true);
|
7055 | }
|
7056 |
|
7057 | continue;
|
7058 | }
|
7059 |
|
7060 | style[prop] = processArray(value, prop, propArray, rule);
|
7061 |
|
7062 | if (!style[prop].length) delete style[prop];
|
7063 | }
|
7064 | } else if (typeof value === 'object') {
|
7065 | if (prop === 'fallbacks') {
|
7066 | style.fallbacks = styleDetector(style.fallbacks, rule, true);
|
7067 | continue;
|
7068 | }
|
7069 |
|
7070 | style[prop] = objectToArray(value, prop, rule, isFallback);
|
7071 |
|
7072 | if (!style[prop].length) delete style[prop];
|
7073 | }
|
7074 | else if (style[prop] === '') delete style[prop];
|
7075 | }
|
7076 |
|
7077 | return style;
|
7078 | }
|
7079 |
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 | function jssExpand() {
|
7085 | function onProcessStyle(style, rule) {
|
7086 | if (!style || rule.type !== 'style') return style;
|
7087 |
|
7088 | if (Array.isArray(style)) {
|
7089 |
|
7090 | for (var index = 0; index < style.length; index++) {
|
7091 | style[index] = styleDetector(style[index], rule);
|
7092 | }
|
7093 |
|
7094 | return style;
|
7095 | }
|
7096 |
|
7097 | return styleDetector(style, rule);
|
7098 | }
|
7099 |
|
7100 | return {
|
7101 | onProcessStyle: onProcessStyle
|
7102 | };
|
7103 | }
|
7104 |
|
7105 | function _arrayLikeToArray(arr, len) {
|
7106 | if (len == null || len > arr.length) len = arr.length;
|
7107 |
|
7108 | for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
7109 | arr2[i] = arr[i];
|
7110 | }
|
7111 |
|
7112 | return arr2;
|
7113 | }
|
7114 |
|
7115 | function _arrayWithoutHoles(arr) {
|
7116 | if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
7117 | }
|
7118 |
|
7119 | function _iterableToArray(iter) {
|
7120 | if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
7121 | }
|
7122 |
|
7123 | function _unsupportedIterableToArray(o, minLen) {
|
7124 | if (!o) return;
|
7125 | if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
7126 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
7127 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
7128 | if (n === "Map" || n === "Set") return Array.from(n);
|
7129 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
7130 | }
|
7131 |
|
7132 | function _nonIterableSpread() {
|
7133 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
7134 | }
|
7135 |
|
7136 | function _toConsumableArray(arr) {
|
7137 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
7138 | }
|
7139 |
|
7140 |
|
7141 | var js = '';
|
7142 | var css = '';
|
7143 | var vendor = '';
|
7144 | var browser = '';
|
7145 | var isTouch = isBrowser && 'ontouchstart' in document.documentElement;
|
7146 |
|
7147 | if (isBrowser) {
|
7148 |
|
7149 |
|
7150 | var jsCssMap = {
|
7151 | Moz: '-moz-',
|
7152 | ms: '-ms-',
|
7153 | O: '-o-',
|
7154 | Webkit: '-webkit-'
|
7155 | };
|
7156 |
|
7157 | var _document$createEleme = document.createElement('p'),
|
7158 | style = _document$createEleme.style;
|
7159 |
|
7160 | var testProp = 'Transform';
|
7161 |
|
7162 | for (var key in jsCssMap) {
|
7163 | if (key + testProp in style) {
|
7164 | js = key;
|
7165 | css = jsCssMap[key];
|
7166 | break;
|
7167 | }
|
7168 | }
|
7169 |
|
7170 |
|
7171 | if (js === 'Webkit' && 'msHyphens' in style) {
|
7172 | js = 'ms';
|
7173 | css = jsCssMap.ms;
|
7174 | browser = 'edge';
|
7175 | }
|
7176 |
|
7177 |
|
7178 | if (js === 'Webkit' && '-apple-trailing-word' in style) {
|
7179 | vendor = 'apple';
|
7180 | }
|
7181 | }
|
7182 |
|
7183 |
|
7184 |
|
7185 |
|
7186 |
|
7187 |
|
7188 |
|
7189 |
|
7190 | var prefix = {
|
7191 | js: js,
|
7192 | css: css,
|
7193 | vendor: vendor,
|
7194 | browser: browser,
|
7195 | isTouch: isTouch
|
7196 | };
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 |
|
7204 |
|
7205 |
|
7206 | function supportedKeyframes(key) {
|
7207 |
|
7208 | if (key[1] === '-') return key;
|
7209 |
|
7210 |
|
7211 | if (prefix.js === 'ms') return key;
|
7212 | return "@" + prefix.css + "keyframes" + key.substr(10);
|
7213 | }
|
7214 |
|
7215 |
|
7216 |
|
7217 | var appearence = {
|
7218 | noPrefill: ['appearance'],
|
7219 | supportedProperty: function supportedProperty(prop) {
|
7220 | if (prop !== 'appearance') return false;
|
7221 | if (prefix.js === 'ms') return "-webkit-" + prop;
|
7222 | return prefix.css + prop;
|
7223 | }
|
7224 | };
|
7225 |
|
7226 |
|
7227 |
|
7228 | var colorAdjust = {
|
7229 | noPrefill: ['color-adjust'],
|
7230 | supportedProperty: function supportedProperty(prop) {
|
7231 | if (prop !== 'color-adjust') return false;
|
7232 | if (prefix.js === 'Webkit') return prefix.css + "print-" + prop;
|
7233 | return prop;
|
7234 | }
|
7235 | };
|
7236 |
|
7237 | var regExp = /[-\s]+(.)?/g;
|
7238 |
|
7239 |
|
7240 |
|
7241 |
|
7242 |
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 | function toUpper(match, c) {
|
7248 | return c ? c.toUpperCase() : '';
|
7249 | }
|
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 |
|
7258 |
|
7259 | function camelize(str) {
|
7260 | return str.replace(regExp, toUpper);
|
7261 | }
|
7262 |
|
7263 |
|
7264 |
|
7265 |
|
7266 |
|
7267 |
|
7268 |
|
7269 |
|
7270 |
|
7271 | function pascalize(str) {
|
7272 | return camelize("-" + str);
|
7273 | }
|
7274 |
|
7275 |
|
7276 |
|
7277 |
|
7278 | var mask = {
|
7279 | noPrefill: ['mask'],
|
7280 | supportedProperty: function supportedProperty(prop, style) {
|
7281 | if (!/^mask/.test(prop)) return false;
|
7282 |
|
7283 | if (prefix.js === 'Webkit') {
|
7284 | var longhand = 'mask-image';
|
7285 |
|
7286 | if (camelize(longhand) in style) {
|
7287 | return prop;
|
7288 | }
|
7289 |
|
7290 | if (prefix.js + pascalize(longhand) in style) {
|
7291 | return prefix.css + prop;
|
7292 | }
|
7293 | }
|
7294 |
|
7295 | return prop;
|
7296 | }
|
7297 | };
|
7298 |
|
7299 |
|
7300 |
|
7301 | var textOrientation = {
|
7302 | noPrefill: ['text-orientation'],
|
7303 | supportedProperty: function supportedProperty(prop) {
|
7304 | if (prop !== 'text-orientation') return false;
|
7305 |
|
7306 | if (prefix.vendor === 'apple' && !prefix.isTouch) {
|
7307 | return prefix.css + prop;
|
7308 | }
|
7309 |
|
7310 | return prop;
|
7311 | }
|
7312 | };
|
7313 |
|
7314 |
|
7315 |
|
7316 | var transform = {
|
7317 | noPrefill: ['transform'],
|
7318 | supportedProperty: function supportedProperty(prop, style, options) {
|
7319 | if (prop !== 'transform') return false;
|
7320 |
|
7321 | if (options.transform) {
|
7322 | return prop;
|
7323 | }
|
7324 |
|
7325 | return prefix.css + prop;
|
7326 | }
|
7327 | };
|
7328 |
|
7329 |
|
7330 |
|
7331 | var transition = {
|
7332 | noPrefill: ['transition'],
|
7333 | supportedProperty: function supportedProperty(prop, style, options) {
|
7334 | if (prop !== 'transition') return false;
|
7335 |
|
7336 | if (options.transition) {
|
7337 | return prop;
|
7338 | }
|
7339 |
|
7340 | return prefix.css + prop;
|
7341 | }
|
7342 | };
|
7343 |
|
7344 |
|
7345 |
|
7346 | var writingMode = {
|
7347 | noPrefill: ['writing-mode'],
|
7348 | supportedProperty: function supportedProperty(prop) {
|
7349 | if (prop !== 'writing-mode') return false;
|
7350 |
|
7351 | if (prefix.js === 'Webkit' || prefix.js === 'ms' && prefix.browser !== 'edge') {
|
7352 | return prefix.css + prop;
|
7353 | }
|
7354 |
|
7355 | return prop;
|
7356 | }
|
7357 | };
|
7358 |
|
7359 |
|
7360 |
|
7361 | var userSelect = {
|
7362 | noPrefill: ['user-select'],
|
7363 | supportedProperty: function supportedProperty(prop) {
|
7364 | if (prop !== 'user-select') return false;
|
7365 |
|
7366 | if (prefix.js === 'Moz' || prefix.js === 'ms' || prefix.vendor === 'apple') {
|
7367 | return prefix.css + prop;
|
7368 | }
|
7369 |
|
7370 | return prop;
|
7371 | }
|
7372 | };
|
7373 |
|
7374 |
|
7375 |
|
7376 |
|
7377 |
|
7378 | var breakPropsOld = {
|
7379 | supportedProperty: function supportedProperty(prop, style) {
|
7380 | if (!/^break-/.test(prop)) return false;
|
7381 |
|
7382 | if (prefix.js === 'Webkit') {
|
7383 | var jsProp = "WebkitColumn" + pascalize(prop);
|
7384 | return jsProp in style ? prefix.css + "column-" + prop : false;
|
7385 | }
|
7386 |
|
7387 | if (prefix.js === 'Moz') {
|
7388 | var _jsProp = "page" + pascalize(prop);
|
7389 |
|
7390 | return _jsProp in style ? "page-" + prop : false;
|
7391 | }
|
7392 |
|
7393 | return false;
|
7394 | }
|
7395 | };
|
7396 |
|
7397 |
|
7398 |
|
7399 | var inlineLogicalOld = {
|
7400 | supportedProperty: function supportedProperty(prop, style) {
|
7401 | if (!/^(border|margin|padding)-inline/.test(prop)) return false;
|
7402 | if (prefix.js === 'Moz') return prop;
|
7403 | var newProp = prop.replace('-inline', '');
|
7404 | return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
|
7405 | }
|
7406 | };
|
7407 |
|
7408 |
|
7409 |
|
7410 |
|
7411 | var unprefixed = {
|
7412 | supportedProperty: function supportedProperty(prop, style) {
|
7413 | return camelize(prop) in style ? prop : false;
|
7414 | }
|
7415 | };
|
7416 |
|
7417 | var prefixed = {
|
7418 | supportedProperty: function supportedProperty(prop, style) {
|
7419 | var pascalized = pascalize(prop);
|
7420 |
|
7421 | if (prop[0] === '-') return prop;
|
7422 |
|
7423 | if (prop[0] === '-' && prop[1] === '-') return prop;
|
7424 | if (prefix.js + pascalized in style) return prefix.css + prop;
|
7425 |
|
7426 | if (prefix.js !== 'Webkit' && "Webkit" + pascalized in style) return "-webkit-" + prop;
|
7427 | return false;
|
7428 | }
|
7429 | };
|
7430 |
|
7431 |
|
7432 |
|
7433 | var scrollSnap = {
|
7434 | supportedProperty: function supportedProperty(prop) {
|
7435 | if (prop.substring(0, 11) !== 'scroll-snap') return false;
|
7436 |
|
7437 | if (prefix.js === 'ms') {
|
7438 | return "" + prefix.css + prop;
|
7439 | }
|
7440 |
|
7441 | return prop;
|
7442 | }
|
7443 | };
|
7444 |
|
7445 |
|
7446 |
|
7447 | var overscrollBehavior = {
|
7448 | supportedProperty: function supportedProperty(prop) {
|
7449 | if (prop !== 'overscroll-behavior') return false;
|
7450 |
|
7451 | if (prefix.js === 'ms') {
|
7452 | return prefix.css + "scroll-chaining";
|
7453 | }
|
7454 |
|
7455 | return prop;
|
7456 | }
|
7457 | };
|
7458 |
|
7459 | var propMap = {
|
7460 | 'flex-grow': 'flex-positive',
|
7461 | 'flex-shrink': 'flex-negative',
|
7462 | 'flex-basis': 'flex-preferred-size',
|
7463 | 'justify-content': 'flex-pack',
|
7464 | order: 'flex-order',
|
7465 | 'align-items': 'flex-align',
|
7466 | 'align-content': 'flex-line-pack'
|
7467 |
|
7468 | };
|
7469 |
|
7470 | var flex2012 = {
|
7471 | supportedProperty: function supportedProperty(prop, style) {
|
7472 | var newProp = propMap[prop];
|
7473 | if (!newProp) return false;
|
7474 | return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
|
7475 | }
|
7476 | };
|
7477 |
|
7478 | var propMap$1 = {
|
7479 | flex: 'box-flex',
|
7480 | 'flex-grow': 'box-flex',
|
7481 | 'flex-direction': ['box-orient', 'box-direction'],
|
7482 | order: 'box-ordinal-group',
|
7483 | 'align-items': 'box-align',
|
7484 | 'flex-flow': ['box-orient', 'box-direction'],
|
7485 | 'justify-content': 'box-pack'
|
7486 | };
|
7487 | var propKeys = Object.keys(propMap$1);
|
7488 |
|
7489 | var prefixCss = function prefixCss(p) {
|
7490 | return prefix.css + p;
|
7491 | };
|
7492 |
|
7493 |
|
7494 | var flex2009 = {
|
7495 | supportedProperty: function supportedProperty(prop, style, _ref) {
|
7496 | var multiple = _ref.multiple;
|
7497 |
|
7498 | if (propKeys.indexOf(prop) > -1) {
|
7499 | var newProp = propMap$1[prop];
|
7500 |
|
7501 | if (!Array.isArray(newProp)) {
|
7502 | return prefix.js + pascalize(newProp) in style ? prefix.css + newProp : false;
|
7503 | }
|
7504 |
|
7505 | if (!multiple) return false;
|
7506 |
|
7507 | for (var i = 0; i < newProp.length; i++) {
|
7508 | if (!(prefix.js + pascalize(newProp[0]) in style)) {
|
7509 | return false;
|
7510 | }
|
7511 | }
|
7512 |
|
7513 | return newProp.map(prefixCss);
|
7514 | }
|
7515 |
|
7516 | return false;
|
7517 | }
|
7518 | };
|
7519 |
|
7520 |
|
7521 |
|
7522 |
|
7523 |
|
7524 |
|
7525 |
|
7526 |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 |
|
7533 |
|
7534 |
|
7535 | var plugins$1 = [appearence, colorAdjust, mask, textOrientation, transform, transition, writingMode, userSelect, breakPropsOld, inlineLogicalOld, unprefixed, prefixed, scrollSnap, overscrollBehavior, flex2012, flex2009];
|
7536 | var propertyDetectors = plugins$1.filter(function (p) {
|
7537 | return p.supportedProperty;
|
7538 | }).map(function (p) {
|
7539 | return p.supportedProperty;
|
7540 | });
|
7541 | var noPrefill = plugins$1.filter(function (p) {
|
7542 | return p.noPrefill;
|
7543 | }).reduce(function (a, p) {
|
7544 | a.push.apply(a, _toConsumableArray(p.noPrefill));
|
7545 | return a;
|
7546 | }, []);
|
7547 |
|
7548 | var el;
|
7549 | var cache$1 = {};
|
7550 |
|
7551 | if (isBrowser) {
|
7552 | el = document.createElement('p');
|
7553 |
|
7554 |
|
7555 |
|
7556 |
|
7557 |
|
7558 |
|
7559 |
|
7560 | var computed = window.getComputedStyle(document.documentElement, '');
|
7561 |
|
7562 | for (var key$1 in computed) {
|
7563 |
|
7564 | if (!isNaN(key$1)) cache$1[computed[key$1]] = computed[key$1];
|
7565 | }
|
7566 |
|
7567 |
|
7568 |
|
7569 | noPrefill.forEach(function (x) {
|
7570 | return delete cache$1[x];
|
7571 | });
|
7572 | }
|
7573 |
|
7574 |
|
7575 |
|
7576 |
|
7577 |
|
7578 |
|
7579 |
|
7580 |
|
7581 |
|
7582 |
|
7583 |
|
7584 | function supportedProperty(prop, options) {
|
7585 | if (options === void 0) {
|
7586 | options = {};
|
7587 | }
|
7588 |
|
7589 |
|
7590 | if (!el) return prop;
|
7591 |
|
7592 | if ( cache$1[prop] != null) {
|
7593 | return cache$1[prop];
|
7594 | }
|
7595 |
|
7596 |
|
7597 | if (prop === 'transition' || prop === 'transform') {
|
7598 | options[prop] = prop in el.style;
|
7599 | }
|
7600 |
|
7601 |
|
7602 | for (var i = 0; i < propertyDetectors.length; i++) {
|
7603 | cache$1[prop] = propertyDetectors[i](prop, el.style, options);
|
7604 |
|
7605 | if (cache$1[prop]) break;
|
7606 | }
|
7607 |
|
7608 |
|
7609 |
|
7610 | try {
|
7611 | el.style[prop] = '';
|
7612 | } catch (err) {
|
7613 | return false;
|
7614 | }
|
7615 |
|
7616 | return cache$1[prop];
|
7617 | }
|
7618 |
|
7619 | var cache$1$1 = {};
|
7620 | var transitionProperties = {
|
7621 | transition: 1,
|
7622 | 'transition-property': 1,
|
7623 | '-webkit-transition': 1,
|
7624 | '-webkit-transition-property': 1
|
7625 | };
|
7626 | var transPropsRegExp = /(^\s*[\w-]+)|, (\s*[\w-]+)(?![^()]*\))/g;
|
7627 | var el$1;
|
7628 |
|
7629 |
|
7630 |
|
7631 |
|
7632 |
|
7633 |
|
7634 |
|
7635 |
|
7636 |
|
7637 |
|
7638 | function prefixTransitionCallback(match, p1, p2) {
|
7639 | if (p1 === 'var') return 'var';
|
7640 | if (p1 === 'all') return 'all';
|
7641 | if (p2 === 'all') return ', all';
|
7642 | var prefixedValue = p1 ? supportedProperty(p1) : ", " + supportedProperty(p2);
|
7643 | if (!prefixedValue) return p1 || p2;
|
7644 | return prefixedValue;
|
7645 | }
|
7646 |
|
7647 | if (isBrowser) el$1 = document.createElement('p');
|
7648 |
|
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 |
|
7654 |
|
7655 |
|
7656 |
|
7657 | function supportedValue(property, value) {
|
7658 |
|
7659 | var prefixedValue = value;
|
7660 | if (!el$1 || property === 'content') return value;
|
7661 |
|
7662 |
|
7663 |
|
7664 | if (typeof prefixedValue !== 'string' || !isNaN(parseInt(prefixedValue, 10))) {
|
7665 | return prefixedValue;
|
7666 | }
|
7667 |
|
7668 |
|
7669 | var cacheKey = property + prefixedValue;
|
7670 |
|
7671 | if ( cache$1$1[cacheKey] != null) {
|
7672 | return cache$1$1[cacheKey];
|
7673 | }
|
7674 |
|
7675 |
|
7676 | try {
|
7677 |
|
7678 | el$1.style[property] = prefixedValue;
|
7679 | } catch (err) {
|
7680 |
|
7681 | cache$1$1[cacheKey] = false;
|
7682 | return false;
|
7683 | }
|
7684 |
|
7685 |
|
7686 | if (transitionProperties[property]) {
|
7687 | prefixedValue = prefixedValue.replace(transPropsRegExp, prefixTransitionCallback);
|
7688 | } else if (el$1.style[property] === '') {
|
7689 |
|
7690 | prefixedValue = prefix.css + prefixedValue;
|
7691 |
|
7692 | if (prefixedValue === '-ms-flex') el$1.style[property] = '-ms-flexbox';
|
7693 |
|
7694 | el$1.style[property] = prefixedValue;
|
7695 |
|
7696 | if (el$1.style[property] === '') {
|
7697 | cache$1$1[cacheKey] = false;
|
7698 | return false;
|
7699 | }
|
7700 | }
|
7701 |
|
7702 |
|
7703 | el$1.style[property] = '';
|
7704 |
|
7705 | cache$1$1[cacheKey] = prefixedValue;
|
7706 | return cache$1$1[cacheKey];
|
7707 | }
|
7708 |
|
7709 |
|
7710 |
|
7711 |
|
7712 |
|
7713 | function jssVendorPrefixer() {
|
7714 | function onProcessRule(rule) {
|
7715 | if (rule.type === 'keyframes') {
|
7716 | var atRule = rule;
|
7717 | atRule.at = supportedKeyframes(atRule.at);
|
7718 | }
|
7719 | }
|
7720 |
|
7721 | function prefixStyle(style) {
|
7722 | for (var prop in style) {
|
7723 | var value = style[prop];
|
7724 |
|
7725 | if (prop === 'fallbacks' && Array.isArray(value)) {
|
7726 | style[prop] = value.map(prefixStyle);
|
7727 | continue;
|
7728 | }
|
7729 |
|
7730 | var changeProp = false;
|
7731 | var supportedProp = supportedProperty(prop);
|
7732 | if (supportedProp && supportedProp !== prop) changeProp = true;
|
7733 | var changeValue = false;
|
7734 | var supportedValue$1 = supportedValue(supportedProp, toCssValue(value));
|
7735 | if (supportedValue$1 && supportedValue$1 !== value) changeValue = true;
|
7736 |
|
7737 | if (changeProp || changeValue) {
|
7738 | if (changeProp) delete style[prop];
|
7739 | style[supportedProp || prop] = supportedValue$1 || value;
|
7740 | }
|
7741 | }
|
7742 |
|
7743 | return style;
|
7744 | }
|
7745 |
|
7746 | function onProcessStyle(style, rule) {
|
7747 | if (rule.type !== 'style') return style;
|
7748 | return prefixStyle(style);
|
7749 | }
|
7750 |
|
7751 | function onChangeValue(value, prop) {
|
7752 | return supportedValue(prop, toCssValue(value)) || value;
|
7753 | }
|
7754 |
|
7755 | return {
|
7756 | onProcessRule: onProcessRule,
|
7757 | onProcessStyle: onProcessStyle,
|
7758 | onChangeValue: onChangeValue
|
7759 | };
|
7760 | }
|
7761 |
|
7762 |
|
7763 |
|
7764 |
|
7765 | function jssPropsSort() {
|
7766 | var sort = function sort(prop0, prop1) {
|
7767 | if (prop0.length === prop1.length) {
|
7768 | return prop0 > prop1 ? 1 : -1;
|
7769 | }
|
7770 |
|
7771 | return prop0.length - prop1.length;
|
7772 | };
|
7773 |
|
7774 | return {
|
7775 | onProcessStyle: function onProcessStyle(style, rule) {
|
7776 | if (rule.type !== 'style') return style;
|
7777 | var newStyle = {};
|
7778 | var props = Object.keys(style).sort(sort);
|
7779 |
|
7780 | for (var i = 0; i < props.length; i++) {
|
7781 | newStyle[props[i]] = style[props[i]];
|
7782 | }
|
7783 |
|
7784 | return newStyle;
|
7785 | }
|
7786 | };
|
7787 | }
|
7788 |
|
7789 | var create = function create(options) {
|
7790 | if (options === void 0) {
|
7791 | options = {};
|
7792 | }
|
7793 |
|
7794 | return {
|
7795 | plugins: [functionPlugin(), observablePlugin(options.observable), templatePlugin(), jssGlobal(), jssExtend(), jssNested(), jssCompose(), camelCase(), defaultUnit(options.defaultUnit), jssExpand(), jssVendorPrefixer(), jssPropsSort()]
|
7796 | };
|
7797 | };
|
7798 |
|
7799 | var defaultJss = createJss(create());
|
7800 |
|
7801 | var sheetsMeta = new WeakMap();
|
7802 | var getMeta = function getMeta(sheet) {
|
7803 | return sheetsMeta.get(sheet);
|
7804 | };
|
7805 | var addMeta = function addMeta(sheet, meta) {
|
7806 | sheetsMeta.set(sheet, meta);
|
7807 | };
|
7808 |
|
7809 | var getStyles = function getStyles(options) {
|
7810 | var styles = options.styles;
|
7811 |
|
7812 | if (typeof styles !== 'function') {
|
7813 | return styles;
|
7814 | }
|
7815 |
|
7816 | 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.") ;
|
7817 | return styles(options.theme);
|
7818 | };
|
7819 |
|
7820 | function getSheetOptions(options, link) {
|
7821 | var minify;
|
7822 |
|
7823 | if (options.context.id && options.context.id.minify != null) {
|
7824 | minify = options.context.id.minify;
|
7825 | }
|
7826 |
|
7827 | var classNamePrefix = options.context.classNamePrefix || '';
|
7828 |
|
7829 | if (options.name && !minify) {
|
7830 | classNamePrefix += options.name.replace(/\s/g, '-') + "-";
|
7831 | }
|
7832 |
|
7833 | var meta = '';
|
7834 | if (options.name) meta = options.name + ", ";
|
7835 | meta += typeof options.styles === 'function' ? 'Themed' : 'Unthemed';
|
7836 | return _extends({}, options.sheetOptions, {
|
7837 | index: options.index,
|
7838 | meta: meta,
|
7839 | classNamePrefix: classNamePrefix,
|
7840 | link: link,
|
7841 | generateId: options.sheetOptions && options.sheetOptions.generateId ? options.sheetOptions.generateId : options.context.generateId
|
7842 | });
|
7843 | }
|
7844 |
|
7845 | var createStyleSheet = function createStyleSheet(options) {
|
7846 | if (options.context.disableStylesGeneration) {
|
7847 | return undefined;
|
7848 | }
|
7849 |
|
7850 | var manager = getManager(options.context, options.index);
|
7851 | var existingSheet = manager.get(options.theme);
|
7852 |
|
7853 | if (existingSheet) {
|
7854 | return existingSheet;
|
7855 | }
|
7856 |
|
7857 | var jss = options.context.jss || defaultJss;
|
7858 | var styles = getStyles(options);
|
7859 | var dynamicStyles = getDynamicStyles(styles);
|
7860 | var sheet = jss.createStyleSheet(styles, getSheetOptions(options, dynamicStyles !== null));
|
7861 | addMeta(sheet, {
|
7862 | dynamicStyles: dynamicStyles,
|
7863 | styles: styles
|
7864 | });
|
7865 | manager.add(options.theme, sheet);
|
7866 | return sheet;
|
7867 | };
|
7868 | var removeDynamicRules = function removeDynamicRules(sheet, rules) {
|
7869 |
|
7870 |
|
7871 | for (var key in rules) {
|
7872 | sheet.deleteRule(rules[key]);
|
7873 | }
|
7874 | };
|
7875 | var updateDynamicRules = function updateDynamicRules(data, sheet, rules) {
|
7876 |
|
7877 |
|
7878 | for (var key in rules) {
|
7879 | sheet.updateOne(rules[key], data);
|
7880 | }
|
7881 | };
|
7882 | var addDynamicRules = function addDynamicRules(sheet, data) {
|
7883 | var meta = getMeta(sheet);
|
7884 |
|
7885 | if (!meta) {
|
7886 | return undefined;
|
7887 | }
|
7888 |
|
7889 | var rules = {};
|
7890 |
|
7891 | for (var key in meta.dynamicStyles) {
|
7892 | var initialRuleCount = sheet.rules.index.length;
|
7893 | var originalRule = sheet.addRule(key, meta.dynamicStyles[key]);
|
7894 |
|
7895 | for (var i = initialRuleCount; i < sheet.rules.index.length; i++) {
|
7896 | var rule = sheet.rules.index[i];
|
7897 | sheet.updateOne(rule, data);
|
7898 |
|
7899 |
|
7900 | rules[originalRule === rule ? key : rule.key] = rule;
|
7901 | }
|
7902 | }
|
7903 |
|
7904 | return rules;
|
7905 | };
|
7906 |
|
7907 | var getSheetClasses = function getSheetClasses(sheet, dynamicRules) {
|
7908 | if (!dynamicRules) {
|
7909 | return sheet.classes;
|
7910 | }
|
7911 |
|
7912 | var meta = getMeta(sheet);
|
7913 |
|
7914 | if (!meta) {
|
7915 | return sheet.classes;
|
7916 | }
|
7917 |
|
7918 | var classes = {};
|
7919 |
|
7920 | for (var key in meta.styles) {
|
7921 | classes[key] = sheet.classes[key];
|
7922 |
|
7923 | if (key in dynamicRules) {
|
7924 | classes[key] += " " + sheet.classes[dynamicRules[key].key];
|
7925 | }
|
7926 | }
|
7927 |
|
7928 | return classes;
|
7929 | };
|
7930 |
|
7931 | function getUseInsertionEffect(isSSR) {
|
7932 | return isSSR ? react.useEffect : react.useInsertionEffect ||
|
7933 | react.useLayoutEffect;
|
7934 | }
|
7935 |
|
7936 | var noTheme = {};
|
7937 |
|
7938 | var createUseStyles = function createUseStyles(styles, options) {
|
7939 | if (options === void 0) {
|
7940 | options = {};
|
7941 | }
|
7942 |
|
7943 | var _options = options,
|
7944 | _options$index = _options.index,
|
7945 | index = _options$index === void 0 ? getSheetIndex() : _options$index,
|
7946 | theming = _options.theming,
|
7947 | name = _options.name,
|
7948 | sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "name"]);
|
7949 |
|
7950 | var ThemeContext$1 = theming && theming.context || ThemeContext;
|
7951 |
|
7952 | var useTheme = function useTheme(theme) {
|
7953 | if (typeof styles === 'function') {
|
7954 | return theme || react.useContext(ThemeContext$1) || noTheme;
|
7955 | }
|
7956 |
|
7957 | return noTheme;
|
7958 | };
|
7959 |
|
7960 | var emptyObject = {};
|
7961 | return function useStyles(data) {
|
7962 | var isFirstMount = react.useRef(true);
|
7963 | var context = react.useContext(JssContext);
|
7964 | var theme = useTheme(data && data.theme);
|
7965 |
|
7966 | var _useMemo = react.useMemo(function () {
|
7967 | var newSheet = createStyleSheet({
|
7968 | context: context,
|
7969 | styles: styles,
|
7970 | name: name,
|
7971 | theme: theme,
|
7972 | index: index,
|
7973 | sheetOptions: sheetOptions
|
7974 | });
|
7975 |
|
7976 | if (newSheet && context.isSSR) {
|
7977 |
|
7978 | manageSheet({
|
7979 | index: index,
|
7980 | context: context,
|
7981 | sheet: newSheet,
|
7982 | theme: theme
|
7983 | });
|
7984 | }
|
7985 |
|
7986 | return [newSheet, newSheet ? addDynamicRules(newSheet, data) : null];
|
7987 | }, [context, theme]),
|
7988 | sheet = _useMemo[0],
|
7989 | dynamicRules = _useMemo[1];
|
7990 |
|
7991 | getUseInsertionEffect(context.isSSR)(function () {
|
7992 |
|
7993 | if (sheet && dynamicRules && !isFirstMount.current) {
|
7994 | updateDynamicRules(data, sheet, dynamicRules);
|
7995 | }
|
7996 | }, [data]);
|
7997 | getUseInsertionEffect(context.isSSR)(function () {
|
7998 | if (sheet) {
|
7999 | manageSheet({
|
8000 | index: index,
|
8001 | context: context,
|
8002 | sheet: sheet,
|
8003 | theme: theme
|
8004 | });
|
8005 | }
|
8006 |
|
8007 | return function () {
|
8008 | if (sheet) {
|
8009 | unmanageSheet({
|
8010 | index: index,
|
8011 | context: context,
|
8012 | sheet: sheet,
|
8013 | theme: theme
|
8014 | });
|
8015 |
|
8016 | if (dynamicRules) {
|
8017 | removeDynamicRules(sheet, dynamicRules);
|
8018 | }
|
8019 | }
|
8020 | };
|
8021 | }, [sheet]);
|
8022 | var classes = react.useMemo(function () {
|
8023 | return sheet && dynamicRules ? getSheetClasses(sheet, dynamicRules) : emptyObject;
|
8024 | }, [sheet, dynamicRules]);
|
8025 | react.useDebugValue(classes);
|
8026 | react.useDebugValue(theme === noTheme ? 'No theme' : theme);
|
8027 | react.useEffect(function () {
|
8028 | isFirstMount.current = false;
|
8029 | });
|
8030 | return classes;
|
8031 | };
|
8032 | };
|
8033 |
|
8034 | var NoRenderer = function NoRenderer(props) {
|
8035 | return props.children || null;
|
8036 | };
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 | var createWithStyles = function createWithStyles(styles, options) {
|
8045 | if (options === void 0) {
|
8046 | options = {};
|
8047 | }
|
8048 |
|
8049 | var _options = options,
|
8050 | _options$index = _options.index,
|
8051 | index = _options$index === void 0 ? getSheetIndex() : _options$index,
|
8052 | theming = _options.theming,
|
8053 | injectTheme = _options.injectTheme,
|
8054 | sheetOptions = _objectWithoutPropertiesLoose(_options, ["index", "theming", "injectTheme"]);
|
8055 |
|
8056 | var ThemeContext$1 = theming ? theming.context : ThemeContext;
|
8057 | return function (InnerComponent) {
|
8058 | if (InnerComponent === void 0) {
|
8059 | InnerComponent = NoRenderer;
|
8060 | }
|
8061 |
|
8062 | var displayName = getDisplayName$1(InnerComponent);
|
8063 | var mergeClassesProp = memoize(function (sheetClasses, classesProp) {
|
8064 | return classesProp ? mergeClasses(sheetClasses, classesProp) : sheetClasses;
|
8065 | });
|
8066 | var hookOptions = Object.assign(sheetOptions, {
|
8067 | theming: theming,
|
8068 | index: index,
|
8069 | name: displayName
|
8070 | });
|
8071 | var useStyles = createUseStyles(styles, hookOptions);
|
8072 | var WithStyles = react.forwardRef(function (props, ref) {
|
8073 | var theme = react.useContext(ThemeContext$1);
|
8074 |
|
8075 | var newProps = _extends({}, props);
|
8076 |
|
8077 | if (injectTheme && newProps.theme == null) {
|
8078 | newProps.theme = theme;
|
8079 | }
|
8080 |
|
8081 | var sheetClasses = useStyles(newProps);
|
8082 | var classes = mergeClassesProp(sheetClasses, props.classes);
|
8083 | return react.createElement(InnerComponent, _extends({}, newProps, {
|
8084 | classes: classes,
|
8085 | ref: ref
|
8086 | }));
|
8087 | });
|
8088 | WithStyles.displayName = "WithStyles(" + displayName + ")";
|
8089 | WithStyles.defaultProps = _extends({}, InnerComponent.defaultProps);
|
8090 | WithStyles.InnerComponent = InnerComponent;
|
8091 | return hoistNonReactStatics_cjs(WithStyles, InnerComponent);
|
8092 | };
|
8093 | };
|
8094 |
|
8095 | function shallowEqualObjects(objA, objB) {
|
8096 | if (objA === objB) {
|
8097 | return true;
|
8098 | }
|
8099 |
|
8100 | if (!objA || !objB) {
|
8101 | return false;
|
8102 | }
|
8103 |
|
8104 | var aKeys = Object.keys(objA);
|
8105 | var bKeys = Object.keys(objB);
|
8106 | var len = aKeys.length;
|
8107 |
|
8108 | if (bKeys.length !== len) {
|
8109 | return false;
|
8110 | }
|
8111 |
|
8112 | for (var i = 0; i < len; i++) {
|
8113 | var key = aKeys[i];
|
8114 |
|
8115 | if (objA[key] !== objB[key]) {
|
8116 | return false;
|
8117 | }
|
8118 | }
|
8119 |
|
8120 | return true;
|
8121 | }
|
8122 |
|
8123 | var initialContext = {};
|
8124 | function JssProvider(props) {
|
8125 | var managersRef = react.useRef({});
|
8126 | var prevContextRef = react.useRef();
|
8127 | var registryRef = react.useRef(null);
|
8128 |
|
8129 | var createContext = function createContext(parentContext, prevContext) {
|
8130 | if (prevContext === void 0) {
|
8131 | prevContext = initialContext;
|
8132 | }
|
8133 |
|
8134 | var registry = props.registry,
|
8135 | classNamePrefix = props.classNamePrefix,
|
8136 | jss = props.jss,
|
8137 | generateId = props.generateId,
|
8138 | disableStylesGeneration = props.disableStylesGeneration,
|
8139 | media = props.media,
|
8140 | id = props.id,
|
8141 | isSSR = props.isSSR;
|
8142 |
|
8143 | var context = _extends({}, parentContext);
|
8144 |
|
8145 | if (registry) {
|
8146 | context.registry = registry;
|
8147 |
|
8148 |
|
8149 | if (registry !== registryRef.current) {
|
8150 |
|
8151 | managersRef.current = {};
|
8152 | registryRef.current = registry;
|
8153 | }
|
8154 | }
|
8155 |
|
8156 | context.managers = managersRef.current;
|
8157 |
|
8158 | if (id !== undefined) {
|
8159 | context.id = id;
|
8160 | }
|
8161 |
|
8162 | if (generateId !== undefined) {
|
8163 | context.generateId = generateId;
|
8164 | } else if (!context.generateId || !prevContext || context.id !== prevContext.id) {
|
8165 | context.generateId = createGenerateId(context.id);
|
8166 | }
|
8167 |
|
8168 | if (classNamePrefix) {
|
8169 | context.classNamePrefix = (context.classNamePrefix || '') + classNamePrefix;
|
8170 | }
|
8171 |
|
8172 | if (media !== undefined) {
|
8173 | context.media = media;
|
8174 | }
|
8175 |
|
8176 | if (jss) {
|
8177 | context.jss = jss;
|
8178 | }
|
8179 |
|
8180 | if (disableStylesGeneration !== undefined) {
|
8181 | context.disableStylesGeneration = disableStylesGeneration;
|
8182 | }
|
8183 |
|
8184 | if (isSSR !== undefined) {
|
8185 | context.isSSR = isSSR;
|
8186 | }
|
8187 |
|
8188 | if (prevContext && shallowEqualObjects(prevContext, context)) {
|
8189 | return prevContext;
|
8190 | }
|
8191 |
|
8192 | return context;
|
8193 | };
|
8194 |
|
8195 | var renderProvider = function renderProvider(parentContext) {
|
8196 | var children = props.children;
|
8197 | var context = createContext(parentContext, prevContextRef.current);
|
8198 | prevContextRef.current = context;
|
8199 | return react.createElement(JssContext.Provider, {
|
8200 | value: context
|
8201 | }, children);
|
8202 | };
|
8203 |
|
8204 | return react.createElement(JssContext.Consumer, null, renderProvider);
|
8205 | }
|
8206 |
|
8207 | function memoize$2(fn) {
|
8208 | var cache = {};
|
8209 | return function (arg) {
|
8210 | if (cache[arg] === undefined) cache[arg] = fn(arg);
|
8211 | return cache[arg];
|
8212 | };
|
8213 | }
|
8214 |
|
8215 | 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)-.*))$/;
|
8216 |
|
8217 | var index$2 = memoize$2(function (prop) {
|
8218 | return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
8219 |
|
8220 | && prop.charCodeAt(1) === 110
|
8221 |
|
8222 | && prop.charCodeAt(2) < 91;
|
8223 | }
|
8224 |
|
8225 | );
|
8226 |
|
8227 | var parseStyles = function parseStyles(args) {
|
8228 | var dynamicStyles = [];
|
8229 | var staticStyle;
|
8230 | var labels = [];
|
8231 |
|
8232 | for (var key in args) {
|
8233 | var style = args[key];
|
8234 | if (!style) continue;
|
8235 |
|
8236 | if (typeof style === 'function') {
|
8237 | dynamicStyles.push(style);
|
8238 | } else {
|
8239 | if (!staticStyle) staticStyle = {};
|
8240 | Object.assign(staticStyle, style);
|
8241 | var _staticStyle = staticStyle,
|
8242 | _label = _staticStyle.label;
|
8243 |
|
8244 | if (_label) {
|
8245 | if (labels.indexOf(_label) === -1) labels.push(_label);
|
8246 | }
|
8247 | }
|
8248 | }
|
8249 |
|
8250 | var styles = {};
|
8251 | var label = labels.length === 0 ? 'sc' : labels.join('-');
|
8252 |
|
8253 | if (staticStyle) {
|
8254 |
|
8255 | if ('label' in staticStyle) delete staticStyle.label;
|
8256 | styles[label] = staticStyle;
|
8257 | }
|
8258 |
|
8259 |
|
8260 | if (dynamicStyles.length === 1) {
|
8261 | styles.scd = dynamicStyles[0];
|
8262 | }
|
8263 |
|
8264 |
|
8265 |
|
8266 | if (dynamicStyles.length > 1) {
|
8267 | styles.scd = function (props) {
|
8268 | var merged = {};
|
8269 |
|
8270 | for (var i = 0; i < dynamicStyles.length; i++) {
|
8271 | var dynamicStyle = dynamicStyles[i](props);
|
8272 | if (dynamicStyle) Object.assign(merged, dynamicStyle);
|
8273 | }
|
8274 |
|
8275 | return merged;
|
8276 | };
|
8277 | }
|
8278 |
|
8279 | return {
|
8280 | styles: styles,
|
8281 | label: label
|
8282 | };
|
8283 | };
|
8284 |
|
8285 | var shouldForwardPropSymbol = Symbol('react-jss-styled');
|
8286 |
|
8287 | var getShouldForwardProp = function getShouldForwardProp(tagOrComponent, options) {
|
8288 | var shouldForwardProp = options.shouldForwardProp;
|
8289 | var childShouldForwardProp = tagOrComponent[shouldForwardPropSymbol];
|
8290 | var finalShouldForwardProp = shouldForwardProp || childShouldForwardProp;
|
8291 |
|
8292 | if (shouldForwardProp && childShouldForwardProp) {
|
8293 | finalShouldForwardProp = function finalShouldForwardProp(prop) {
|
8294 | return childShouldForwardProp(prop) && shouldForwardProp(prop);
|
8295 | };
|
8296 | }
|
8297 |
|
8298 | return finalShouldForwardProp;
|
8299 | };
|
8300 |
|
8301 | var getChildProps = function getChildProps(props, shouldForwardProp, isTag) {
|
8302 | var childProps = {};
|
8303 |
|
8304 | for (var prop in props) {
|
8305 | if (shouldForwardProp) {
|
8306 | if (shouldForwardProp(prop) === true) {
|
8307 | childProps[prop] = props[prop];
|
8308 | }
|
8309 |
|
8310 | continue;
|
8311 | }
|
8312 |
|
8313 |
|
8314 | if (isTag) {
|
8315 | if (index$2(prop)) {
|
8316 | childProps[prop] = props[prop];
|
8317 | }
|
8318 |
|
8319 | continue;
|
8320 | }
|
8321 |
|
8322 | childProps[prop] = props[prop];
|
8323 | }
|
8324 |
|
8325 | return childProps;
|
8326 | };
|
8327 |
|
8328 |
|
8329 | var configureStyled = function configureStyled(tagOrComponent, options) {
|
8330 | if (options === void 0) {
|
8331 | options = {};
|
8332 | }
|
8333 |
|
8334 | var _options = options,
|
8335 | theming = _options.theming;
|
8336 | var isTag = typeof tagOrComponent === 'string';
|
8337 | var ThemeContext$1 = theming ? theming.context : ThemeContext;
|
8338 | var shouldForwardProp = getShouldForwardProp(tagOrComponent, options);
|
8339 |
|
8340 | var _options2 = options,
|
8341 | _ = _options2.shouldForwardProp,
|
8342 | hookOptions = _objectWithoutPropertiesLoose(_options2, ["shouldForwardProp"]);
|
8343 |
|
8344 | return function createStyledComponent() {
|
8345 |
|
8346 | var _parseStyles = parseStyles(arguments),
|
8347 | styles = _parseStyles.styles,
|
8348 | label = _parseStyles.label;
|
8349 |
|
8350 | var useStyles = createUseStyles(styles, hookOptions);
|
8351 |
|
8352 | var Styled = function Styled(props) {
|
8353 | var as = props.as,
|
8354 | className = props.className;
|
8355 | var theme = react.useContext(ThemeContext$1);
|
8356 | var propsWithTheme = Object.assign({
|
8357 | theme: theme
|
8358 | }, props);
|
8359 | var classes = useStyles(propsWithTheme);
|
8360 | var childProps = getChildProps(props, shouldForwardProp, isTag);
|
8361 | var classNames = ((classes[label] || classes.sc || '') + " " + (classes.scd || '')).trim();
|
8362 | childProps.className = className ? className + " " + classNames : classNames;
|
8363 |
|
8364 | if (!isTag && shouldForwardProp) {
|
8365 | tagOrComponent[shouldForwardPropSymbol] = shouldForwardProp;
|
8366 | }
|
8367 |
|
8368 | if (isTag && as) {
|
8369 | return react.createElement(as, childProps);
|
8370 | }
|
8371 |
|
8372 | return react.createElement(tagOrComponent, childProps);
|
8373 | };
|
8374 |
|
8375 | return Styled;
|
8376 | };
|
8377 | };
|
8378 |
|
8379 | var MAX_RULES_PER_SHEET = 10000;
|
8380 | var defaultJss$1 = createJss(create());
|
8381 |
|
8382 | var createCss = function createCss(jss) {
|
8383 | if (jss === void 0) {
|
8384 | jss = defaultJss$1;
|
8385 | }
|
8386 |
|
8387 | var cache = new Map();
|
8388 | var ruleIndex = 0;
|
8389 | var sheet;
|
8390 |
|
8391 | var getSheet = function getSheet() {
|
8392 | if (!sheet || sheet.rules.index.length > MAX_RULES_PER_SHEET) {
|
8393 | sheet = jss.createStyleSheet().attach();
|
8394 | }
|
8395 |
|
8396 | return sheet;
|
8397 | };
|
8398 |
|
8399 | function css() {
|
8400 |
|
8401 | var args = arguments;
|
8402 |
|
8403 |
|
8404 | var argsStr = JSON.stringify(args);
|
8405 | var cached = cache.get(argsStr);
|
8406 | if (cached) return cached.className;
|
8407 | var flatArgs = [];
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 | for (var argIndex in args) {
|
8413 | var arg = args[argIndex];
|
8414 |
|
8415 | if (!Array.isArray(arg)) {
|
8416 | flatArgs.push(arg);
|
8417 | continue;
|
8418 | }
|
8419 |
|
8420 | for (var innerArgIndex = 0; innerArgIndex < arg.length; innerArgIndex++) {
|
8421 | flatArgs.push(arg[innerArgIndex]);
|
8422 | }
|
8423 | }
|
8424 |
|
8425 | var mergedStyle = {};
|
8426 | var labels = [];
|
8427 |
|
8428 | for (var i = 0; i < flatArgs.length; i++) {
|
8429 | var style = flatArgs[i];
|
8430 | if (!style) continue;
|
8431 | var styleObject = style;
|
8432 |
|
8433 | if (typeof style === 'string') {
|
8434 |
|
8435 | var _cached = cache.get(style);
|
8436 |
|
8437 | if (_cached) {
|
8438 |
|
8439 | if (_cached.labels.length) labels.push.apply(labels, _cached.labels);
|
8440 | styleObject = _cached.style;
|
8441 | }
|
8442 | }
|
8443 |
|
8444 | if (styleObject.label && labels.indexOf(styleObject.label) === -1) labels.push(styleObject.label);
|
8445 | Object.assign(mergedStyle, styleObject);
|
8446 | }
|
8447 |
|
8448 | delete mergedStyle.label;
|
8449 | var label = labels.length === 0 ? 'css' : labels.join('-');
|
8450 | var key = label + "-" + ruleIndex++;
|
8451 | getSheet().addRule(key, mergedStyle);
|
8452 | var className = getSheet().classes[key];
|
8453 | var cacheValue = {
|
8454 | style: mergedStyle,
|
8455 | labels: labels,
|
8456 | className: className
|
8457 | };
|
8458 | cache.set(argsStr, cacheValue);
|
8459 | cache.set(className, cacheValue);
|
8460 | return className;
|
8461 | }
|
8462 |
|
8463 |
|
8464 | css.getSheet = getSheet;
|
8465 | return css;
|
8466 | };
|
8467 |
|
8468 | var css$1 = createCss();
|
8469 |
|
8470 |
|
8471 | var create$1 = function create(css) {
|
8472 | if (css === void 0) {
|
8473 | css = css$1;
|
8474 | }
|
8475 |
|
8476 | return function createElement(type, props) {
|
8477 | var args = arguments;
|
8478 |
|
8479 | if (props && props.css) {
|
8480 | var className = css(props.css);
|
8481 | var newProps = Object.assign({}, props);
|
8482 | newProps.className = props.className ? props.className + " " + className : className;
|
8483 | delete newProps.css;
|
8484 | args[1] = newProps;
|
8485 | }
|
8486 |
|
8487 | return react.createElement.apply(undefined, args);
|
8488 | };
|
8489 | };
|
8490 | var jsx = create$1();
|
8491 |
|
8492 | export default createWithStyles;
|
8493 | export { JssContext, JssProvider, SheetsRegistry, ThemeProvider, createGenerateId, create$1 as createJsx, createTheming, createUseStyles, defaultJss as jss, jsx, configureStyled as styled, useTheme, createWithStyles as withStyles, withTheme };
|