New source found from dndbeyond.com
This commit is contained in:
Generated
Vendored
+22
-28
@@ -1,10 +1,12 @@
|
||||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import * as React from 'react';
|
||||
import isPropValid from '@emotion/is-prop-valid';
|
||||
import { withEmotionCache, ThemeContext } from '@emotion/react';
|
||||
import { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';
|
||||
import { serializeStyles } from '@emotion/serialize';
|
||||
import { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';
|
||||
import { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';
|
||||
import * as React from 'react';
|
||||
import isPropValid from '@emotion/is-prop-valid';
|
||||
|
||||
var isDevelopment = false;
|
||||
|
||||
var testOmitPropsOnStringTag = isPropValid;
|
||||
|
||||
@@ -35,8 +37,6 @@ var composeShouldForwardProps = function composeShouldForwardProps(tag, options,
|
||||
return shouldForwardProp;
|
||||
};
|
||||
|
||||
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
|
||||
|
||||
var Insertion = function Insertion(_ref) {
|
||||
var cache = _ref.cache,
|
||||
serialized = _ref.serialized,
|
||||
@@ -50,11 +50,6 @@ var Insertion = function Insertion(_ref) {
|
||||
};
|
||||
|
||||
var createStyled = function createStyled(tag, options) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (tag === undefined) {
|
||||
throw new Error('You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.');
|
||||
}
|
||||
}
|
||||
|
||||
var isReal = tag.__emotion_real === tag;
|
||||
var baseTag = isReal && tag.__emotion_base || tag;
|
||||
@@ -70,6 +65,7 @@ var createStyled = function createStyled(tag, options) {
|
||||
var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
|
||||
var shouldUseAs = !defaultShouldForwardProp('as');
|
||||
return function () {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
var args = arguments;
|
||||
var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
|
||||
|
||||
@@ -78,25 +74,20 @@ var createStyled = function createStyled(tag, options) {
|
||||
}
|
||||
|
||||
if (args[0] == null || args[0].raw === undefined) {
|
||||
// eslint-disable-next-line prefer-spread
|
||||
styles.push.apply(styles, args);
|
||||
} else {
|
||||
if (process.env.NODE_ENV !== 'production' && args[0][0] === undefined) {
|
||||
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
|
||||
}
|
||||
var templateStringsArr = args[0];
|
||||
|
||||
styles.push(args[0][0]);
|
||||
styles.push(templateStringsArr[0]);
|
||||
var len = args.length;
|
||||
var i = 1;
|
||||
|
||||
for (; i < len; i++) {
|
||||
if (process.env.NODE_ENV !== 'production' && args[0][i] === undefined) {
|
||||
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
|
||||
}
|
||||
|
||||
styles.push(args[i], args[0][i]);
|
||||
styles.push(args[i], templateStringsArr[i]);
|
||||
}
|
||||
} // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
|
||||
|
||||
}
|
||||
|
||||
var Styled = withEmotionCache(function (props, cache, ref) {
|
||||
var FinalTag = shouldUseAs && props.as || baseTag;
|
||||
@@ -133,14 +124,17 @@ var createStyled = function createStyled(tag, options) {
|
||||
for (var _key in props) {
|
||||
if (shouldUseAs && _key === 'as') continue;
|
||||
|
||||
if ( // $FlowFixMe
|
||||
finalShouldForwardProp(_key)) {
|
||||
if (finalShouldForwardProp(_key)) {
|
||||
newProps[_key] = props[_key];
|
||||
}
|
||||
}
|
||||
|
||||
newProps.className = className;
|
||||
newProps.ref = ref;
|
||||
|
||||
if (ref) {
|
||||
newProps.ref = ref;
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
|
||||
cache: cache,
|
||||
serialized: serialized,
|
||||
@@ -155,19 +149,19 @@ var createStyled = function createStyled(tag, options) {
|
||||
Styled.__emotion_forwardProp = shouldForwardProp;
|
||||
Object.defineProperty(Styled, 'toString', {
|
||||
value: function value() {
|
||||
if (targetClassName === undefined && process.env.NODE_ENV !== 'production') {
|
||||
if (targetClassName === undefined && isDevelopment) {
|
||||
return 'NO_COMPONENT_SELECTOR';
|
||||
} // $FlowFixMe: coerce undefined to string
|
||||
|
||||
}
|
||||
|
||||
return "." + targetClassName;
|
||||
}
|
||||
});
|
||||
|
||||
Styled.withComponent = function (nextTag, nextOptions) {
|
||||
return createStyled(nextTag, _extends({}, options, nextOptions, {
|
||||
var newStyled = createStyled(nextTag, _extends({}, options, nextOptions, {
|
||||
shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
|
||||
})).apply(void 0, styles);
|
||||
}));
|
||||
return newStyled.apply(void 0, styles);
|
||||
};
|
||||
|
||||
return Styled;
|
||||
|
||||
Reference in New Issue
Block a user