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;
|
||||
|
||||
+7
-7
@@ -1,19 +1,19 @@
|
||||
import createStyled from '../base/dist/emotion-styled-base.browser.esm.js';
|
||||
import '@babel/runtime/helpers/extends';
|
||||
import 'react';
|
||||
import '@emotion/is-prop-valid';
|
||||
import '@emotion/react';
|
||||
import '@emotion/utils';
|
||||
import '@emotion/serialize';
|
||||
import '@emotion/use-insertion-effect-with-fallbacks';
|
||||
import '@emotion/utils';
|
||||
import 'react';
|
||||
import '@emotion/is-prop-valid';
|
||||
|
||||
var tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
|
||||
'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
|
||||
|
||||
var newStyled = createStyled.bind();
|
||||
// bind it to avoid mutating the original function
|
||||
var styled = createStyled.bind(null);
|
||||
tags.forEach(function (tagName) {
|
||||
// $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type
|
||||
newStyled[tagName] = newStyled(tagName);
|
||||
styled[tagName] = styled(tagName);
|
||||
});
|
||||
|
||||
export { newStyled as default };
|
||||
export { styled as default };
|
||||
|
||||
Reference in New Issue
Block a user