init 3
This commit is contained in:
44
node_modules/@emotion/babel-plugin/src/utils/source-maps.js
generated
vendored
Normal file
44
node_modules/@emotion/babel-plugin/src/utils/source-maps.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { SourceMapGenerator } from 'source-map'
|
||||
import convert from 'convert-source-map'
|
||||
|
||||
function getGeneratorOpts(file) {
|
||||
return file.opts.generatorOpts ? file.opts.generatorOpts : file.opts
|
||||
}
|
||||
|
||||
export function makeSourceMapGenerator(file) {
|
||||
const generatorOpts = getGeneratorOpts(file)
|
||||
const filename = generatorOpts.sourceFileName
|
||||
const generator = new SourceMapGenerator({
|
||||
file: filename,
|
||||
sourceRoot: generatorOpts.sourceRoot
|
||||
})
|
||||
|
||||
generator.setSourceContent(filename, file.code)
|
||||
return generator
|
||||
}
|
||||
|
||||
export function getSourceMap(
|
||||
offset /*: {
|
||||
line: number,
|
||||
column: number
|
||||
} */,
|
||||
state
|
||||
) /*: string */ {
|
||||
const generator = makeSourceMapGenerator(state.file)
|
||||
const generatorOpts = getGeneratorOpts(state.file)
|
||||
if (
|
||||
generatorOpts.sourceFileName &&
|
||||
generatorOpts.sourceFileName !== 'unknown'
|
||||
) {
|
||||
generator.addMapping({
|
||||
generated: {
|
||||
line: 1,
|
||||
column: 0
|
||||
},
|
||||
source: generatorOpts.sourceFileName,
|
||||
original: offset
|
||||
})
|
||||
return convert.fromObject(generator).toComment({ multiline: true })
|
||||
}
|
||||
return ''
|
||||
}
|
||||
62
node_modules/@emotion/cache/README.md
generated
vendored
Normal file
62
node_modules/@emotion/cache/README.md
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# @emotion/cache
|
||||
|
||||
### createCache
|
||||
|
||||
`createCache` allows for low level customization of how styles get inserted by emotion. It's intended to be used with the [`<CacheProvider/>`](https://emotion.sh/docs/cache-provider) component to override the default cache, which is created with sensible defaults for most applications.
|
||||
|
||||
```javascript
|
||||
import createCache from '@emotion/cache'
|
||||
|
||||
export const myCache = createCache({
|
||||
key: 'my-prefix-key',
|
||||
stylisPlugins: [
|
||||
/* your plugins here */
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
### Primary use cases
|
||||
|
||||
- Using emotion in embedded contexts such as an `<iframe/>`
|
||||
|
||||
- Setting a [nonce](#nonce-string) on any `<style/>` tag emotion creates for security purposes
|
||||
|
||||
- Using emotion with a developer defined `<style/>` tag
|
||||
|
||||
- Using emotion with custom Stylis plugins
|
||||
|
||||
## Options
|
||||
|
||||
### `nonce`
|
||||
|
||||
`string`
|
||||
|
||||
A nonce that will be set on each style tag that emotion inserts for [Content Security Policies](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
|
||||
|
||||
### `stylisPlugins`
|
||||
|
||||
`Array<Function>`
|
||||
|
||||
A Stylis plugins that will be run by Stylis during preprocessing. [Read the Stylis docs to find out more](https://github.com/thysultan/stylis.js#middleware). This can be used for many purposes such as RTL.
|
||||
|
||||
> Note:
|
||||
>
|
||||
> Prefixer is just a plugin which happens to be put in default `stylisPlugins`. If you plan to use custom `stylisPlugins` and you want to have your styles prefixed automatically you must include prefixer in your custom `stylisPlugins`. You can import `prefixer` from the `stylis` module to do that (`import { prefixer } from 'stylis'`);
|
||||
|
||||
### `key`
|
||||
|
||||
`string (Pattern: [^a-z-])`
|
||||
|
||||
The prefix before class names. It will also be set as the value of the `data-emotion` attribute on the style tags that emotion inserts and it's used in the attribute name that marks style elements in `renderStylesToString` and `renderStylesToNodeStream`. This is **required if using multiple emotion caches in the same app**.
|
||||
|
||||
### `container`
|
||||
|
||||
`Node`
|
||||
|
||||
A DOM node that emotion will insert all of its style tags into. This is useful for inserting styles into iframes or windows.
|
||||
|
||||
### `prepend`
|
||||
|
||||
`boolean`
|
||||
|
||||
A boolean representing whether to prepend rather than append style tags into the specified container DOM node.
|
||||
2
node_modules/@emotion/cache/dist/emotion-cache.edge-light.cjs.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/dist/emotion-cache.edge-light.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import "./emotion-cache.edge-light.cjs.js";
|
||||
export { _default as default } from "./emotion-cache.edge-light.cjs.default.js";
|
||||
1
node_modules/@emotion/memoize/dist/emotion-memoize.cjs.d.ts.map
generated
vendored
Normal file
1
node_modules/@emotion/memoize/dist/emotion-memoize.cjs.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"emotion-memoize.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
||||
1
node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.default.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
exports._default = require("./emotion-react-_isolated-hnrs.edge-light.cjs.js").default;
|
||||
7
node_modules/@emotion/react/dist/declarations/src/jsx-runtime.d.ts
generated
vendored
Normal file
7
node_modules/@emotion/react/dist/declarations/src/jsx-runtime.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as ReactJSXRuntime from 'react/jsx-runtime';
|
||||
export type { EmotionJSX as JSX } from "./jsx-namespace.js";
|
||||
export declare const Fragment: import("react").ExoticComponent<{
|
||||
children?: import("react").ReactNode;
|
||||
}>;
|
||||
export declare const jsx: typeof ReactJSXRuntime.jsx;
|
||||
export declare const jsxs: typeof ReactJSXRuntime.jsxs;
|
||||
2
node_modules/@emotion/react/dist/emotion-react.cjs.d.ts
generated
vendored
Normal file
2
node_modules/@emotion/react/dist/emotion-react.cjs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./declarations/src/index";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1yZWFjdC5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
||||
47
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js
generated
vendored
Normal file
47
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var ReactJSXRuntimeDev = require('react/jsx-dev-runtime');
|
||||
var emotionElement = require('../../dist/emotion-element-25f9958c.browser.cjs.js');
|
||||
require('react');
|
||||
require('@emotion/cache');
|
||||
require('@babel/runtime/helpers/extends');
|
||||
require('@emotion/weak-memoize');
|
||||
require('../../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js');
|
||||
require('hoist-non-react-statics');
|
||||
require('@emotion/utils');
|
||||
require('@emotion/serialize');
|
||||
require('@emotion/use-insertion-effect-with-fallbacks');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var ReactJSXRuntimeDev__namespace = /*#__PURE__*/_interopNamespace(ReactJSXRuntimeDev);
|
||||
|
||||
var Fragment = ReactJSXRuntimeDev__namespace.Fragment;
|
||||
var jsxDEV = function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
||||
if (!emotionElement.hasOwn.call(props, 'css')) {
|
||||
return ReactJSXRuntimeDev__namespace.jsxDEV(type, props, key, isStaticChildren, source, self);
|
||||
}
|
||||
|
||||
return ReactJSXRuntimeDev__namespace.jsxDEV(emotionElement.Emotion, emotionElement.createEmotionProps(type, props), key, isStaticChildren, source, self);
|
||||
};
|
||||
|
||||
exports.Fragment = Fragment;
|
||||
exports.jsxDEV = jsxDEV;
|
||||
2
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.d.ts
generated
vendored
Normal file
2
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "../../dist/declarations/src/jsx-dev-runtime";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1yZWFjdC1qc3gtZGV2LXJ1bnRpbWUuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kaXN0L2RlY2xhcmF0aW9ucy9zcmMvanN4LWRldi1ydW50aW1lLmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
|
||||
4
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs
generated
vendored
Normal file
4
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export {
|
||||
Fragment,
|
||||
jsxDEV
|
||||
} from "./emotion-react-jsx-dev-runtime.cjs.js";
|
||||
4
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs
generated
vendored
Normal file
4
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export {
|
||||
Fragment,
|
||||
jsxDEV
|
||||
} from "./emotion-react-jsx-dev-runtime.development.edge-light.cjs.js";
|
||||
22
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.esm.js
generated
vendored
Normal file
22
node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.esm.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as ReactJSXRuntimeDev from 'react/jsx-dev-runtime';
|
||||
import { h as hasOwn, E as Emotion, c as createEmotionProps } from '../../dist/emotion-element-782f682d.development.esm.js';
|
||||
import 'react';
|
||||
import '@emotion/cache';
|
||||
import '@babel/runtime/helpers/extends';
|
||||
import '@emotion/weak-memoize';
|
||||
import '../../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.esm.js';
|
||||
import 'hoist-non-react-statics';
|
||||
import '@emotion/utils';
|
||||
import '@emotion/serialize';
|
||||
import '@emotion/use-insertion-effect-with-fallbacks';
|
||||
|
||||
var Fragment = ReactJSXRuntimeDev.Fragment;
|
||||
var jsxDEV = function jsxDEV(type, props, key, isStaticChildren, source, self) {
|
||||
if (!hasOwn.call(props, 'css')) {
|
||||
return ReactJSXRuntimeDev.jsxDEV(type, props, key, isStaticChildren, source, self);
|
||||
}
|
||||
|
||||
return ReactJSXRuntimeDev.jsxDEV(Emotion, createEmotionProps(type, props), key, isStaticChildren, source, self);
|
||||
};
|
||||
|
||||
export { Fragment, jsxDEV };
|
||||
72
node_modules/@emotion/react/src/context.tsx
generated
vendored
Normal file
72
node_modules/@emotion/react/src/context.tsx
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import * as React from 'react'
|
||||
import { useContext, forwardRef } from 'react'
|
||||
import createCache, { EmotionCache } from '@emotion/cache'
|
||||
import isDevelopment from '#is-development'
|
||||
import isBrowser from '#is-browser'
|
||||
|
||||
let EmotionCacheContext =
|
||||
/* #__PURE__ */ React.createContext<EmotionCache | null>(
|
||||
// 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 (isDevelopment) {
|
||||
EmotionCacheContext.displayName = 'EmotionCacheContext'
|
||||
}
|
||||
|
||||
export let CacheProvider = EmotionCacheContext.Provider
|
||||
|
||||
export let __unsafe_useEmotionCache = function useEmotionCache() {
|
||||
return useContext(EmotionCacheContext)
|
||||
}
|
||||
|
||||
let withEmotionCache = function withEmotionCache<Props, RefType = any>(
|
||||
func: (
|
||||
props: React.PropsWithoutRef<Props>,
|
||||
context: EmotionCache,
|
||||
ref?: React.ForwardedRef<RefType>
|
||||
) => React.ReactNode
|
||||
):
|
||||
| React.FC<React.PropsWithoutRef<Props> & React.RefAttributes<RefType>>
|
||||
| React.ForwardRefExoticComponent<
|
||||
React.PropsWithoutRef<Props> & React.RefAttributes<RefType>
|
||||
> {
|
||||
return forwardRef<RefType, Props>((props, ref) => {
|
||||
// the cache will never be null in the browser
|
||||
let cache = useContext(EmotionCacheContext)!
|
||||
|
||||
return func(props, cache, ref)
|
||||
})
|
||||
}
|
||||
|
||||
if (!isBrowser) {
|
||||
withEmotionCache = function withEmotionCache(func) {
|
||||
return (props: Parameters<typeof func>[0]) => {
|
||||
let 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 (
|
||||
<EmotionCacheContext.Provider value={cache}>
|
||||
{func(props, cache)}
|
||||
</EmotionCacheContext.Provider>
|
||||
)
|
||||
} else {
|
||||
return func(props, cache)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { withEmotionCache }
|
||||
3
node_modules/@emotion/serialize/dist/emotion-serialize.cjs.mjs
generated
vendored
Normal file
3
node_modules/@emotion/serialize/dist/emotion-serialize.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export {
|
||||
serializeStyles
|
||||
} from "./emotion-serialize.cjs.js";
|
||||
3
node_modules/@emotion/serialize/dist/emotion-serialize.development.cjs.mjs
generated
vendored
Normal file
3
node_modules/@emotion/serialize/dist/emotion-serialize.development.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export {
|
||||
serializeStyles
|
||||
} from "./emotion-serialize.development.cjs.js";
|
||||
451
node_modules/@emotion/serialize/src/index.ts
generated
vendored
Normal file
451
node_modules/@emotion/serialize/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,451 @@
|
||||
import type { RegisteredCache, SerializedStyles } from '@emotion/utils'
|
||||
import hashString from '@emotion/hash'
|
||||
import unitless from '@emotion/unitless'
|
||||
import memoize from '@emotion/memoize'
|
||||
import isDevelopment from '#is-development'
|
||||
import * as CSS from 'csstype'
|
||||
|
||||
export type { RegisteredCache, SerializedStyles }
|
||||
|
||||
type Cursor = {
|
||||
name: string
|
||||
styles: string
|
||||
next?: Cursor
|
||||
}
|
||||
|
||||
export type CSSProperties = CSS.PropertiesFallback<number | string>
|
||||
export type CSSPropertiesWithMultiValues = {
|
||||
[K in keyof CSSProperties]:
|
||||
| CSSProperties[K]
|
||||
| ReadonlyArray<Extract<CSSProperties[K], string>>
|
||||
}
|
||||
|
||||
export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject }
|
||||
|
||||
export interface ArrayCSSInterpolation
|
||||
extends ReadonlyArray<CSSInterpolation> {}
|
||||
|
||||
export type InterpolationPrimitive =
|
||||
| null
|
||||
| undefined
|
||||
| boolean
|
||||
| number
|
||||
| string
|
||||
| ComponentSelector
|
||||
| Keyframes
|
||||
| SerializedStyles
|
||||
| CSSObject
|
||||
|
||||
export type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation
|
||||
|
||||
export interface CSSOthersObject {
|
||||
[propertiesName: string]: CSSInterpolation
|
||||
}
|
||||
|
||||
export interface CSSObject
|
||||
extends CSSPropertiesWithMultiValues,
|
||||
CSSPseudos,
|
||||
CSSOthersObject {}
|
||||
|
||||
export interface ComponentSelector {
|
||||
__emotion_styles: any
|
||||
}
|
||||
|
||||
export type Keyframes = {
|
||||
name: string
|
||||
styles: string
|
||||
anim: number
|
||||
toString: () => string
|
||||
} & string
|
||||
|
||||
export interface ArrayInterpolation<Props = unknown>
|
||||
extends ReadonlyArray<Interpolation<Props>> {}
|
||||
|
||||
export interface FunctionInterpolation<Props = unknown> {
|
||||
(props: Props): Interpolation<Props>
|
||||
}
|
||||
|
||||
export type Interpolation<Props = unknown> =
|
||||
| InterpolationPrimitive
|
||||
| ArrayInterpolation<Props>
|
||||
| FunctionInterpolation<Props>
|
||||
|
||||
const ILLEGAL_ESCAPE_SEQUENCE_ERROR = `You have illegal escape sequence in your template literal, most likely inside content's property value.
|
||||
Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
|
||||
You can read more about this here:
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`
|
||||
|
||||
const UNDEFINED_AS_OBJECT_KEY_ERROR =
|
||||
"You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."
|
||||
|
||||
let hyphenateRegex = /[A-Z]|^ms/g
|
||||
let animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g
|
||||
|
||||
const isCustomProperty = (property: string) => property.charCodeAt(1) === 45
|
||||
const isProcessableValue = (value: Interpolation) =>
|
||||
value != null && typeof value !== 'boolean'
|
||||
|
||||
const processStyleName = /* #__PURE__ */ memoize((styleName: string) =>
|
||||
isCustomProperty(styleName)
|
||||
? styleName
|
||||
: styleName.replace(hyphenateRegex, '-$&').toLowerCase()
|
||||
)
|
||||
|
||||
let processStyleValue = (
|
||||
key: string,
|
||||
value: string | number
|
||||
): string | number => {
|
||||
switch (key) {
|
||||
case 'animation':
|
||||
case 'animationName': {
|
||||
if (typeof value === 'string') {
|
||||
return value.replace(animationRegex, (match, p1, p2) => {
|
||||
cursor = {
|
||||
name: p1,
|
||||
styles: p2,
|
||||
next: cursor
|
||||
}
|
||||
return p1
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
unitless[key as keyof typeof unitless] !== 1 &&
|
||||
!isCustomProperty(key) &&
|
||||
typeof value === 'number' &&
|
||||
value !== 0
|
||||
) {
|
||||
return value + 'px'
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
if (isDevelopment) {
|
||||
let contentValuePattern =
|
||||
/(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/
|
||||
let contentValues = ['normal', 'none', 'initial', 'inherit', 'unset']
|
||||
|
||||
let oldProcessStyleValue = processStyleValue
|
||||
|
||||
let msPattern = /^-ms-/
|
||||
let hyphenPattern = /-(.)/g
|
||||
|
||||
let hyphenatedCache: Record<string, boolean | undefined> = {}
|
||||
|
||||
processStyleValue = (key: string, value: string | number) => {
|
||||
if (key === 'content') {
|
||||
if (
|
||||
typeof value !== 'string' ||
|
||||
(contentValues.indexOf(value) === -1 &&
|
||||
!contentValuePattern.test(value) &&
|
||||
(value.charAt(0) !== value.charAt(value.length - 1) ||
|
||||
(value.charAt(0) !== '"' && value.charAt(0) !== "'")))
|
||||
) {
|
||||
throw new Error(
|
||||
`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${value}"'\``
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const processed = oldProcessStyleValue(key, value)
|
||||
|
||||
if (
|
||||
processed !== '' &&
|
||||
!isCustomProperty(key) &&
|
||||
key.indexOf('-') !== -1 &&
|
||||
hyphenatedCache[key] === undefined
|
||||
) {
|
||||
hyphenatedCache[key] = true
|
||||
console.error(
|
||||
`Using kebab-case for css properties in objects is not supported. Did you mean ${key
|
||||
.replace(msPattern, 'ms-')
|
||||
.replace(hyphenPattern, (str, char) => char.toUpperCase())}?`
|
||||
)
|
||||
}
|
||||
|
||||
return processed
|
||||
}
|
||||
}
|
||||
|
||||
const noComponentSelectorMessage =
|
||||
'Component selectors can only be used in conjunction with ' +
|
||||
'@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' +
|
||||
'compiler transform.'
|
||||
|
||||
function handleInterpolation(
|
||||
mergedProps: unknown | undefined,
|
||||
registered: RegisteredCache | undefined,
|
||||
interpolation: Interpolation
|
||||
): string | number {
|
||||
if (interpolation == null) {
|
||||
return ''
|
||||
}
|
||||
const componentSelector = interpolation as ComponentSelector
|
||||
if (componentSelector.__emotion_styles !== undefined) {
|
||||
if (
|
||||
isDevelopment &&
|
||||
String(componentSelector) === 'NO_COMPONENT_SELECTOR'
|
||||
) {
|
||||
throw new Error(noComponentSelectorMessage)
|
||||
}
|
||||
return componentSelector as unknown as string
|
||||
}
|
||||
|
||||
switch (typeof interpolation) {
|
||||
case 'boolean': {
|
||||
return ''
|
||||
}
|
||||
case 'object': {
|
||||
const keyframes = interpolation as Keyframes
|
||||
if (keyframes.anim === 1) {
|
||||
cursor = {
|
||||
name: keyframes.name,
|
||||
styles: keyframes.styles,
|
||||
next: cursor
|
||||
}
|
||||
|
||||
return keyframes.name
|
||||
}
|
||||
const serializedStyles = interpolation as SerializedStyles
|
||||
if (serializedStyles.styles !== undefined) {
|
||||
let next = serializedStyles.next
|
||||
if (next !== undefined) {
|
||||
// not the most efficient thing ever but this is a pretty rare case
|
||||
// and there will be very few iterations of this generally
|
||||
while (next !== undefined) {
|
||||
cursor = {
|
||||
name: next.name,
|
||||
styles: next.styles,
|
||||
next: cursor
|
||||
}
|
||||
next = next.next
|
||||
}
|
||||
}
|
||||
let styles = `${serializedStyles.styles};`
|
||||
return styles
|
||||
}
|
||||
|
||||
return createStringFromObject(
|
||||
mergedProps,
|
||||
registered,
|
||||
interpolation as ArrayInterpolation | CSSObject
|
||||
)
|
||||
}
|
||||
case 'function': {
|
||||
if (mergedProps !== undefined) {
|
||||
let previousCursor = cursor
|
||||
let result = interpolation(mergedProps)
|
||||
cursor = previousCursor
|
||||
|
||||
return handleInterpolation(mergedProps, registered, result)
|
||||
} else if (isDevelopment) {
|
||||
console.error(
|
||||
'Functions that are interpolated in css calls will be stringified.\n' +
|
||||
'If you want to have a css call based on props, create a function that returns a css call like this\n' +
|
||||
'let dynamicStyle = (props) => css`color: ${props.color}`\n' +
|
||||
'It can be called directly with props or interpolated in a styled call like this\n' +
|
||||
"let SomeComponent = styled('div')`${dynamicStyle}`"
|
||||
)
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'string':
|
||||
if (isDevelopment) {
|
||||
const matched: string[] = []
|
||||
const replaced = interpolation.replace(
|
||||
animationRegex,
|
||||
(_match, _p1, p2) => {
|
||||
const fakeVarName = `animation${matched.length}`
|
||||
matched.push(
|
||||
`const ${fakeVarName} = keyframes\`${p2.replace(
|
||||
/^@keyframes animation-\w+/,
|
||||
''
|
||||
)}\``
|
||||
)
|
||||
return `\${${fakeVarName}}`
|
||||
}
|
||||
)
|
||||
if (matched.length) {
|
||||
console.error(
|
||||
`\`keyframes\` output got interpolated into plain string, please wrap it with \`css\`.
|
||||
|
||||
Instead of doing this:
|
||||
|
||||
${[...matched, `\`${replaced}\``].join('\n')}
|
||||
|
||||
You should wrap it with \`css\` like this:
|
||||
|
||||
css\`${replaced}\``
|
||||
)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
// finalize string values (regular strings and functions interpolated into css calls)
|
||||
const asString = interpolation as string
|
||||
if (registered == null) {
|
||||
return asString
|
||||
}
|
||||
const cached = registered[asString]
|
||||
return cached !== undefined ? cached : asString
|
||||
}
|
||||
|
||||
function createStringFromObject(
|
||||
mergedProps: unknown | undefined,
|
||||
registered: RegisteredCache | undefined,
|
||||
obj: ArrayInterpolation | CSSObject
|
||||
): string {
|
||||
let string = ''
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
for (let i = 0; i < obj.length; i++) {
|
||||
string += `${handleInterpolation(mergedProps, registered, obj[i])};`
|
||||
}
|
||||
} else {
|
||||
for (let key in obj) {
|
||||
let value: unknown = obj[key as never]
|
||||
if (typeof value !== 'object') {
|
||||
const asString = value as string
|
||||
if (registered != null && registered[asString] !== undefined) {
|
||||
string += `${key}{${registered[asString]}}`
|
||||
} else if (isProcessableValue(asString)) {
|
||||
string += `${processStyleName(key)}:${processStyleValue(
|
||||
key,
|
||||
asString
|
||||
)};`
|
||||
}
|
||||
} else {
|
||||
if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {
|
||||
throw new Error(noComponentSelectorMessage)
|
||||
}
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
typeof value[0] === 'string' &&
|
||||
(registered == null || registered[value[0]] === undefined)
|
||||
) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (isProcessableValue(value[i])) {
|
||||
string += `${processStyleName(key)}:${processStyleValue(
|
||||
key,
|
||||
value[i] as string | number
|
||||
)};`
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const interpolated = handleInterpolation(
|
||||
mergedProps,
|
||||
registered,
|
||||
value as Interpolation
|
||||
)
|
||||
switch (key) {
|
||||
case 'animation':
|
||||
case 'animationName': {
|
||||
string += `${processStyleName(key)}:${interpolated};`
|
||||
break
|
||||
}
|
||||
default: {
|
||||
if (isDevelopment && key === 'undefined') {
|
||||
console.error(UNDEFINED_AS_OBJECT_KEY_ERROR)
|
||||
}
|
||||
string += `${key}{${interpolated}}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
let labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g
|
||||
|
||||
// this is the cursor for keyframes
|
||||
// keyframes are stored on the SerializedStyles object as a linked list
|
||||
let cursor: Cursor | undefined
|
||||
|
||||
export function serializeStyles<Props>(
|
||||
args: Array<TemplateStringsArray | Interpolation<Props>>,
|
||||
registered?: RegisteredCache,
|
||||
mergedProps?: Props
|
||||
): SerializedStyles
|
||||
export function serializeStyles(
|
||||
args: Array<TemplateStringsArray | Interpolation<unknown>>,
|
||||
registered?: RegisteredCache,
|
||||
mergedProps?: unknown
|
||||
): SerializedStyles {
|
||||
if (
|
||||
args.length === 1 &&
|
||||
typeof args[0] === 'object' &&
|
||||
args[0] !== null &&
|
||||
(args[0] as SerializedStyles).styles !== undefined
|
||||
) {
|
||||
return args[0] as SerializedStyles
|
||||
}
|
||||
let stringMode = true
|
||||
let styles = ''
|
||||
|
||||
cursor = undefined
|
||||
let strings = args[0]
|
||||
if (strings == null || (strings as TemplateStringsArray).raw === undefined) {
|
||||
stringMode = false
|
||||
styles += handleInterpolation(
|
||||
mergedProps,
|
||||
registered,
|
||||
strings as Interpolation
|
||||
)
|
||||
} else {
|
||||
const asTemplateStringsArr = strings as TemplateStringsArray
|
||||
if (isDevelopment && asTemplateStringsArr[0] === undefined) {
|
||||
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR)
|
||||
}
|
||||
styles += asTemplateStringsArr[0]
|
||||
}
|
||||
// we start at 1 since we've already handled the first arg
|
||||
for (let i = 1; i < args.length; i++) {
|
||||
styles += handleInterpolation(
|
||||
mergedProps,
|
||||
registered,
|
||||
args[i] as Interpolation
|
||||
)
|
||||
if (stringMode) {
|
||||
const templateStringsArr = strings as TemplateStringsArray
|
||||
if (isDevelopment && templateStringsArr[i] === undefined) {
|
||||
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR)
|
||||
}
|
||||
styles += templateStringsArr[i]
|
||||
}
|
||||
}
|
||||
|
||||
// using a global regex with .exec is stateful so lastIndex has to be reset each time
|
||||
labelPattern.lastIndex = 0
|
||||
let identifierName = ''
|
||||
|
||||
let match
|
||||
// https://esbench.com/bench/5b809c2cf2949800a0f61fb5
|
||||
while ((match = labelPattern.exec(styles)) !== null) {
|
||||
identifierName += '-' + match[1]
|
||||
}
|
||||
|
||||
let name = hashString(styles) + identifierName
|
||||
|
||||
if (isDevelopment) {
|
||||
const devStyles = {
|
||||
name,
|
||||
styles,
|
||||
next: cursor,
|
||||
toString() {
|
||||
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."
|
||||
}
|
||||
}
|
||||
return devStyles
|
||||
}
|
||||
return {
|
||||
name,
|
||||
styles,
|
||||
next: cursor
|
||||
}
|
||||
}
|
||||
3
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.mjs
generated
vendored
Normal file
3
node_modules/@emotion/sheet/dist/emotion-sheet.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export {
|
||||
StyleSheet
|
||||
} from "./emotion-sheet.cjs.js";
|
||||
1
node_modules/@emotion/sheet/src/conditions/false.ts
generated
vendored
Normal file
1
node_modules/@emotion/sheet/src/conditions/false.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default false
|
||||
31
node_modules/@emotion/styled/README.md
generated
vendored
Normal file
31
node_modules/@emotion/styled/README.md
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# @emotion/styled
|
||||
|
||||
> The styled API for @emotion/react
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
yarn add @emotion/react @emotion/styled
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import styled from '@emotion/styled'
|
||||
|
||||
let SomeComp = styled.div({
|
||||
color: 'hotpink'
|
||||
})
|
||||
|
||||
let AnotherComp = styled.div`
|
||||
color: ${props => props.color};
|
||||
`
|
||||
|
||||
render(
|
||||
<SomeComp>
|
||||
<AnotherComp color="green" />
|
||||
</SomeComp>
|
||||
)
|
||||
```
|
||||
|
||||
More documentation is available at [https://emotion.sh/docs/styled](https://emotion.sh/docs/styled).
|
||||
1
node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.cjs.default.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
exports._default = require("./emotion-styled-base.browser.cjs.js").default;
|
||||
3
node_modules/@emotion/styled/dist/emotion-styled.cjs.d.ts
generated
vendored
Normal file
3
node_modules/@emotion/styled/dist/emotion-styled.cjs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./declarations/src/index";
|
||||
export { default } from "./declarations/src/index";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1zdHlsZWQuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
||||
1
node_modules/@emotion/styled/dist/emotion-styled.cjs.default.d.ts
generated
vendored
Normal file
1
node_modules/@emotion/styled/dist/emotion-styled.cjs.default.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default as _default } from "./declarations/src/index.js"
|
||||
19
node_modules/@emotion/styled/dist/emotion-styled.development.edge-light.esm.js
generated
vendored
Normal file
19
node_modules/@emotion/styled/dist/emotion-styled.development.edge-light.esm.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import createStyled from '../base/dist/emotion-styled-base.development.edge-light.esm.js';
|
||||
import '@babel/runtime/helpers/extends';
|
||||
import '@emotion/react';
|
||||
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'];
|
||||
|
||||
// bind it to avoid mutating the original function
|
||||
var styled = createStyled.bind(null);
|
||||
tags.forEach(function (tagName) {
|
||||
styled[tagName] = styled(tagName);
|
||||
});
|
||||
|
||||
export { styled as default };
|
||||
42
node_modules/@emotion/styled/src/index.ts
generated
vendored
Normal file
42
node_modules/@emotion/styled/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Theme } from '@emotion/react'
|
||||
import baseStyled from './base'
|
||||
import { ReactJSXIntrinsicElements } from './jsx-namespace'
|
||||
import { tags } from './tags'
|
||||
import {
|
||||
CreateStyledComponent,
|
||||
CreateStyled as BaseCreateStyled
|
||||
} from './types'
|
||||
export type {
|
||||
ArrayInterpolation,
|
||||
ComponentSelector,
|
||||
CSSObject,
|
||||
FunctionInterpolation,
|
||||
Interpolation
|
||||
} from '@emotion/serialize'
|
||||
export type {
|
||||
CreateStyledComponent,
|
||||
FilteringStyledOptions,
|
||||
StyledComponent,
|
||||
StyledOptions
|
||||
} from './types'
|
||||
|
||||
export type StyledTags = {
|
||||
[Tag in keyof ReactJSXIntrinsicElements]: CreateStyledComponent<
|
||||
{
|
||||
theme?: Theme
|
||||
as?: React.ElementType
|
||||
},
|
||||
ReactJSXIntrinsicElements[Tag]
|
||||
>
|
||||
}
|
||||
|
||||
export interface CreateStyled extends BaseCreateStyled, StyledTags {}
|
||||
|
||||
// bind it to avoid mutating the original function
|
||||
const styled = baseStyled.bind(null) as CreateStyled
|
||||
|
||||
tags.forEach(tagName => {
|
||||
;(styled as any)[tagName] = styled(tagName as keyof typeof styled)
|
||||
})
|
||||
|
||||
export default styled
|
||||
3
node_modules/@emotion/unitless/dist/emotion-unitless.cjs.d.ts
generated
vendored
Normal file
3
node_modules/@emotion/unitless/dist/emotion-unitless.cjs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./declarations/src/index";
|
||||
export { default } from "./declarations/src/index";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi11bml0bGVzcy5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
||||
36
node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.cjs.js
generated
vendored
Normal file
36
node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var React = require('react');
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () { return e[k]; }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n["default"] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
||||
|
||||
var syncFallback = function syncFallback(create) {
|
||||
return create();
|
||||
};
|
||||
|
||||
var useInsertionEffect = React__namespace['useInsertion' + 'Effect'] ? React__namespace['useInsertion' + 'Effect'] : false;
|
||||
var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
|
||||
var useInsertionEffectWithLayoutFallback = useInsertionEffect || React__namespace.useLayoutEffect;
|
||||
|
||||
exports.useInsertionEffectAlwaysWithSyncFallback = useInsertionEffectAlwaysWithSyncFallback;
|
||||
exports.useInsertionEffectWithLayoutFallback = useInsertionEffectWithLayoutFallback;
|
||||
1
node_modules/@emotion/use-insertion-effect-with-fallbacks/src/conditions/true.ts
generated
vendored
Normal file
1
node_modules/@emotion/use-insertion-effect-with-fallbacks/src/conditions/true.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default true
|
||||
17
node_modules/@emotion/utils/dist/declarations/src/types.d.ts
generated
vendored
Normal file
17
node_modules/@emotion/utils/dist/declarations/src/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { StyleSheet } from '@emotion/sheet';
|
||||
export type { StyleSheet };
|
||||
export type RegisteredCache = Record<string, string | undefined>;
|
||||
export type SerializedStyles = {
|
||||
name: string;
|
||||
styles: string;
|
||||
next?: SerializedStyles;
|
||||
};
|
||||
export type EmotionCache = {
|
||||
inserted: Record<string, string | true | undefined>;
|
||||
registered: RegisteredCache;
|
||||
sheet: StyleSheet;
|
||||
key: string;
|
||||
compat?: true;
|
||||
nonce?: string;
|
||||
insert: (selector: string, serialized: SerializedStyles, sheet: StyleSheet, shouldCache: boolean) => string | void;
|
||||
};
|
||||
5
node_modules/@emotion/utils/dist/emotion-utils.browser.cjs.mjs
generated
vendored
Normal file
5
node_modules/@emotion/utils/dist/emotion-utils.browser.cjs.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export {
|
||||
getRegisteredStyles,
|
||||
insertStyles,
|
||||
registerStyles
|
||||
} from "./emotion-utils.browser.cjs.js";
|
||||
16
node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js
generated
vendored
Normal file
16
node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
var weakMemoize = function weakMemoize(func) {
|
||||
var cache = new WeakMap();
|
||||
return function (arg) {
|
||||
if (cache.has(arg)) {
|
||||
// Use non-null assertion because we just checked that the cache `has` it
|
||||
// This allows us to remove `undefined` from the return value
|
||||
return cache.get(arg);
|
||||
}
|
||||
|
||||
var ret = func(arg);
|
||||
cache.set(arg, ret);
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
export { weakMemoize as default };
|
||||
Reference in New Issue
Block a user