New source found from dndbeyond.com
This commit is contained in:
Generated
Vendored
-262
@@ -1,262 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { useContext, forwardRef } from 'react';
|
||||
import createCache from '@emotion/cache';
|
||||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import weakMemoize from '@emotion/weak-memoize';
|
||||
import hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';
|
||||
import { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';
|
||||
import { serializeStyles } from '@emotion/serialize';
|
||||
import { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';
|
||||
|
||||
var isBrowser = "object" !== 'undefined';
|
||||
var hasOwn = {}.hasOwnProperty;
|
||||
|
||||
var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
||||
// because this module is primarily intended for the browser and node
|
||||
// but it's also required in react native and similar environments sometimes
|
||||
// and we could have a special build just for that
|
||||
// but this is much easier and the native packages
|
||||
// might use a different theme context in the future anyway
|
||||
typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
|
||||
key: 'css'
|
||||
}) : null);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
EmotionCacheContext.displayName = 'EmotionCacheContext';
|
||||
}
|
||||
|
||||
var CacheProvider = EmotionCacheContext.Provider;
|
||||
var __unsafe_useEmotionCache = function useEmotionCache() {
|
||||
return useContext(EmotionCacheContext);
|
||||
};
|
||||
|
||||
var withEmotionCache = function withEmotionCache(func) {
|
||||
// $FlowFixMe
|
||||
return /*#__PURE__*/forwardRef(function (props, ref) {
|
||||
// the cache will never be null in the browser
|
||||
var cache = useContext(EmotionCacheContext);
|
||||
return func(props, cache, ref);
|
||||
});
|
||||
};
|
||||
|
||||
if (!isBrowser) {
|
||||
withEmotionCache = function withEmotionCache(func) {
|
||||
return function (props) {
|
||||
var cache = useContext(EmotionCacheContext);
|
||||
|
||||
if (cache === null) {
|
||||
// yes, we're potentially creating this on every render
|
||||
// it doesn't actually matter though since it's only on the server
|
||||
// so there will only every be a single render
|
||||
// that could change in the future because of suspense and etc. but for now,
|
||||
// this works and i don't want to optimise for a future thing that we aren't sure about
|
||||
cache = createCache({
|
||||
key: 'css'
|
||||
});
|
||||
return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {
|
||||
value: cache
|
||||
}, func(props, cache));
|
||||
} else {
|
||||
return func(props, cache);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
var ThemeContext = /* #__PURE__ */React.createContext({});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
ThemeContext.displayName = 'EmotionThemeContext';
|
||||
}
|
||||
|
||||
var useTheme = function useTheme() {
|
||||
return React.useContext(ThemeContext);
|
||||
};
|
||||
|
||||
var getTheme = function getTheme(outerTheme, theme) {
|
||||
if (typeof theme === 'function') {
|
||||
var mergedTheme = theme(outerTheme);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) {
|
||||
throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');
|
||||
}
|
||||
|
||||
return mergedTheme;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && (theme == null || typeof theme !== 'object' || Array.isArray(theme))) {
|
||||
throw new Error('[ThemeProvider] Please make your theme prop a plain object');
|
||||
}
|
||||
|
||||
return _extends({}, outerTheme, theme);
|
||||
};
|
||||
|
||||
var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
|
||||
return weakMemoize(function (theme) {
|
||||
return getTheme(outerTheme, theme);
|
||||
});
|
||||
});
|
||||
var ThemeProvider = function ThemeProvider(props) {
|
||||
var theme = React.useContext(ThemeContext);
|
||||
|
||||
if (props.theme !== theme) {
|
||||
theme = createCacheWithTheme(theme)(props.theme);
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
||||
value: theme
|
||||
}, props.children);
|
||||
};
|
||||
function withTheme(Component) {
|
||||
var componentName = Component.displayName || Component.name || 'Component';
|
||||
|
||||
var render = function render(props, ref) {
|
||||
var theme = React.useContext(ThemeContext);
|
||||
return /*#__PURE__*/React.createElement(Component, _extends({
|
||||
theme: theme,
|
||||
ref: ref
|
||||
}, props));
|
||||
}; // $FlowFixMe
|
||||
|
||||
|
||||
var WithTheme = /*#__PURE__*/React.forwardRef(render);
|
||||
WithTheme.displayName = "WithTheme(" + componentName + ")";
|
||||
return hoistNonReactStatics(WithTheme, Component);
|
||||
}
|
||||
|
||||
var getLastPart = function getLastPart(functionName) {
|
||||
// The match may be something like 'Object.createEmotionProps' or
|
||||
// 'Loader.prototype.render'
|
||||
var parts = functionName.split('.');
|
||||
return parts[parts.length - 1];
|
||||
};
|
||||
|
||||
var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
|
||||
// V8
|
||||
var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
|
||||
if (match) return getLastPart(match[1]); // Safari / Firefox
|
||||
|
||||
match = /^([A-Za-z0-9$.]+)@/.exec(line);
|
||||
if (match) return getLastPart(match[1]);
|
||||
return undefined;
|
||||
};
|
||||
|
||||
var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
|
||||
// identifiers, thus we only need to replace what is a valid character for JS,
|
||||
// but not for CSS.
|
||||
|
||||
var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
|
||||
return identifier.replace(/\$/g, '-');
|
||||
};
|
||||
|
||||
var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
|
||||
if (!stackTrace) return undefined;
|
||||
var lines = stackTrace.split('\n');
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
|
||||
|
||||
if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
|
||||
|
||||
if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
|
||||
// uppercase letter
|
||||
|
||||
if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
|
||||
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
|
||||
var createEmotionProps = function createEmotionProps(type, props) {
|
||||
if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
|
||||
props.css.indexOf(':') !== -1) {
|
||||
throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
|
||||
}
|
||||
|
||||
var newProps = {};
|
||||
|
||||
for (var key in props) {
|
||||
if (hasOwn.call(props, key)) {
|
||||
newProps[key] = props[key];
|
||||
}
|
||||
}
|
||||
|
||||
newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
|
||||
// the label hasn't already been computed
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
|
||||
var label = getLabelFromStackTrace(new Error().stack);
|
||||
if (label) newProps[labelPropName] = label;
|
||||
}
|
||||
|
||||
return newProps;
|
||||
};
|
||||
|
||||
var Insertion = function Insertion(_ref) {
|
||||
var cache = _ref.cache,
|
||||
serialized = _ref.serialized,
|
||||
isStringTag = _ref.isStringTag;
|
||||
registerStyles(cache, serialized, isStringTag);
|
||||
useInsertionEffectAlwaysWithSyncFallback(function () {
|
||||
return insertStyles(cache, serialized, isStringTag);
|
||||
});
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
||||
var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
|
||||
// not passing the registered cache to serializeStyles because it would
|
||||
// make certain babel optimisations not possible
|
||||
|
||||
if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
|
||||
cssProp = cache.registered[cssProp];
|
||||
}
|
||||
|
||||
var WrappedComponent = props[typePropName];
|
||||
var registeredStyles = [cssProp];
|
||||
var className = '';
|
||||
|
||||
if (typeof props.className === 'string') {
|
||||
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
|
||||
} else if (props.className != null) {
|
||||
className = props.className + " ";
|
||||
}
|
||||
|
||||
var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
|
||||
|
||||
if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
|
||||
var labelFromStack = props[labelPropName];
|
||||
|
||||
if (labelFromStack) {
|
||||
serialized = serializeStyles([serialized, 'label:' + labelFromStack + ';']);
|
||||
}
|
||||
}
|
||||
|
||||
className += cache.key + "-" + serialized.name;
|
||||
var newProps = {};
|
||||
|
||||
for (var key in props) {
|
||||
if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
|
||||
newProps[key] = props[key];
|
||||
}
|
||||
}
|
||||
|
||||
newProps.ref = ref;
|
||||
newProps.className = className;
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
|
||||
cache: cache,
|
||||
serialized: serialized,
|
||||
isStringTag: typeof WrappedComponent === 'string'
|
||||
}), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Emotion.displayName = 'EmotionCssPropInternal';
|
||||
}
|
||||
|
||||
var Emotion$1 = Emotion;
|
||||
|
||||
export { CacheProvider as C, Emotion$1 as E, ThemeContext as T, __unsafe_useEmotionCache as _, ThemeProvider as a, withTheme as b, createEmotionProps as c, hasOwn as h, isBrowser as i, useTheme as u, withEmotionCache as w };
|
||||
Generated
Vendored
+156
@@ -0,0 +1,156 @@
|
||||
import * as React from 'react';
|
||||
import { useContext, forwardRef } from 'react';
|
||||
import createCache from '@emotion/cache';
|
||||
import _extends from '@babel/runtime/helpers/esm/extends';
|
||||
import weakMemoize from '@emotion/weak-memoize';
|
||||
import hoistNonReactStatics from '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';
|
||||
import { getRegisteredStyles, registerStyles, insertStyles } from '@emotion/utils';
|
||||
import { serializeStyles } from '@emotion/serialize';
|
||||
import { useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';
|
||||
|
||||
var isDevelopment = false;
|
||||
|
||||
var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
||||
// because this module is primarily intended for the browser and node
|
||||
// but it's also required in react native and similar environments sometimes
|
||||
// and we could have a special build just for that
|
||||
// but this is much easier and the native packages
|
||||
// might use a different theme context in the future anyway
|
||||
typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
|
||||
key: 'css'
|
||||
}) : null);
|
||||
|
||||
var CacheProvider = EmotionCacheContext.Provider;
|
||||
var __unsafe_useEmotionCache = function useEmotionCache() {
|
||||
return useContext(EmotionCacheContext);
|
||||
};
|
||||
|
||||
var withEmotionCache = function withEmotionCache(func) {
|
||||
return /*#__PURE__*/forwardRef(function (props, ref) {
|
||||
// the cache will never be null in the browser
|
||||
var cache = useContext(EmotionCacheContext);
|
||||
return func(props, cache, ref);
|
||||
});
|
||||
};
|
||||
|
||||
var ThemeContext = /* #__PURE__ */React.createContext({});
|
||||
|
||||
var useTheme = function useTheme() {
|
||||
return React.useContext(ThemeContext);
|
||||
};
|
||||
|
||||
var getTheme = function getTheme(outerTheme, theme) {
|
||||
if (typeof theme === 'function') {
|
||||
var mergedTheme = theme(outerTheme);
|
||||
|
||||
return mergedTheme;
|
||||
}
|
||||
|
||||
return _extends({}, outerTheme, theme);
|
||||
};
|
||||
|
||||
var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
|
||||
return weakMemoize(function (theme) {
|
||||
return getTheme(outerTheme, theme);
|
||||
});
|
||||
});
|
||||
var ThemeProvider = function ThemeProvider(props) {
|
||||
var theme = React.useContext(ThemeContext);
|
||||
|
||||
if (props.theme !== theme) {
|
||||
theme = createCacheWithTheme(theme)(props.theme);
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
||||
value: theme
|
||||
}, props.children);
|
||||
};
|
||||
function withTheme(Component) {
|
||||
var componentName = Component.displayName || Component.name || 'Component';
|
||||
var WithTheme = /*#__PURE__*/React.forwardRef(function render(props, ref) {
|
||||
var theme = React.useContext(ThemeContext);
|
||||
return /*#__PURE__*/React.createElement(Component, _extends({
|
||||
theme: theme,
|
||||
ref: ref
|
||||
}, props));
|
||||
});
|
||||
WithTheme.displayName = "WithTheme(" + componentName + ")";
|
||||
return hoistNonReactStatics(WithTheme, Component);
|
||||
}
|
||||
|
||||
var hasOwn = {}.hasOwnProperty;
|
||||
|
||||
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
|
||||
var createEmotionProps = function createEmotionProps(type, props) {
|
||||
|
||||
var newProps = {};
|
||||
|
||||
for (var _key in props) {
|
||||
if (hasOwn.call(props, _key)) {
|
||||
newProps[_key] = props[_key];
|
||||
}
|
||||
}
|
||||
|
||||
newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:
|
||||
|
||||
return newProps;
|
||||
};
|
||||
|
||||
var Insertion = function Insertion(_ref) {
|
||||
var cache = _ref.cache,
|
||||
serialized = _ref.serialized,
|
||||
isStringTag = _ref.isStringTag;
|
||||
registerStyles(cache, serialized, isStringTag);
|
||||
useInsertionEffectAlwaysWithSyncFallback(function () {
|
||||
return insertStyles(cache, serialized, isStringTag);
|
||||
});
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
||||
var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
|
||||
// not passing the registered cache to serializeStyles because it would
|
||||
// make certain babel optimisations not possible
|
||||
|
||||
if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
|
||||
cssProp = cache.registered[cssProp];
|
||||
}
|
||||
|
||||
var WrappedComponent = props[typePropName];
|
||||
var registeredStyles = [cssProp];
|
||||
var className = '';
|
||||
|
||||
if (typeof props.className === 'string') {
|
||||
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
|
||||
} else if (props.className != null) {
|
||||
className = props.className + " ";
|
||||
}
|
||||
|
||||
var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
|
||||
|
||||
className += cache.key + "-" + serialized.name;
|
||||
var newProps = {};
|
||||
|
||||
for (var _key2 in props) {
|
||||
if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (!isDevelopment )) {
|
||||
newProps[_key2] = props[_key2];
|
||||
}
|
||||
}
|
||||
|
||||
newProps.className = className;
|
||||
|
||||
if (ref) {
|
||||
newProps.ref = ref;
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
|
||||
cache: cache,
|
||||
serialized: serialized,
|
||||
isStringTag: typeof WrappedComponent === 'string'
|
||||
}), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
|
||||
});
|
||||
|
||||
var Emotion$1 = Emotion;
|
||||
|
||||
export { CacheProvider as C, Emotion$1 as E, ThemeContext as T, __unsafe_useEmotionCache as _, ThemeProvider as a, withTheme as b, createEmotionProps as c, hasOwn as h, isDevelopment as i, useTheme as u, withEmotionCache as w };
|
||||
+16
-213
@@ -1,5 +1,5 @@
|
||||
import { h as hasOwn, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext, i as isBrowser$1 } from './emotion-element-43c6fea0.browser.esm.js';
|
||||
export { C as CacheProvider, T as ThemeContext, a as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, b as withTheme } from './emotion-element-43c6fea0.browser.esm.js';
|
||||
import { h as hasOwn, E as Emotion, c as createEmotionProps, w as withEmotionCache, T as ThemeContext, i as isDevelopment } from './emotion-element-f0de968e.browser.esm.js';
|
||||
export { C as CacheProvider, T as ThemeContext, a as ThemeProvider, _ as __unsafe_useEmotionCache, u as useTheme, w as withEmotionCache, b as withTheme } from './emotion-element-f0de968e.browser.esm.js';
|
||||
import * as React from 'react';
|
||||
import { insertStyles, registerStyles, getRegisteredStyles } from '@emotion/utils';
|
||||
import { useInsertionEffectWithLayoutFallback, useInsertionEffectAlwaysWithSyncFallback } from '@emotion/use-insertion-effect-with-fallbacks';
|
||||
@@ -10,143 +10,11 @@ import '@emotion/weak-memoize';
|
||||
import '../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js';
|
||||
import 'hoist-non-react-statics';
|
||||
|
||||
var pkg = {
|
||||
name: "@emotion/react",
|
||||
version: "11.11.4",
|
||||
main: "dist/emotion-react.cjs.js",
|
||||
module: "dist/emotion-react.esm.js",
|
||||
browser: {
|
||||
"./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
|
||||
},
|
||||
exports: {
|
||||
".": {
|
||||
module: {
|
||||
worker: "./dist/emotion-react.worker.esm.js",
|
||||
browser: "./dist/emotion-react.browser.esm.js",
|
||||
"default": "./dist/emotion-react.esm.js"
|
||||
},
|
||||
"import": "./dist/emotion-react.cjs.mjs",
|
||||
"default": "./dist/emotion-react.cjs.js"
|
||||
},
|
||||
"./jsx-runtime": {
|
||||
module: {
|
||||
worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
|
||||
browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
|
||||
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
|
||||
},
|
||||
"import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
|
||||
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
|
||||
},
|
||||
"./_isolated-hnrs": {
|
||||
module: {
|
||||
worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
|
||||
browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
|
||||
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
|
||||
},
|
||||
"import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
|
||||
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
|
||||
},
|
||||
"./jsx-dev-runtime": {
|
||||
module: {
|
||||
worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
|
||||
browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
|
||||
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
|
||||
},
|
||||
"import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
|
||||
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./types/css-prop": "./types/css-prop.d.ts",
|
||||
"./macro": {
|
||||
types: {
|
||||
"import": "./macro.d.mts",
|
||||
"default": "./macro.d.ts"
|
||||
},
|
||||
"default": "./macro.js"
|
||||
}
|
||||
},
|
||||
types: "types/index.d.ts",
|
||||
files: [
|
||||
"src",
|
||||
"dist",
|
||||
"jsx-runtime",
|
||||
"jsx-dev-runtime",
|
||||
"_isolated-hnrs",
|
||||
"types/*.d.ts",
|
||||
"macro.*"
|
||||
],
|
||||
sideEffects: false,
|
||||
author: "Emotion Contributors",
|
||||
license: "MIT",
|
||||
scripts: {
|
||||
"test:typescript": "dtslint types"
|
||||
},
|
||||
dependencies: {
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@emotion/babel-plugin": "^11.11.0",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/serialize": "^1.1.3",
|
||||
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
|
||||
"@emotion/utils": "^1.2.1",
|
||||
"@emotion/weak-memoize": "^0.3.1",
|
||||
"hoist-non-react-statics": "^3.3.1"
|
||||
},
|
||||
peerDependencies: {
|
||||
react: ">=16.8.0"
|
||||
},
|
||||
peerDependenciesMeta: {
|
||||
"@types/react": {
|
||||
optional: true
|
||||
}
|
||||
},
|
||||
devDependencies: {
|
||||
"@definitelytyped/dtslint": "0.0.112",
|
||||
"@emotion/css": "11.11.2",
|
||||
"@emotion/css-prettifier": "1.1.3",
|
||||
"@emotion/server": "11.11.0",
|
||||
"@emotion/styled": "11.11.0",
|
||||
"html-tag-names": "^1.1.2",
|
||||
react: "16.14.0",
|
||||
"svg-tag-names": "^1.1.1",
|
||||
typescript: "^4.5.5"
|
||||
},
|
||||
repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
|
||||
publishConfig: {
|
||||
access: "public"
|
||||
},
|
||||
"umd:main": "dist/emotion-react.umd.min.js",
|
||||
preconstruct: {
|
||||
entrypoints: [
|
||||
"./index.js",
|
||||
"./jsx-runtime.js",
|
||||
"./jsx-dev-runtime.js",
|
||||
"./_isolated-hnrs.js"
|
||||
],
|
||||
umdName: "emotionReact",
|
||||
exports: {
|
||||
envConditions: [
|
||||
"browser",
|
||||
"worker"
|
||||
],
|
||||
extra: {
|
||||
"./types/css-prop": "./types/css-prop.d.ts",
|
||||
"./macro": {
|
||||
types: {
|
||||
"import": "./macro.d.mts",
|
||||
"default": "./macro.d.ts"
|
||||
},
|
||||
"default": "./macro.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var jsx = function jsx(type, props) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
var args = arguments;
|
||||
|
||||
if (props == null || !hasOwn.call(props, 'css')) {
|
||||
// $FlowFixMe
|
||||
return React.createElement.apply(undefined, args);
|
||||
}
|
||||
|
||||
@@ -157,56 +25,24 @@ var jsx = function jsx(type, props) {
|
||||
|
||||
for (var i = 2; i < argsLength; i++) {
|
||||
createElementArgArray[i] = args[i];
|
||||
} // $FlowFixMe
|
||||
|
||||
}
|
||||
|
||||
return React.createElement.apply(null, createElementArgArray);
|
||||
};
|
||||
|
||||
var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
|
||||
(function (_jsx) {
|
||||
var JSX;
|
||||
|
||||
(function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));
|
||||
})(jsx || (jsx = {}));
|
||||
|
||||
// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
|
||||
// initial client-side render from SSR, use place of hydrating tag
|
||||
|
||||
var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
||||
if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
|
||||
// probably using the custom createElement which
|
||||
// means it will be turned into a className prop
|
||||
// $FlowFixMe I don't really want to add it to the type since it shouldn't be used
|
||||
props.className || props.css)) {
|
||||
console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
|
||||
warnedAboutCssPropForGlobal = true;
|
||||
}
|
||||
|
||||
var styles = props.styles;
|
||||
var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));
|
||||
|
||||
if (!isBrowser$1) {
|
||||
var _ref;
|
||||
|
||||
var serializedNames = serialized.name;
|
||||
var serializedStyles = serialized.styles;
|
||||
var next = serialized.next;
|
||||
|
||||
while (next !== undefined) {
|
||||
serializedNames += ' ' + next.name;
|
||||
serializedStyles += next.styles;
|
||||
next = next.next;
|
||||
}
|
||||
|
||||
var shouldCache = cache.compat === true;
|
||||
var rules = cache.insert("", {
|
||||
name: serializedNames,
|
||||
styles: serializedStyles
|
||||
}, cache.sheet, shouldCache);
|
||||
|
||||
if (shouldCache) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = {
|
||||
__html: rules
|
||||
}, _ref.nonce = cache.sheet.nonce, _ref));
|
||||
} // yes, i know these hooks are used conditionally
|
||||
// but it is based on a constant that will never change at runtime
|
||||
// it's effectively like having two implementations and switching them out
|
||||
// so it's not actually breaking anything
|
||||
@@ -222,8 +58,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
||||
container: cache.sheet.container,
|
||||
speedy: cache.sheet.isSpeedy
|
||||
});
|
||||
var rehydrating = false; // $FlowFixMe
|
||||
|
||||
var rehydrating = false;
|
||||
var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
|
||||
|
||||
if (cache.sheet.tags.length) {
|
||||
@@ -269,10 +104,6 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Global.displayName = 'EmotionGlobal';
|
||||
}
|
||||
|
||||
function css() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
@@ -281,10 +112,9 @@ function css() {
|
||||
return serializeStyles(args);
|
||||
}
|
||||
|
||||
var keyframes = function keyframes() {
|
||||
function keyframes() {
|
||||
var insertable = css.apply(void 0, arguments);
|
||||
var name = "animation-" + insertable.name; // $FlowFixMe
|
||||
|
||||
var name = "animation-" + insertable.name;
|
||||
return {
|
||||
name: name,
|
||||
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
||||
@@ -293,7 +123,7 @@ var keyframes = function keyframes() {
|
||||
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
var classnames = function classnames(args) {
|
||||
var len = args.length;
|
||||
@@ -314,9 +144,6 @@ var classnames = function classnames(args) {
|
||||
if (Array.isArray(arg)) {
|
||||
toAdd = classnames(arg);
|
||||
} else {
|
||||
if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
|
||||
console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.');
|
||||
}
|
||||
|
||||
toAdd = '';
|
||||
|
||||
@@ -375,7 +202,7 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
||||
var serializedArr = [];
|
||||
|
||||
var css = function css() {
|
||||
if (hasRendered && process.env.NODE_ENV !== 'production') {
|
||||
if (hasRendered && isDevelopment) {
|
||||
throw new Error('css can only be used during render');
|
||||
}
|
||||
|
||||
@@ -391,7 +218,7 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
||||
};
|
||||
|
||||
var cx = function cx() {
|
||||
if (hasRendered && process.env.NODE_ENV !== 'production') {
|
||||
if (hasRendered && isDevelopment) {
|
||||
throw new Error('cx can only be used during render');
|
||||
}
|
||||
|
||||
@@ -415,28 +242,4 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
||||
}), ele);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
ClassNames.displayName = 'EmotionClassNames';
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var isBrowser = "object" !== 'undefined'; // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked
|
||||
|
||||
var isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined';
|
||||
|
||||
if (isBrowser && !isTestEnv) {
|
||||
// globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
|
||||
var globalContext = // $FlowIgnore
|
||||
typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
|
||||
: isBrowser ? window : global;
|
||||
var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
|
||||
|
||||
if (globalContext[globalKey]) {
|
||||
console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');
|
||||
}
|
||||
|
||||
globalContext[globalKey] = true;
|
||||
}
|
||||
}
|
||||
|
||||
export { ClassNames, Global, jsx as createElement, css, jsx, keyframes };
|
||||
|
||||
Reference in New Issue
Block a user