worked on GarageApp stuff
This commit is contained in:
parent
60aaf17af3
commit
eb606572b0
51919 changed files with 2168177 additions and 18 deletions
21
node_modules/@emotion/babel-plugin/LICENSE
generated
vendored
Normal file
21
node_modules/@emotion/babel-plugin/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Emotion team and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
346
node_modules/@emotion/babel-plugin/README.md
generated
vendored
Normal file
346
node_modules/@emotion/babel-plugin/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,346 @@
|
|||
# @emotion/babel-plugin
|
||||
|
||||
> Babel plugin for the minification and optimization of emotion styles.
|
||||
|
||||
`@emotion/babel-plugin` is highly recommended, but not required in version 8 and
|
||||
above of Emotion.
|
||||
|
||||
## Features
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Feature/Syntax</th>
|
||||
<th>Native</th>
|
||||
<th>Babel Plugin Required</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>css``</code></td>
|
||||
<td align="center">✅</td>
|
||||
<td align="center"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>css(...)</code></td>
|
||||
<td align="center">✅</td>
|
||||
<td align="center"></td>
|
||||
<td>Generally used for object styles.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>components as selectors</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">✅</td>
|
||||
<td>Allows an emotion component to be <a href="https://emotion.sh/docs/styled#targeting-another-emotion-component">used as a CSS selector</a>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Minification</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">✅</td>
|
||||
<td>Any leading/trailing space between properties in your <code>css</code> and <code>styled</code> blocks is removed. This can reduce the size of your final bundle.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dead Code Elimination</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">✅</td>
|
||||
<td>Uglifyjs will use the injected <code>/*#__PURE__*/</code> flag comments to mark your <code>css</code> and <code>styled</code> blocks as candidates for dead code elimination.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Source Maps</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">✅</td>
|
||||
<td>When enabled, navigate directly to the style declaration in your javascript file.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Contextual Class Names</td>
|
||||
<td align="center"></td>
|
||||
<td align="center">✅</td>
|
||||
<td>Generated class names include the name of the variable or component they were defined in.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
const myStyles = css`
|
||||
font-size: 20px;
|
||||
@media (min-width: 420px) {
|
||||
color: blue;
|
||||
${css`
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
`};
|
||||
line-height: 26px;
|
||||
}
|
||||
background: green;
|
||||
${{ backgroundColor: 'hotpink' }};
|
||||
`
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
const myStyles = /* #__PURE__ */ css(
|
||||
'font-size:20px;@media(min-width:420px){color:blue;',
|
||||
/* #__PURE__ */ css('width:96px;height:96px;'),
|
||||
';line-height:26px;}background:green;',
|
||||
{ backgroundColor: 'hotpink' },
|
||||
';'
|
||||
)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add --dev @emotion/babel-plugin
|
||||
```
|
||||
|
||||
or if you prefer npm
|
||||
|
||||
```bash
|
||||
npm install --save-dev @emotion/babel-plugin
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
Without options:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@emotion"]
|
||||
}
|
||||
```
|
||||
|
||||
With options:
|
||||
|
||||
_Defaults Shown_
|
||||
|
||||
```js
|
||||
{
|
||||
"plugins": [
|
||||
[
|
||||
"@emotion",
|
||||
{
|
||||
// sourceMap is on by default but source maps are dead code eliminated in production
|
||||
"sourceMap": true,
|
||||
"autoLabel": "dev-only",
|
||||
"labelFormat": "[local]",
|
||||
"cssPropOptimization": true
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Recommended Setup
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@emotion"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```bash
|
||||
babel --plugins @emotion/babel-plugin script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require('@babel/core').transform('code', {
|
||||
plugins: ['@emotion/babel-plugin']
|
||||
})
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `sourceMap`
|
||||
|
||||
`boolean`, defaults to `true`.
|
||||
|
||||
This option enables the following:
|
||||
|
||||
- Injected source maps for use in browser dev tools
|
||||
|
||||
[**Documentation**](https://emotion.sh/docs/source-maps)
|
||||
|
||||
> Note:
|
||||
>
|
||||
> Source maps are on by default in @emotion/babel-plugin but they will be removed in production builds
|
||||
|
||||
### `autoLabel`
|
||||
|
||||
`'dev-only' | 'always' | 'never'`, defaults to `dev-only`.
|
||||
|
||||
This option enables the following:
|
||||
|
||||
- Automatically adds the `label` property to styles so that class names
|
||||
generated by `css` or `styled` include the name of the variable the result is
|
||||
assigned to.
|
||||
- Please note that non word characters in the variable will be removed
|
||||
(Eg. `iconStyles$1` will become `iconStyles1`) because `$` is not valid
|
||||
[CSS ClassName Selector](https://stackoverflow.com/questions/448981/which-characters-are-valid-in-css-class-names-selectors#449000)
|
||||
|
||||
Each possible value for this option produces different output code:
|
||||
|
||||
- with `dev-only` we optimize the production code, so there are no labels added there, but at the same time we keep labels for development environments,
|
||||
- with `always` we always add labels when possible,
|
||||
- with `never` we disable this entirely and no labels are added.
|
||||
|
||||
#### css
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
const brownStyles = css({ color: 'brown' })
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
const brownStyles = /*#__PURE__*/ css({ color: 'brown' }, 'label:brownStyles;')
|
||||
```
|
||||
|
||||
`brownStyles`'s value would be `css-1q8eu9e-brownStyles`
|
||||
|
||||
### `labelFormat`
|
||||
|
||||
`string`, defaults to `"[local]"`.
|
||||
|
||||
This option only works when `autoLabel` is set to `'dev-only'` or `'always'`. It allows you to
|
||||
define the format of the resulting `label`. The format is defined via string where
|
||||
variable parts are enclosed in square brackets `[]`.
|
||||
For example `labelFormat: "my-classname--[local]"`, where `[local]` will be replaced
|
||||
with the name of the variable the result is assigned to.
|
||||
|
||||
Allowed values:
|
||||
|
||||
- `[local]` - the name of the variable the result of the `css` or `styled` expression is assigned to.
|
||||
- `[filename]` - name of the file (without extension) where `css` or `styled` expression is located.
|
||||
- `[dirname]` - name of the directory containing the file where `css` or `styled` expression is located.
|
||||
|
||||
This format only affects the label property of the expression, meaning that the `css` prefix and hash will
|
||||
be prepended automatically.
|
||||
|
||||
#### css
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
// BrownView.js
|
||||
// autoLabel: 'dev-only'
|
||||
// labelFormat: '[filename]--[local]'
|
||||
const brownStyles = css({ color: 'brown' })
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
const brownStyles = /*#__PURE__*/ css(
|
||||
{ color: 'brown' },
|
||||
'label:BrownView--brownStyles;'
|
||||
)
|
||||
```
|
||||
|
||||
`BrownView--brownStyles`'s value would be `css-hash-BrownView--brownStyles`
|
||||
|
||||
#### styled
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
const H1 = styled.h1({
|
||||
borderRadius: '50%',
|
||||
transition: 'transform 400ms ease-in-out',
|
||||
boxSizing: 'border-box',
|
||||
display: 'flex',
|
||||
':hover': {
|
||||
transform: 'scale(1.2)'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
const H1 = /*#__PURE__*/ styled('h1', {
|
||||
label: 'H1'
|
||||
})({
|
||||
borderRadius: '50%',
|
||||
transition: 'transform 400ms ease-in-out',
|
||||
boxSizing: 'border-box',
|
||||
display: 'flex',
|
||||
':hover': {
|
||||
transform: 'scale(1.2)'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
`H1`'s class name attribute would be `css-hash-H1`
|
||||
|
||||
### `cssPropOptimization`
|
||||
|
||||
`boolean`, defaults to `true`.
|
||||
|
||||
This option assumes that you are using something to make `@emotion/react`'s `jsx` function work for all jsx. If you are not doing so and you do not want such optimizations to occur, disable this option.
|
||||
|
||||
### `importMap`
|
||||
|
||||
This option allows you to tell @emotion/babel-plugin what imports it should look at to determine what it should transform so if you re-export Emotion's exports, you can still use the Babel transforms
|
||||
|
||||
An example file:
|
||||
|
||||
```js
|
||||
import { anotherExport } from 'my-package'
|
||||
import { someExport, thisIsTheJsxExport } from 'some-package'
|
||||
```
|
||||
|
||||
An example config:
|
||||
|
||||
```json
|
||||
{
|
||||
"my-package": {
|
||||
"anotherExport": {
|
||||
"canonicalImport": ["@emotion/styled", "default"],
|
||||
"styledBaseImport": ["my-package/base", "anotherExport"]
|
||||
}
|
||||
},
|
||||
"some-package": {
|
||||
"someExport": {
|
||||
"canonicalImport": ["@emotion/react", "css"]
|
||||
},
|
||||
"thisIsTheJsxExport": {
|
||||
"canonicalImport": ["@emotion/react", "jsx"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Babel Macros
|
||||
|
||||
Instead of using `@emotion/babel-plugin`, you can use emotion with [`babel-plugin-macros`](https://github.com/kentcdodds/babel-plugin-macros). Add `babel-plugin-macros` to your babel config (which is included in Create React App 2.0) and use the imports/packages shown below.
|
||||
|
||||
```jsx
|
||||
import {
|
||||
css,
|
||||
keyframes,
|
||||
injectGlobal,
|
||||
flush,
|
||||
hydrate
|
||||
} from '@emotion/css/macro'
|
||||
import { jsx, css, Global, keyframes } from '@emotion/react/macro'
|
||||
import styled from '@emotion/styled/macro'
|
||||
```
|
||||
1
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-babel-plugin.cjs.js").default;
|
||||
1536
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js
generated
vendored
Normal file
1536
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
4
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.mjs
generated
vendored
Normal file
4
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export {
|
||||
macros
|
||||
} from "./emotion-babel-plugin.cjs.js";
|
||||
export { _default as default } from "./emotion-babel-plugin.cjs.default.js";
|
||||
1522
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js
generated
vendored
Normal file
1522
node_modules/@emotion/babel-plugin/dist/emotion-babel-plugin.esm.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
21
node_modules/@emotion/babel-plugin/node_modules/stylis/LICENSE
generated
vendored
Normal file
21
node_modules/@emotion/babel-plugin/node_modules/stylis/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-present Sultan Tarimo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
161
node_modules/@emotion/babel-plugin/node_modules/stylis/README.md
generated
vendored
Normal file
161
node_modules/@emotion/babel-plugin/node_modules/stylis/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
# STYLIS
|
||||
|
||||
[](https://github.com/thysultan/stylis.js)
|
||||
|
||||
A Light–weight CSS Preprocessor.
|
||||
|
||||
[](https://coveralls.io/github/thysultan/stylis.js)
|
||||
[](https://bundlephobia.com/result?p=stylis)
|
||||
[](https://github.com/thysultan/stylis.js/blob/master/LICENSE)
|
||||
[](https://www.npmjs.com/package/stylis)
|
||||
|
||||
## Installation
|
||||
|
||||
* Use a Direct Download: `<script src=stylis.js></script>`
|
||||
* Use a CDN: `<script src=unpkg.com/stylis></script>`
|
||||
* Use NPM: `npm install stylis --save`
|
||||
|
||||
## Features
|
||||
|
||||
- nesting `a { &:hover {} }`
|
||||
- selector namespacing
|
||||
- vendor prefixing (flex-box, etc...)
|
||||
- minification
|
||||
- esm module compatible
|
||||
- tree-shaking-able
|
||||
|
||||
## Abstract Syntax Structure
|
||||
|
||||
```js
|
||||
const declaration = {
|
||||
value: 'color:red;',
|
||||
type: 'decl',
|
||||
props: 'color',
|
||||
children: 'red',
|
||||
line: 1, column: 1
|
||||
}
|
||||
|
||||
const comment = {
|
||||
value: '/*@noflip*/',
|
||||
type: 'comm',
|
||||
props: '/',
|
||||
children: '@noflip',
|
||||
line: 1, column: 1
|
||||
}
|
||||
|
||||
const ruleset = {
|
||||
value: 'h1,h2',
|
||||
type: 'rule',
|
||||
props: ['h1', 'h2'],
|
||||
children: [/* ... */],
|
||||
line: 1, column: 1
|
||||
}
|
||||
|
||||
const atruleset = {
|
||||
value: '@media (max-width:100), (min-width:100)',
|
||||
type: '@media',
|
||||
props: ['(max-width:100)', '(min-width:100)'],
|
||||
children: [/* ... */],
|
||||
line: 1, column: 1
|
||||
}
|
||||
```
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
import {compile, serialize, stringify} from 'stylis'
|
||||
|
||||
serialize(compile(`h1{all:unset}`), stringify)
|
||||
```
|
||||
|
||||
### Compile
|
||||
|
||||
```js
|
||||
compile('h1{all:unset}') === [{value: 'h1', type: 'rule', props: ['h1'], children: [/* ... */]}]
|
||||
compile('--foo:unset;') === [{value: '--foo:unset;', type: 'decl', props: '--foo', children: 'unset'}]
|
||||
```
|
||||
|
||||
### Tokenize
|
||||
|
||||
```js
|
||||
tokenize('h1 h2 h3 [h4 h5] fn(args) "a b c"') === ['h1', 'h2', 'h3', '[h4 h5]', 'fn', '(args)', '"a b c"']
|
||||
```
|
||||
|
||||
### Serialize
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), stringify)
|
||||
```
|
||||
|
||||
### Vendor Prefixing
|
||||
|
||||
```js
|
||||
import {compile, serialize, stringify, middleware, prefixer } from 'stylis';
|
||||
|
||||
serialize(compile('div{display:flex;}'), middleware([prefixer, stringify]))
|
||||
```
|
||||
|
||||
|
||||
## Middleware
|
||||
|
||||
The middleware helper is a convenient helper utility, that for all intents and purposes you can do without if you intend to implement your own traversal logic. The `stringify` middleware is one such middleware that can be used in conjunction with it.
|
||||
|
||||
Elements passed to middlewares have a `root` property that is the immediate root/parent of the current element **in the compiled output**, so it references the parent in the already expanded CSS-like structure. Elements have also `parent` property that is the immediate parent of the current element **from the input structure** (structure representing the input string).
|
||||
|
||||
### Traversal
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([(element, index, children) => {
|
||||
assert(children === element.root.children && children[index] === element.children)
|
||||
}, stringify])) === 'h1{all:unset;}'
|
||||
```
|
||||
|
||||
The abstract syntax tree also includes an additional `return` property for more niche uses.
|
||||
|
||||
### Prefixing
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([(element, index, children, callback) => {
|
||||
if (element.type === 'decl' && element.props === 'all' && element.children === 'unset')
|
||||
element.return = 'color:red;' + element.value
|
||||
}, stringify])) === 'h1{color:red;all:unset;}'
|
||||
```
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([(element, index, children, callback) => {
|
||||
if (element.type === 'rule' && element.props.indexOf('h1') > -1)
|
||||
return serialize([{...element, props: ['h2', 'h3']}], callback)
|
||||
}, stringify])) === 'h2,h3{all:unset;}h1{all:unset;}'
|
||||
```
|
||||
|
||||
### Reading
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([stringify, (element, index, children) => {
|
||||
assert(element.return === 'h1{all:unset;}')
|
||||
}])) === 'h1{all:unset;color:red;}'
|
||||
```
|
||||
|
||||
The middlewares in [src/Middleware.js](src/Middleware.js) dive into tangible examples of how you might implement a middleware, alternatively you could also create your own middleware system as `compile` returns all the nessessary structure to fork from.
|
||||
|
||||
## Variables
|
||||
|
||||
CSS variables are supported but a note should be made about the exotic use of css variables. The css spec mentions the following
|
||||
|
||||
>The allowed syntax for custom properties is extremely permissive. The <declaration-value> production matches any sequence of one or more tokens, so long as the sequence does not contain <bad-string-token>, <bad-url-token>, unmatched <)-token>, <]-token>, or <}-token>, or top-level <semicolon-token> tokens or <delim-token> tokens with a value of "!".
|
||||
|
||||
That is to say css variables according to the spec allows: `--foo: if(x > 5) this.width = 10;` and while this value is obviously useless as a variable, and would be invalid in any normal property, it still might be read and acted on by JavaScript and this is supported by Stylis, however things become slightly undefined when we start to include the `{` and `}` productions in our use of exotic css variables.
|
||||
|
||||
For example consider the following: `--foo: {};`
|
||||
|
||||
While this is valid CSS and supported. It is unclear what should happen when the rule collides with the implicit block termination rule that allows i.e `h1{color:red}`(notice the omitted semicolon) to also be a valid CSS production. This results in the following contradiction in: `h1{--example: {}` is it to be treated as `h1{--foo:{;}` or `h1{--foo:{}` the later of which is an unterminated block or in the following: `h1{--foo:{} h1{color:red;}` should it be `h1 {--foo:{}h1{color:red;};` where `{}h1{color:red;` is part of the css variable `--foo` and not a new rule or should it be something else?
|
||||
|
||||
Nevertheless Stylis still supports the exotic forms highlighted in the spec, however you should consider it as a general rule to delimit such exotic uses of variables in strings or parentheses i.e: `h1{--foo:'{'}` or `h1{--foo:({)}`.
|
||||
|
||||
## Benchmark
|
||||
|
||||
Stylis is at-least 2X faster than its predecesor.
|
||||
|
||||
### License
|
||||
|
||||
Stylis is [MIT licensed](./LICENSE).
|
||||
2
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/stylis.mjs
generated
vendored
Normal file
2
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/stylis.mjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/stylis.mjs.map
generated
vendored
Normal file
1
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/stylis.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/umd/package.json
generated
vendored
Normal file
1
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/umd/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "type": "commonjs" }
|
||||
2
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/umd/stylis.js
generated
vendored
Normal file
2
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/umd/stylis.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/umd/stylis.js.map
generated
vendored
Normal file
1
node_modules/@emotion/babel-plugin/node_modules/stylis/dist/umd/stylis.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@emotion/babel-plugin/node_modules/stylis/index.js
generated
vendored
Normal file
7
node_modules/@emotion/babel-plugin/node_modules/stylis/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export * from './src/Enum.js'
|
||||
export * from './src/Utility.js'
|
||||
export * from './src/Parser.js'
|
||||
export * from './src/Prefixer.js'
|
||||
export * from './src/Tokenizer.js'
|
||||
export * from './src/Serializer.js'
|
||||
export * from './src/Middleware.js'
|
||||
167
node_modules/@emotion/babel-plugin/node_modules/stylis/package.json
generated
vendored
Normal file
167
node_modules/@emotion/babel-plugin/node_modules/stylis/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
{
|
||||
"name": "stylis",
|
||||
"version": "4.2.0",
|
||||
"license": "MIT",
|
||||
"description": "A Light–weight CSS Preprocessor",
|
||||
"homepage": "https://github.com/thysultan/stylis.js",
|
||||
"author": "Sultan Tarimo <sultantarimo@me.com>",
|
||||
"repository": "https://github.com/thysultan/stylis.js",
|
||||
"bugs": "https://github.com/thysultan/stylis.js/issues",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "dist/umd/stylis.js",
|
||||
"module": "dist/stylis.mjs",
|
||||
"react-native": "./index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./index.js",
|
||||
"require": "./dist/umd/stylis.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist/",
|
||||
"src/"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint ./",
|
||||
"pretest": "npm run lint && npm run build",
|
||||
"test": "nyc npm run spec",
|
||||
"spec": "mocha --harmony --require esm script/setup.js --recursive test",
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "rollup --config script/build.js --configSrc ./",
|
||||
"start": "npm run build -- --watch",
|
||||
"prepare": "npm run build",
|
||||
"postversion": "git push --follow-tags && npm publish",
|
||||
"release-major": "npm version major -m '%s'",
|
||||
"release-minor": "npm version minor -m '%s'",
|
||||
"release-patch": "npm version patch -m '%s'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "4.3.4",
|
||||
"eslint": "6.8.0",
|
||||
"esm": "3.2.25",
|
||||
"mocha": "9.1.1",
|
||||
"nyc": "15.1.0",
|
||||
"rimraf": "3.0.2",
|
||||
"rollup": "1.28.0",
|
||||
"rollup-plugin-size": "0.2.1",
|
||||
"rollup-plugin-terser": "5.1.3",
|
||||
"stylis": "./"
|
||||
},
|
||||
"nyc": {
|
||||
"temp-dir": "./coverage/.nyc_output",
|
||||
"exclude": [
|
||||
"**/dist/",
|
||||
"**/test/",
|
||||
"**/script/"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"esm": {
|
||||
"cjs": true,
|
||||
"cache": false
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"script/",
|
||||
"test/",
|
||||
"dist/",
|
||||
"docs/"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 7,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
"tab",
|
||||
{
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"no-cond-assign": [
|
||||
"off"
|
||||
],
|
||||
"no-redeclare": [
|
||||
"off"
|
||||
],
|
||||
"no-fallthrough": [
|
||||
"off"
|
||||
],
|
||||
"no-console": [
|
||||
"off"
|
||||
],
|
||||
"no-unsafe-finally": [
|
||||
"off"
|
||||
],
|
||||
"no-shadow-restricted-names": [
|
||||
"error"
|
||||
],
|
||||
"no-whitespace-before-property": [
|
||||
"error"
|
||||
],
|
||||
"no-else-return": [
|
||||
"error"
|
||||
],
|
||||
"eol-last": [
|
||||
"error"
|
||||
],
|
||||
"func-call-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"brace-style": [
|
||||
"error",
|
||||
"1tbs",
|
||||
{
|
||||
"allowSingleLine": true
|
||||
}
|
||||
],
|
||||
"require-jsdoc": [
|
||||
"error",
|
||||
{
|
||||
"require": {
|
||||
"FunctionDeclaration": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"no-trailing-spaces": [
|
||||
"error",
|
||||
{
|
||||
"skipBlankLines": true
|
||||
}
|
||||
],
|
||||
"no-constant-condition": [
|
||||
"off"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Enum.js
generated
vendored
Normal file
21
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Enum.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export var MS = '-ms-'
|
||||
export var MOZ = '-moz-'
|
||||
export var WEBKIT = '-webkit-'
|
||||
|
||||
export var COMMENT = 'comm'
|
||||
export var RULESET = 'rule'
|
||||
export var DECLARATION = 'decl'
|
||||
|
||||
export var PAGE = '@page'
|
||||
export var MEDIA = '@media'
|
||||
export var IMPORT = '@import'
|
||||
export var CHARSET = '@charset'
|
||||
export var VIEWPORT = '@viewport'
|
||||
export var SUPPORTS = '@supports'
|
||||
export var DOCUMENT = '@document'
|
||||
export var NAMESPACE = '@namespace'
|
||||
export var KEYFRAMES = '@keyframes'
|
||||
export var FONT_FACE = '@font-face'
|
||||
export var COUNTER_STYLE = '@counter-style'
|
||||
export var FONT_FEATURE_VALUES = '@font-feature-values'
|
||||
export var LAYER = '@layer'
|
||||
108
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Middleware.js
generated
vendored
Normal file
108
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Middleware.js
generated
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'
|
||||
import {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'
|
||||
import {copy, tokenize} from './Tokenizer.js'
|
||||
import {serialize} from './Serializer.js'
|
||||
import {prefix} from './Prefixer.js'
|
||||
|
||||
/**
|
||||
* @param {function[]} collection
|
||||
* @return {function}
|
||||
*/
|
||||
export function middleware (collection) {
|
||||
var length = sizeof(collection)
|
||||
|
||||
return function (element, index, children, callback) {
|
||||
var output = ''
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
output += collection[i](element, index, children, callback) || ''
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {function} callback
|
||||
* @return {function}
|
||||
*/
|
||||
export function rulesheet (callback) {
|
||||
return function (element) {
|
||||
if (!element.root)
|
||||
if (element = element.return)
|
||||
callback(element)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
*/
|
||||
export function prefixer (element, index, children, callback) {
|
||||
if (element.length > -1)
|
||||
if (!element.return)
|
||||
switch (element.type) {
|
||||
case DECLARATION: element.return = prefix(element.value, element.length, children)
|
||||
return
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
|
||||
case RULESET:
|
||||
if (element.length)
|
||||
return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only': case ':read-write':
|
||||
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
|
||||
// :placeholder
|
||||
case '::placeholder':
|
||||
return serialize([
|
||||
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
|
||||
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
|
||||
copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
|
||||
], callback)
|
||||
}
|
||||
|
||||
return ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
*/
|
||||
export function namespace (element) {
|
||||
switch (element.type) {
|
||||
case RULESET:
|
||||
element.props = element.props.map(function (value) {
|
||||
return combine(tokenize(value), function (value, index, children) {
|
||||
switch (charat(value, 0)) {
|
||||
// \f
|
||||
case 12:
|
||||
return substr(value, 1, strlen(value))
|
||||
// \0 ( + > ~
|
||||
case 0: case 40: case 43: case 62: case 126:
|
||||
return value
|
||||
// :
|
||||
case 58:
|
||||
if (children[++index] === 'global')
|
||||
children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
|
||||
// \s
|
||||
case 32:
|
||||
return index === 1 ? '' : value
|
||||
default:
|
||||
switch (index) {
|
||||
case 0: element = value
|
||||
return sizeof(children) > 1 ? '' : value
|
||||
case index = sizeof(children) - 1: case 2:
|
||||
return index === 2 ? value + element + element : value + element
|
||||
default:
|
||||
return value
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
191
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Parser.js
generated
vendored
Normal file
191
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Parser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
import {COMMENT, RULESET, DECLARATION} from './Enum.js'
|
||||
import {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'
|
||||
import {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {object[]}
|
||||
*/
|
||||
export function compile (value) {
|
||||
return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @param {string[]} rule
|
||||
* @param {string[]} rules
|
||||
* @param {string[]} rulesets
|
||||
* @param {number[]} pseudo
|
||||
* @param {number[]} points
|
||||
* @param {string[]} declarations
|
||||
* @return {object}
|
||||
*/
|
||||
export function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
||||
var index = 0
|
||||
var offset = 0
|
||||
var length = pseudo
|
||||
var atrule = 0
|
||||
var property = 0
|
||||
var previous = 0
|
||||
var variable = 1
|
||||
var scanning = 1
|
||||
var ampersand = 1
|
||||
var character = 0
|
||||
var type = ''
|
||||
var props = rules
|
||||
var children = rulesets
|
||||
var reference = rule
|
||||
var characters = type
|
||||
|
||||
while (scanning)
|
||||
switch (previous = character, character = next()) {
|
||||
// (
|
||||
case 40:
|
||||
if (previous != 108 && charat(characters, length - 1) == 58) {
|
||||
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
|
||||
ampersand = -1
|
||||
break
|
||||
}
|
||||
// " ' [
|
||||
case 34: case 39: case 91:
|
||||
characters += delimit(character)
|
||||
break
|
||||
// \t \n \r \s
|
||||
case 9: case 10: case 13: case 32:
|
||||
characters += whitespace(previous)
|
||||
break
|
||||
// \
|
||||
case 92:
|
||||
characters += escaping(caret() - 1, 7)
|
||||
continue
|
||||
// /
|
||||
case 47:
|
||||
switch (peek()) {
|
||||
case 42: case 47:
|
||||
append(comment(commenter(next(), caret()), root, parent), declarations)
|
||||
break
|
||||
default:
|
||||
characters += '/'
|
||||
}
|
||||
break
|
||||
// {
|
||||
case 123 * variable:
|
||||
points[index++] = strlen(characters) * ampersand
|
||||
// } ; \0
|
||||
case 125 * variable: case 59: case 0:
|
||||
switch (character) {
|
||||
// \0 }
|
||||
case 0: case 125: scanning = 0
|
||||
// ;
|
||||
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '')
|
||||
if (property > 0 && (strlen(characters) - length))
|
||||
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
|
||||
break
|
||||
// @ ;
|
||||
case 59: characters += ';'
|
||||
// { rule/at-rule
|
||||
default:
|
||||
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
|
||||
|
||||
if (character === 123)
|
||||
if (offset === 0)
|
||||
parse(characters, root, reference, reference, props, rulesets, length, points, children)
|
||||
else
|
||||
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
||||
// d l m s
|
||||
case 100: case 108: case 109: case 115:
|
||||
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)
|
||||
break
|
||||
default:
|
||||
parse(characters, reference, reference, reference, [''], children, 0, points, children)
|
||||
}
|
||||
}
|
||||
|
||||
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
|
||||
break
|
||||
// :
|
||||
case 58:
|
||||
length = 1 + strlen(characters), property = previous
|
||||
default:
|
||||
if (variable < 1)
|
||||
if (character == 123)
|
||||
--variable
|
||||
else if (character == 125 && variable++ == 0 && prev() == 125)
|
||||
continue
|
||||
|
||||
switch (characters += from(character), character * variable) {
|
||||
// &
|
||||
case 38:
|
||||
ampersand = offset > 0 ? 1 : (characters += '\f', -1)
|
||||
break
|
||||
// ,
|
||||
case 44:
|
||||
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1
|
||||
break
|
||||
// @
|
||||
case 64:
|
||||
// -
|
||||
if (peek() === 45)
|
||||
characters += delimit(next())
|
||||
|
||||
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++
|
||||
break
|
||||
// -
|
||||
case 45:
|
||||
if (previous === 45 && strlen(characters) == 2)
|
||||
variable = 0
|
||||
}
|
||||
}
|
||||
|
||||
return rulesets
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @param {number} index
|
||||
* @param {number} offset
|
||||
* @param {string[]} rules
|
||||
* @param {number[]} points
|
||||
* @param {string} type
|
||||
* @param {string[]} props
|
||||
* @param {string[]} children
|
||||
* @param {number} length
|
||||
* @return {object}
|
||||
*/
|
||||
export function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
|
||||
var post = offset - 1
|
||||
var rule = offset === 0 ? rules : ['']
|
||||
var size = sizeof(rule)
|
||||
|
||||
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
||||
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
||||
if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
|
||||
props[k++] = z
|
||||
|
||||
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @return {object}
|
||||
*/
|
||||
export function comment (value, root, parent) {
|
||||
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @param {number} length
|
||||
* @return {object}
|
||||
*/
|
||||
export function declaration (value, root, parent, length) {
|
||||
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)
|
||||
}
|
||||
145
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Prefixer.js
generated
vendored
Normal file
145
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Prefixer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
import {MS, MOZ, WEBKIT} from './Enum.js'
|
||||
import {hash, charat, strlen, indexof, replace, substr, match} from './Utility.js'
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} length
|
||||
* @param {object[]} children
|
||||
* @return {string}
|
||||
*/
|
||||
export function prefix (value, length, children) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
|
||||
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
|
||||
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
|
||||
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
|
||||
return WEBKIT + value + value
|
||||
// tab-size
|
||||
case 4789:
|
||||
return MOZ + value + value
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
case 5349: case 4246: case 4810: case 6968: case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value
|
||||
// writing-mode
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
|
||||
// vertical-r(l)
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
|
||||
// horizontal(-)tb
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
|
||||
// default: fallthrough to below
|
||||
}
|
||||
// flex, flex-direction, scroll-snap-type, writing-mode
|
||||
case 6828: case 4268: case 2903:
|
||||
return WEBKIT + value + MS + value + value
|
||||
// order
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value
|
||||
// align-items
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
|
||||
// align-self
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/g, '') + (!match(value, /flex-|baseline/) ? MS + 'grid-row-' + replace(value, /flex-|-self/g, '') : '') + value
|
||||
// align-content
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/g, '') + value
|
||||
// flex-shrink
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
|
||||
// flex-basis
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
|
||||
// flex-grow
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
|
||||
// transition
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
|
||||
// cursor
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
|
||||
// background, background-image
|
||||
case 5495: case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
|
||||
// justify-content
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
|
||||
// justify-self
|
||||
case 4200:
|
||||
if (!match(value, /flex-|baseline/)) return MS + 'grid-column-align' + substr(value, length) + value
|
||||
break
|
||||
// grid-template-(columns|rows)
|
||||
case 2592: case 3360:
|
||||
return MS + replace(value, 'template-', '') + value
|
||||
// grid-(row|column)-start
|
||||
case 4384: case 3616:
|
||||
if (children && children.some(function (element, index) { return length = index, match(element.props, /grid-\w+-end/) })) {
|
||||
return ~indexof(value + (children = children[length].value), 'span') ? value : (MS + replace(value, '-start', '') + value + MS + 'grid-row-span:' + (~indexof(children, 'span') ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ';')
|
||||
}
|
||||
return MS + replace(value, '-start', '') + value
|
||||
// grid-(row|column)-end
|
||||
case 4896: case 4128:
|
||||
return (children && children.some(function (element) { return match(element.props, /grid-\w+-start/) })) ? value : MS + replace(replace(value, '-end', '-span'), 'span ', '') + value
|
||||
// (margin|padding)-inline-(start|end)
|
||||
case 4095: case 3583: case 4068: case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
case 8116: case 7059: case 5753: case 5535:
|
||||
case 5445: case 5701: case 4933: case 4677:
|
||||
case 5533: case 5789: case 5021: case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6)
|
||||
switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45)
|
||||
break
|
||||
// (f)ill-available, (f)it-content
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
|
||||
// (s)tretch
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length, children) + value : value
|
||||
}
|
||||
break
|
||||
// grid-(column|row)
|
||||
case 5152: case 5920:
|
||||
return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (MS + a + ':' + b + f) + (c ? (MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })
|
||||
// position: sticky
|
||||
case 4949:
|
||||
// stick(y)?
|
||||
if (charat(value, length + 6) === 121)
|
||||
return replace(value, ':', ':' + WEBKIT) + value
|
||||
break
|
||||
// display: (flex|inline-flex|grid|inline-grid)
|
||||
case 6444:
|
||||
switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
|
||||
// (inline-)?fle(x)
|
||||
case 120:
|
||||
return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
|
||||
// (inline-)?gri(d)
|
||||
case 100:
|
||||
return replace(value, ':', ':' + MS) + value
|
||||
}
|
||||
break
|
||||
// scroll-margin, scroll-margin-(top|right|bottom|left)
|
||||
case 5719: case 2647: case 2135: case 3927: case 2391:
|
||||
return replace(value, 'scroll-', 'scroll-snap-') + value
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
36
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Serializer.js
generated
vendored
Normal file
36
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Serializer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'
|
||||
import {strlen, sizeof} from './Utility.js'
|
||||
|
||||
/**
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function serialize (children, callback) {
|
||||
var output = ''
|
||||
var length = sizeof(children)
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
output += callback(children[i], i, children, callback) || ''
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function stringify (element, index, children, callback) {
|
||||
switch (element.type) {
|
||||
case LAYER: if (element.children.length) break
|
||||
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
||||
case COMMENT: return ''
|
||||
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
||||
case RULESET: element.value = element.props.join(',')
|
||||
}
|
||||
|
||||
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
||||
}
|
||||
246
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Tokenizer.js
generated
vendored
Normal file
246
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Tokenizer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'
|
||||
|
||||
export var line = 1
|
||||
export var column = 1
|
||||
export var length = 0
|
||||
export var position = 0
|
||||
export var character = 0
|
||||
export var characters = ''
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object | null} root
|
||||
* @param {object | null} parent
|
||||
* @param {string} type
|
||||
* @param {string[] | string} props
|
||||
* @param {object[] | string} children
|
||||
* @param {number} length
|
||||
*/
|
||||
export function node (value, root, parent, type, props, children, length) {
|
||||
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} root
|
||||
* @param {object} props
|
||||
* @return {object}
|
||||
*/
|
||||
export function copy (root, props) {
|
||||
return assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function char () {
|
||||
return character
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function prev () {
|
||||
character = position > 0 ? charat(characters, --position) : 0
|
||||
|
||||
if (column--, character === 10)
|
||||
column = 1, line--
|
||||
|
||||
return character
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function next () {
|
||||
character = position < length ? charat(characters, position++) : 0
|
||||
|
||||
if (column++, character === 10)
|
||||
column = 1, line++
|
||||
|
||||
return character
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function peek () {
|
||||
return charat(characters, position)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function caret () {
|
||||
return position
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} begin
|
||||
* @param {number} end
|
||||
* @return {string}
|
||||
*/
|
||||
export function slice (begin, end) {
|
||||
return substr(characters, begin, end)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {number}
|
||||
*/
|
||||
export function token (type) {
|
||||
switch (type) {
|
||||
// \0 \t \n \r \s whitespace token
|
||||
case 0: case 9: case 10: case 13: case 32:
|
||||
return 5
|
||||
// ! + , / > @ ~ isolate token
|
||||
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
|
||||
// ; { } breakpoint token
|
||||
case 59: case 123: case 125:
|
||||
return 4
|
||||
// : accompanied token
|
||||
case 58:
|
||||
return 3
|
||||
// " ' ( [ opening delimit token
|
||||
case 34: case 39: case 40: case 91:
|
||||
return 2
|
||||
// ) ] closing delimit token
|
||||
case 41: case 93:
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {any[]}
|
||||
*/
|
||||
export function alloc (value) {
|
||||
return line = column = 1, length = strlen(characters = value), position = 0, []
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} value
|
||||
* @return {any}
|
||||
*/
|
||||
export function dealloc (value) {
|
||||
return characters = '', value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {string}
|
||||
*/
|
||||
export function delimit (type) {
|
||||
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {string[]}
|
||||
*/
|
||||
export function tokenize (value) {
|
||||
return dealloc(tokenizer(alloc(value)))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {string}
|
||||
*/
|
||||
export function whitespace (type) {
|
||||
while (character = peek())
|
||||
if (character < 33)
|
||||
next()
|
||||
else
|
||||
break
|
||||
|
||||
return token(type) > 2 || token(character) > 3 ? '' : ' '
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} children
|
||||
* @return {string[]}
|
||||
*/
|
||||
export function tokenizer (children) {
|
||||
while (next())
|
||||
switch (token(character)) {
|
||||
case 0: append(identifier(position - 1), children)
|
||||
break
|
||||
case 2: append(delimit(character), children)
|
||||
break
|
||||
default: append(from(character), children)
|
||||
}
|
||||
|
||||
return children
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @param {number} count
|
||||
* @return {string}
|
||||
*/
|
||||
export function escaping (index, count) {
|
||||
while (--count && next())
|
||||
// not 0-9 A-F a-f
|
||||
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
|
||||
break
|
||||
|
||||
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {number}
|
||||
*/
|
||||
export function delimiter (type) {
|
||||
while (next())
|
||||
switch (character) {
|
||||
// ] ) " '
|
||||
case type:
|
||||
return position
|
||||
// " '
|
||||
case 34: case 39:
|
||||
if (type !== 34 && type !== 39)
|
||||
delimiter(character)
|
||||
break
|
||||
// (
|
||||
case 40:
|
||||
if (type === 41)
|
||||
delimiter(type)
|
||||
break
|
||||
// \
|
||||
case 92:
|
||||
next()
|
||||
break
|
||||
}
|
||||
|
||||
return position
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @param {number} index
|
||||
* @return {number}
|
||||
*/
|
||||
export function commenter (type, index) {
|
||||
while (next())
|
||||
// //
|
||||
if (type + character === 47 + 10)
|
||||
break
|
||||
// /*
|
||||
else if (type + character === 42 + 42 && peek() === 47)
|
||||
break
|
||||
|
||||
return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @return {string}
|
||||
*/
|
||||
export function identifier (index) {
|
||||
while (!token(peek()))
|
||||
next()
|
||||
|
||||
return slice(index, position)
|
||||
}
|
||||
115
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Utility.js
generated
vendored
Normal file
115
node_modules/@emotion/babel-plugin/node_modules/stylis/src/Utility.js
generated
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* @param {number}
|
||||
* @return {number}
|
||||
*/
|
||||
export var abs = Math.abs
|
||||
|
||||
/**
|
||||
* @param {number}
|
||||
* @return {string}
|
||||
*/
|
||||
export var from = String.fromCharCode
|
||||
|
||||
/**
|
||||
* @param {object}
|
||||
* @return {object}
|
||||
*/
|
||||
export var assign = Object.assign
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} length
|
||||
* @return {number}
|
||||
*/
|
||||
export function hash (value, length) {
|
||||
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {string}
|
||||
*/
|
||||
export function trim (value) {
|
||||
return value.trim()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {RegExp} pattern
|
||||
* @return {string?}
|
||||
*/
|
||||
export function match (value, pattern) {
|
||||
return (value = pattern.exec(value)) ? value[0] : value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {(string|RegExp)} pattern
|
||||
* @param {string} replacement
|
||||
* @return {string}
|
||||
*/
|
||||
export function replace (value, pattern, replacement) {
|
||||
return value.replace(pattern, replacement)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {string} search
|
||||
* @return {number}
|
||||
*/
|
||||
export function indexof (value, search) {
|
||||
return value.indexOf(search)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} index
|
||||
* @return {number}
|
||||
*/
|
||||
export function charat (value, index) {
|
||||
return value.charCodeAt(index) | 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} begin
|
||||
* @param {number} end
|
||||
* @return {string}
|
||||
*/
|
||||
export function substr (value, begin, end) {
|
||||
return value.slice(begin, end)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {number}
|
||||
*/
|
||||
export function strlen (value) {
|
||||
return value.length
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any[]} value
|
||||
* @return {number}
|
||||
*/
|
||||
export function sizeof (value) {
|
||||
return value.length
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} value
|
||||
* @param {any[]} array
|
||||
* @return {any}
|
||||
*/
|
||||
export function append (value, array) {
|
||||
return array.push(value), value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} array
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function combine (array, callback) {
|
||||
return array.map(callback).join('')
|
||||
}
|
||||
55
node_modules/@emotion/babel-plugin/package.json
generated
vendored
Normal file
55
node_modules/@emotion/babel-plugin/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "@emotion/babel-plugin",
|
||||
"version": "11.13.5",
|
||||
"description": "A recommended babel preprocessing plugin for emotion, The Next Generation of CSS-in-JS.",
|
||||
"main": "dist/emotion-babel-plugin.cjs.js",
|
||||
"module": "dist/emotion-babel-plugin.esm.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"import": "./dist/emotion-babel-plugin.cjs.mjs",
|
||||
"default": "./dist/emotion-babel-plugin.cjs.js"
|
||||
},
|
||||
"module": "./dist/emotion-babel-plugin.esm.js",
|
||||
"import": "./dist/emotion-babel-plugin.cjs.mjs",
|
||||
"default": "./dist/emotion-babel-plugin.cjs.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"lib",
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.16.7",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@emotion/hash": "^0.9.2",
|
||||
"@emotion/memoize": "^0.9.0",
|
||||
"@emotion/serialize": "^1.3.3",
|
||||
"babel-plugin-macros": "^3.1.0",
|
||||
"convert-source-map": "^1.5.0",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"find-root": "^1.1.0",
|
||||
"source-map": "^0.5.7",
|
||||
"stylis": "4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.5",
|
||||
"babel-check-duplicated-nodes": "^1.0.0"
|
||||
},
|
||||
"author": "Kye Hohenberger",
|
||||
"homepage": "https://emotion.sh",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/babel-plugin",
|
||||
"keywords": [
|
||||
"styles",
|
||||
"emotion",
|
||||
"react",
|
||||
"css",
|
||||
"css-in-js"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/emotion-js/emotion/issues"
|
||||
}
|
||||
}
|
||||
182
node_modules/@emotion/babel-plugin/src/core-macro.js
generated
vendored
Normal file
182
node_modules/@emotion/babel-plugin/src/core-macro.js
generated
vendored
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
import {
|
||||
transformExpressionWithStyles,
|
||||
createTransformerMacro,
|
||||
getSourceMap,
|
||||
addImport
|
||||
} from './utils'
|
||||
|
||||
export const transformCssCallExpression = (
|
||||
{ state, babel, path, sourceMap, annotateAsPure = true } /*: {
|
||||
state: *,
|
||||
babel: *,
|
||||
path: *,
|
||||
sourceMap?: string,
|
||||
annotateAsPure?: boolean
|
||||
} */
|
||||
) => {
|
||||
let node = transformExpressionWithStyles({
|
||||
babel,
|
||||
state,
|
||||
path,
|
||||
shouldLabel: true,
|
||||
sourceMap
|
||||
})
|
||||
if (node) {
|
||||
path.replaceWith(node)
|
||||
path.hoist()
|
||||
} else if (annotateAsPure && path.isCallExpression()) {
|
||||
path.addComment('leading', '#__PURE__')
|
||||
}
|
||||
}
|
||||
|
||||
export const transformCsslessArrayExpression = (
|
||||
{ state, babel, path } /*: {
|
||||
babel: *,
|
||||
state: *,
|
||||
path: *
|
||||
} */
|
||||
) => {
|
||||
let t = babel.types
|
||||
let expressionPath = path.get('value.expression')
|
||||
let sourceMap =
|
||||
state.emotionSourceMap && path.node.loc !== undefined
|
||||
? getSourceMap(path.node.loc.start, state)
|
||||
: ''
|
||||
|
||||
expressionPath.replaceWith(
|
||||
t.callExpression(
|
||||
// the name of this identifier doesn't really matter at all
|
||||
// it'll never appear in generated code
|
||||
t.identifier('___shouldNeverAppearCSS'),
|
||||
path.node.value.expression.elements
|
||||
)
|
||||
)
|
||||
|
||||
transformCssCallExpression({
|
||||
babel,
|
||||
state,
|
||||
path: expressionPath,
|
||||
sourceMap,
|
||||
annotateAsPure: false
|
||||
})
|
||||
|
||||
if (t.isCallExpression(expressionPath)) {
|
||||
expressionPath.replaceWith(t.arrayExpression(expressionPath.node.arguments))
|
||||
}
|
||||
}
|
||||
|
||||
export const transformCsslessObjectExpression = (
|
||||
{ state, babel, path, cssImport } /*: {
|
||||
babel: *,
|
||||
state: *,
|
||||
path: *,
|
||||
cssImport: { importSource: string, cssExport: string }
|
||||
} */
|
||||
) => {
|
||||
let t = babel.types
|
||||
let expressionPath = path.get('value.expression')
|
||||
let sourceMap =
|
||||
state.emotionSourceMap && path.node.loc !== undefined
|
||||
? getSourceMap(path.node.loc.start, state)
|
||||
: ''
|
||||
|
||||
expressionPath.replaceWith(
|
||||
t.callExpression(
|
||||
// the name of this identifier doesn't really matter at all
|
||||
// it'll never appear in generated code
|
||||
t.identifier('___shouldNeverAppearCSS'),
|
||||
[path.node.value.expression]
|
||||
)
|
||||
)
|
||||
|
||||
transformCssCallExpression({
|
||||
babel,
|
||||
state,
|
||||
path: expressionPath,
|
||||
sourceMap
|
||||
})
|
||||
|
||||
if (t.isCallExpression(expressionPath)) {
|
||||
expressionPath
|
||||
.get('callee')
|
||||
.replaceWith(
|
||||
addImport(state, cssImport.importSource, cssImport.cssExport, 'css')
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
let cssTransformer = (
|
||||
{ state, babel, reference } /*: {
|
||||
state: any,
|
||||
babel: any,
|
||||
reference: any
|
||||
} */
|
||||
) => {
|
||||
transformCssCallExpression({ babel, state, path: reference.parentPath })
|
||||
}
|
||||
|
||||
let globalTransformer = (
|
||||
{ state, babel, reference, importSource, options } /*: {
|
||||
state: any,
|
||||
babel: any,
|
||||
reference: any,
|
||||
importSource: string,
|
||||
options: { cssExport?: string }
|
||||
} */
|
||||
) => {
|
||||
const t = babel.types
|
||||
|
||||
if (
|
||||
!t.isJSXIdentifier(reference.node) ||
|
||||
!t.isJSXOpeningElement(reference.parentPath.node)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const stylesPropPath = reference.parentPath
|
||||
.get('attributes')
|
||||
.find(p => t.isJSXAttribute(p.node) && p.node.name.name === 'styles')
|
||||
|
||||
if (!stylesPropPath) {
|
||||
return
|
||||
}
|
||||
|
||||
if (t.isJSXExpressionContainer(stylesPropPath.node.value)) {
|
||||
if (t.isArrayExpression(stylesPropPath.node.value.expression)) {
|
||||
transformCsslessArrayExpression({
|
||||
state,
|
||||
babel,
|
||||
path: stylesPropPath
|
||||
})
|
||||
} else if (t.isObjectExpression(stylesPropPath.node.value.expression)) {
|
||||
transformCsslessObjectExpression({
|
||||
state,
|
||||
babel,
|
||||
path: stylesPropPath,
|
||||
cssImport:
|
||||
options.cssExport !== undefined
|
||||
? {
|
||||
importSource,
|
||||
cssExport: options.cssExport
|
||||
}
|
||||
: {
|
||||
importSource: '@emotion/react',
|
||||
cssExport: 'css'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const transformers = {
|
||||
// this is an empty function because this transformer is never called
|
||||
// we don't run any transforms on `jsx` directly
|
||||
// instead we use it as a hint to enable css prop optimization
|
||||
jsx: () => {},
|
||||
css: cssTransformer,
|
||||
Global: globalTransformer
|
||||
}
|
||||
|
||||
export default createTransformerMacro(transformers, {
|
||||
importSource: '@emotion/react'
|
||||
})
|
||||
64
node_modules/@emotion/babel-plugin/src/emotion-macro.js
generated
vendored
Normal file
64
node_modules/@emotion/babel-plugin/src/emotion-macro.js
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { transformExpressionWithStyles, createTransformerMacro } from './utils'
|
||||
|
||||
const isAlreadyTranspiled = path => {
|
||||
if (!path.isCallExpression()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const firstArgPath = path.get('arguments.0')
|
||||
|
||||
if (!firstArgPath) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!firstArgPath.isConditionalExpression()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const alternatePath = firstArgPath.get('alternate')
|
||||
|
||||
if (!alternatePath.isObjectExpression()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const properties = new Set(
|
||||
alternatePath.get('properties').map(p => p.node.key.name)
|
||||
)
|
||||
|
||||
return ['name', 'styles'].every(p => properties.has(p))
|
||||
}
|
||||
|
||||
let createEmotionTransformer =
|
||||
(isPure /*: boolean */) =>
|
||||
(
|
||||
{ state, babel, importSource, reference, importSpecifierName } /*: Object */
|
||||
) => {
|
||||
const path = reference.parentPath
|
||||
|
||||
if (isAlreadyTranspiled(path)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isPure) {
|
||||
path.addComment('leading', '#__PURE__')
|
||||
}
|
||||
|
||||
let node = transformExpressionWithStyles({
|
||||
babel,
|
||||
state,
|
||||
path,
|
||||
shouldLabel: true
|
||||
})
|
||||
if (node) {
|
||||
path.node.arguments[0] = node
|
||||
}
|
||||
}
|
||||
|
||||
export let transformers = {
|
||||
css: createEmotionTransformer(true),
|
||||
injectGlobal: createEmotionTransformer(false),
|
||||
keyframes: createEmotionTransformer(true)
|
||||
}
|
||||
|
||||
export let createEmotionMacro = (importSource /*: string */) =>
|
||||
createTransformerMacro(transformers, { importSource })
|
||||
314
node_modules/@emotion/babel-plugin/src/index.js
generated
vendored
Normal file
314
node_modules/@emotion/babel-plugin/src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
import {
|
||||
createEmotionMacro,
|
||||
transformers as vanillaTransformers
|
||||
} from './emotion-macro'
|
||||
import { createStyledMacro, styledTransformer } from './styled-macro'
|
||||
import coreMacro, {
|
||||
transformers as coreTransformers,
|
||||
transformCsslessArrayExpression,
|
||||
transformCsslessObjectExpression
|
||||
} from './core-macro'
|
||||
import { getStyledOptions, createTransformerMacro } from './utils'
|
||||
|
||||
const getCssExport = (reexported, importSource, mapping) => {
|
||||
const cssExport = Object.keys(mapping).find(localExportName => {
|
||||
const [packageName, exportName] = mapping[localExportName].canonicalImport
|
||||
return packageName === '@emotion/react' && exportName === 'css'
|
||||
})
|
||||
|
||||
if (!cssExport) {
|
||||
throw new Error(
|
||||
`You have specified that '${importSource}' re-exports '${reexported}' from '@emotion/react' but it doesn't also re-export 'css' from '@emotion/react', 'css' is necessary for certain optimisations, please re-export it from '${importSource}'`
|
||||
)
|
||||
}
|
||||
|
||||
return cssExport
|
||||
}
|
||||
|
||||
let webStyledMacro = createStyledMacro({
|
||||
importSource: '@emotion/styled/base',
|
||||
originalImportSource: '@emotion/styled',
|
||||
isWeb: true
|
||||
})
|
||||
let nativeStyledMacro = createStyledMacro({
|
||||
importSource: '@emotion/native',
|
||||
originalImportSource: '@emotion/native',
|
||||
isWeb: false
|
||||
})
|
||||
let primitivesStyledMacro = createStyledMacro({
|
||||
importSource: '@emotion/primitives',
|
||||
originalImportSource: '@emotion/primitives',
|
||||
isWeb: false
|
||||
})
|
||||
let vanillaEmotionMacro = createEmotionMacro('@emotion/css')
|
||||
|
||||
let transformersSource = {
|
||||
'@emotion/css': vanillaTransformers,
|
||||
'@emotion/react': coreTransformers,
|
||||
'@emotion/styled': {
|
||||
default: [
|
||||
styledTransformer,
|
||||
{ styledBaseImport: ['@emotion/styled/base', 'default'], isWeb: true }
|
||||
]
|
||||
},
|
||||
'@emotion/primitives': {
|
||||
default: [styledTransformer, { isWeb: false }]
|
||||
},
|
||||
'@emotion/native': {
|
||||
default: [styledTransformer, { isWeb: false }]
|
||||
}
|
||||
}
|
||||
|
||||
export const macros = {
|
||||
core: coreMacro,
|
||||
nativeStyled: nativeStyledMacro,
|
||||
primitivesStyled: primitivesStyledMacro,
|
||||
webStyled: webStyledMacro,
|
||||
vanillaEmotion: vanillaEmotionMacro
|
||||
}
|
||||
|
||||
/*
|
||||
export type BabelPath = any
|
||||
|
||||
export type EmotionBabelPluginPass = any
|
||||
*/
|
||||
|
||||
const AUTO_LABEL_VALUES = ['dev-only', 'never', 'always']
|
||||
|
||||
export default function (babel, options) {
|
||||
if (
|
||||
options.autoLabel !== undefined &&
|
||||
!AUTO_LABEL_VALUES.includes(options.autoLabel)
|
||||
) {
|
||||
throw new Error(
|
||||
`The 'autoLabel' option must be undefined, or one of the following: ${AUTO_LABEL_VALUES.map(
|
||||
s => `"${s}"`
|
||||
).join(', ')}`
|
||||
)
|
||||
}
|
||||
|
||||
let t = babel.types
|
||||
return {
|
||||
name: '@emotion',
|
||||
// https://github.com/babel/babel/blob/0c97749e0fe8ad845b902e0b23a24b308b0bf05d/packages/babel-plugin-syntax-jsx/src/index.ts#L9-L18
|
||||
manipulateOptions(opts, parserOpts) {
|
||||
const { plugins } = parserOpts
|
||||
|
||||
if (
|
||||
plugins.some(p => {
|
||||
const plugin = Array.isArray(p) ? p[0] : p
|
||||
return plugin === 'typescript' || plugin === 'jsx'
|
||||
})
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
plugins.push('jsx')
|
||||
},
|
||||
visitor: {
|
||||
ImportDeclaration(path, state) {
|
||||
const macro = state.pluginMacros[path.node.source.value]
|
||||
// most of this is from https://github.com/kentcdodds/babel-plugin-macros/blob/main/src/index.js
|
||||
if (macro === undefined) {
|
||||
return
|
||||
}
|
||||
if (t.isImportNamespaceSpecifier(path.node.specifiers[0])) {
|
||||
return
|
||||
}
|
||||
const imports = path.node.specifiers.map(s => ({
|
||||
localName: s.local.name,
|
||||
importedName:
|
||||
s.type === 'ImportDefaultSpecifier' ? 'default' : s.imported.name
|
||||
}))
|
||||
let shouldExit = false
|
||||
let hasReferences = false
|
||||
const referencePathsByImportName = imports.reduce(
|
||||
(byName, { importedName, localName }) => {
|
||||
let binding = path.scope.getBinding(localName)
|
||||
if (!binding) {
|
||||
shouldExit = true
|
||||
return byName
|
||||
}
|
||||
byName[importedName] = binding.referencePaths
|
||||
hasReferences =
|
||||
hasReferences || Boolean(byName[importedName].length)
|
||||
return byName
|
||||
},
|
||||
{}
|
||||
)
|
||||
if (!hasReferences || shouldExit) {
|
||||
return
|
||||
}
|
||||
/**
|
||||
* Other plugins that run before babel-plugin-macros might use path.replace, where a path is
|
||||
* put into its own replacement. Apparently babel does not update the scope after such
|
||||
* an operation. As a remedy, the whole scope is traversed again with an empty "Identifier"
|
||||
* visitor - this makes the problem go away.
|
||||
*
|
||||
* See: https://github.com/kentcdodds/import-all.macro/issues/7
|
||||
*/
|
||||
state.file.scope.path.traverse({
|
||||
Identifier() {}
|
||||
})
|
||||
|
||||
macro({
|
||||
path,
|
||||
references: referencePathsByImportName,
|
||||
state,
|
||||
babel,
|
||||
isEmotionCall: true,
|
||||
isBabelMacrosCall: true
|
||||
})
|
||||
},
|
||||
Program(path, state) {
|
||||
let macros = {}
|
||||
let jsxReactImports /*: Array<{
|
||||
importSource: string,
|
||||
export: string,
|
||||
cssExport: string
|
||||
}> */ = [
|
||||
{ importSource: '@emotion/react', export: 'jsx', cssExport: 'css' }
|
||||
]
|
||||
state.jsxReactImport = jsxReactImports[0]
|
||||
Object.keys(state.opts.importMap || {}).forEach(importSource => {
|
||||
let value = state.opts.importMap[importSource]
|
||||
let transformers = {}
|
||||
Object.keys(value).forEach(localExportName => {
|
||||
let { canonicalImport, ...options } = value[localExportName]
|
||||
let [packageName, exportName] = canonicalImport
|
||||
if (packageName === '@emotion/react' && exportName === 'jsx') {
|
||||
jsxReactImports.push({
|
||||
importSource,
|
||||
export: localExportName,
|
||||
cssExport: getCssExport('jsx', importSource, value)
|
||||
})
|
||||
return
|
||||
}
|
||||
let packageTransformers = transformersSource[packageName]
|
||||
|
||||
if (packageTransformers === undefined) {
|
||||
throw new Error(
|
||||
`There is no transformer for the export '${exportName}' in '${packageName}'`
|
||||
)
|
||||
}
|
||||
|
||||
let extraOptions
|
||||
|
||||
if (packageName === '@emotion/react' && exportName === 'Global') {
|
||||
// this option is not supposed to be set in importMap
|
||||
extraOptions = {
|
||||
cssExport: getCssExport('Global', importSource, value)
|
||||
}
|
||||
} else if (
|
||||
packageName === '@emotion/styled' &&
|
||||
exportName === 'default'
|
||||
) {
|
||||
// this is supposed to override defaultOptions value
|
||||
// and let correct value to be set if coming in options
|
||||
extraOptions = {
|
||||
styledBaseImport: undefined
|
||||
}
|
||||
}
|
||||
|
||||
let [exportTransformer, defaultOptions] = Array.isArray(
|
||||
packageTransformers[exportName]
|
||||
)
|
||||
? packageTransformers[exportName]
|
||||
: [packageTransformers[exportName]]
|
||||
|
||||
transformers[localExportName] = [
|
||||
exportTransformer,
|
||||
{
|
||||
...defaultOptions,
|
||||
...extraOptions,
|
||||
...options
|
||||
}
|
||||
]
|
||||
})
|
||||
macros[importSource] = createTransformerMacro(transformers, {
|
||||
importSource
|
||||
})
|
||||
})
|
||||
state.pluginMacros = {
|
||||
'@emotion/styled': webStyledMacro,
|
||||
'@emotion/react': coreMacro,
|
||||
'@emotion/primitives': primitivesStyledMacro,
|
||||
'@emotion/native': nativeStyledMacro,
|
||||
'@emotion/css': vanillaEmotionMacro,
|
||||
...macros
|
||||
}
|
||||
|
||||
for (const node of path.node.body) {
|
||||
if (t.isImportDeclaration(node)) {
|
||||
let jsxReactImport = jsxReactImports.find(
|
||||
thing =>
|
||||
node.source.value === thing.importSource &&
|
||||
node.specifiers.some(
|
||||
x =>
|
||||
t.isImportSpecifier(x) && x.imported.name === thing.export
|
||||
)
|
||||
)
|
||||
if (jsxReactImport) {
|
||||
state.jsxReactImport = jsxReactImport
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.opts.cssPropOptimization === false) {
|
||||
state.transformCssProp = false
|
||||
} else {
|
||||
state.transformCssProp = true
|
||||
}
|
||||
|
||||
if (state.opts.sourceMap === false) {
|
||||
state.emotionSourceMap = false
|
||||
} else {
|
||||
state.emotionSourceMap = true
|
||||
}
|
||||
},
|
||||
JSXAttribute(path, state) {
|
||||
if (path.node.name.name !== 'css' || !state.transformCssProp) {
|
||||
return
|
||||
}
|
||||
|
||||
if (t.isJSXExpressionContainer(path.node.value)) {
|
||||
if (t.isArrayExpression(path.node.value.expression)) {
|
||||
transformCsslessArrayExpression({
|
||||
state,
|
||||
babel,
|
||||
path
|
||||
})
|
||||
} else if (t.isObjectExpression(path.node.value.expression)) {
|
||||
transformCsslessObjectExpression({
|
||||
state,
|
||||
babel,
|
||||
path,
|
||||
cssImport: state.jsxReactImport
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
CallExpression: {
|
||||
exit(path /*: BabelPath */, state /*: EmotionBabelPluginPass */) {
|
||||
try {
|
||||
if (
|
||||
path.node.callee &&
|
||||
path.node.callee.property &&
|
||||
path.node.callee.property.name === 'withComponent'
|
||||
) {
|
||||
switch (path.node.arguments.length) {
|
||||
case 1:
|
||||
case 2: {
|
||||
path.node.arguments[1] = getStyledOptions(t, path, state)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
throw path.buildCodeFrameError(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
144
node_modules/@emotion/babel-plugin/src/styled-macro.js
generated
vendored
Normal file
144
node_modules/@emotion/babel-plugin/src/styled-macro.js
generated
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
import {
|
||||
transformExpressionWithStyles,
|
||||
getStyledOptions,
|
||||
addImport,
|
||||
createTransformerMacro
|
||||
} from './utils'
|
||||
|
||||
const getReferencedSpecifier = (path, specifierName) => {
|
||||
const specifiers = path.get('specifiers')
|
||||
return specifierName === 'default'
|
||||
? specifiers.find(p => p.isImportDefaultSpecifier())
|
||||
: specifiers.find(p => p.node.local.name === specifierName)
|
||||
}
|
||||
|
||||
export let styledTransformer = (
|
||||
{
|
||||
state,
|
||||
babel,
|
||||
path,
|
||||
importSource,
|
||||
reference,
|
||||
importSpecifierName,
|
||||
options: { styledBaseImport, isWeb }
|
||||
} /*: {
|
||||
state: Object,
|
||||
babel: Object,
|
||||
path: any,
|
||||
importSource: string,
|
||||
importSpecifierName: string,
|
||||
reference: Object,
|
||||
options: { styledBaseImport?: [string, string], isWeb: boolean }
|
||||
} */
|
||||
) => {
|
||||
let t = babel.types
|
||||
|
||||
let getStyledIdentifier = () => {
|
||||
if (
|
||||
!styledBaseImport ||
|
||||
(styledBaseImport[0] === importSource &&
|
||||
styledBaseImport[1] === importSpecifierName)
|
||||
) {
|
||||
return t.cloneNode(reference.node)
|
||||
}
|
||||
|
||||
if (path.node) {
|
||||
const referencedSpecifier = getReferencedSpecifier(
|
||||
path,
|
||||
importSpecifierName
|
||||
)
|
||||
|
||||
if (referencedSpecifier) {
|
||||
referencedSpecifier.remove()
|
||||
}
|
||||
|
||||
if (!path.get('specifiers').length) {
|
||||
path.remove()
|
||||
}
|
||||
}
|
||||
|
||||
const [baseImportSource, baseSpecifierName] = styledBaseImport
|
||||
|
||||
return addImport(state, baseImportSource, baseSpecifierName, 'styled')
|
||||
}
|
||||
let createStyledComponentPath = null
|
||||
if (
|
||||
t.isMemberExpression(reference.parent) &&
|
||||
reference.parent.computed === false
|
||||
) {
|
||||
if (
|
||||
// checks if the first character is lowercase
|
||||
// becasue we don't want to transform the member expression if
|
||||
// it's in primitives/native
|
||||
reference.parent.property.name.charCodeAt(0) > 96
|
||||
) {
|
||||
reference.parentPath.replaceWith(
|
||||
t.callExpression(getStyledIdentifier(), [
|
||||
t.stringLiteral(reference.parent.property.name)
|
||||
])
|
||||
)
|
||||
} else {
|
||||
reference.replaceWith(getStyledIdentifier())
|
||||
}
|
||||
|
||||
createStyledComponentPath = reference.parentPath
|
||||
} else if (
|
||||
reference.parentPath &&
|
||||
t.isCallExpression(reference.parentPath) &&
|
||||
reference.parent.callee === reference.node
|
||||
) {
|
||||
reference.replaceWith(getStyledIdentifier())
|
||||
createStyledComponentPath = reference.parentPath
|
||||
}
|
||||
|
||||
if (!createStyledComponentPath) {
|
||||
return
|
||||
}
|
||||
|
||||
const styledCallLikeWithStylesPath = createStyledComponentPath.parentPath
|
||||
|
||||
let node = transformExpressionWithStyles({
|
||||
path: styledCallLikeWithStylesPath,
|
||||
state,
|
||||
babel,
|
||||
shouldLabel: false
|
||||
})
|
||||
|
||||
if (node && isWeb) {
|
||||
// we know the argument length will be 1 since that's the only time we will have a node since it will be static
|
||||
styledCallLikeWithStylesPath.node.arguments[0] = node
|
||||
}
|
||||
|
||||
styledCallLikeWithStylesPath.addComment('leading', '#__PURE__')
|
||||
|
||||
if (isWeb) {
|
||||
createStyledComponentPath.node.arguments[1] = getStyledOptions(
|
||||
t,
|
||||
createStyledComponentPath,
|
||||
state
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export let createStyledMacro = (
|
||||
{
|
||||
importSource,
|
||||
originalImportSource = importSource,
|
||||
baseImportName = 'default',
|
||||
isWeb
|
||||
} /*: {
|
||||
importSource: string,
|
||||
originalImportSource?: string,
|
||||
baseImportName?: string,
|
||||
isWeb: boolean
|
||||
} */
|
||||
) =>
|
||||
createTransformerMacro(
|
||||
{
|
||||
default: [
|
||||
styledTransformer,
|
||||
{ styledBaseImport: [importSource, baseImportName], isWeb }
|
||||
]
|
||||
},
|
||||
{ importSource: originalImportSource }
|
||||
)
|
||||
30
node_modules/@emotion/babel-plugin/src/utils/add-import.js
generated
vendored
Normal file
30
node_modules/@emotion/babel-plugin/src/utils/add-import.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { addDefault, addNamed } from '@babel/helper-module-imports'
|
||||
|
||||
export function addImport(
|
||||
state,
|
||||
importSource /*: string */,
|
||||
importedSpecifier /*: string */,
|
||||
nameHint /* ?: string */
|
||||
) {
|
||||
let cacheKey = ['import', importSource, importedSpecifier].join(':')
|
||||
if (state[cacheKey] === undefined) {
|
||||
let importIdentifier
|
||||
if (importedSpecifier === 'default') {
|
||||
importIdentifier = addDefault(state.file.path, importSource, { nameHint })
|
||||
} else {
|
||||
importIdentifier = addNamed(
|
||||
state.file.path,
|
||||
importedSpecifier,
|
||||
importSource,
|
||||
{
|
||||
nameHint
|
||||
}
|
||||
)
|
||||
}
|
||||
state[cacheKey] = importIdentifier.name
|
||||
}
|
||||
return {
|
||||
type: 'Identifier',
|
||||
name: state[cacheKey]
|
||||
}
|
||||
}
|
||||
14
node_modules/@emotion/babel-plugin/src/utils/create-node-env-conditional.js
generated
vendored
Normal file
14
node_modules/@emotion/babel-plugin/src/utils/create-node-env-conditional.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
export default function createNodeEnvConditional(t, production, development) {
|
||||
return t.conditionalExpression(
|
||||
t.binaryExpression(
|
||||
'===',
|
||||
t.memberExpression(
|
||||
t.memberExpression(t.identifier('process'), t.identifier('env')),
|
||||
t.identifier('NODE_ENV')
|
||||
),
|
||||
t.stringLiteral('production')
|
||||
),
|
||||
production,
|
||||
development
|
||||
)
|
||||
}
|
||||
102
node_modules/@emotion/babel-plugin/src/utils/get-styled-options.js
generated
vendored
Normal file
102
node_modules/@emotion/babel-plugin/src/utils/get-styled-options.js
generated
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
import { getLabelFromPath } from './label'
|
||||
import { getTargetClassName } from './get-target-class-name'
|
||||
import createNodeEnvConditional from './create-node-env-conditional'
|
||||
|
||||
const getKnownProperties = (t, node) =>
|
||||
new Set(
|
||||
node.properties
|
||||
.filter(n => t.isObjectProperty(n) && !n.computed)
|
||||
.map(n => (t.isIdentifier(n.key) ? n.key.name : n.key.value))
|
||||
)
|
||||
|
||||
const createObjectSpreadLike = (t, file, ...objs) =>
|
||||
t.callExpression(file.addHelper('extends'), [t.objectExpression([]), ...objs])
|
||||
|
||||
export let getStyledOptions = (t, path, state) => {
|
||||
const autoLabel = state.opts.autoLabel || 'dev-only'
|
||||
|
||||
let args = path.node.arguments
|
||||
let optionsArgument = args.length >= 2 ? args[1] : null
|
||||
|
||||
let prodProperties = []
|
||||
let devProperties = null
|
||||
let knownProperties =
|
||||
optionsArgument && t.isObjectExpression(optionsArgument)
|
||||
? getKnownProperties(t, optionsArgument)
|
||||
: new Set()
|
||||
|
||||
if (!knownProperties.has('target')) {
|
||||
prodProperties.push(
|
||||
t.objectProperty(
|
||||
t.identifier('target'),
|
||||
t.stringLiteral(getTargetClassName(state, t))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
let label =
|
||||
autoLabel !== 'never' && !knownProperties.has('label')
|
||||
? getLabelFromPath(path, state, t)
|
||||
: null
|
||||
|
||||
if (label) {
|
||||
const labelNode = t.objectProperty(
|
||||
t.identifier('label'),
|
||||
t.stringLiteral(label)
|
||||
)
|
||||
switch (autoLabel) {
|
||||
case 'always':
|
||||
prodProperties.push(labelNode)
|
||||
break
|
||||
case 'dev-only':
|
||||
devProperties = [labelNode]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (optionsArgument) {
|
||||
// for some reason `.withComponent` transformer gets requeued
|
||||
// so check if this has been already transpiled to avoid double wrapping
|
||||
if (
|
||||
t.isConditionalExpression(optionsArgument) &&
|
||||
t.isBinaryExpression(optionsArgument.test) &&
|
||||
t.buildMatchMemberExpression('process.env.NODE_ENV')(
|
||||
optionsArgument.test.left
|
||||
)
|
||||
) {
|
||||
return optionsArgument
|
||||
}
|
||||
if (!t.isObjectExpression(optionsArgument)) {
|
||||
const prodNode = createObjectSpreadLike(
|
||||
t,
|
||||
state.file,
|
||||
t.objectExpression(prodProperties),
|
||||
optionsArgument
|
||||
)
|
||||
return devProperties
|
||||
? createNodeEnvConditional(
|
||||
t,
|
||||
prodNode,
|
||||
t.cloneNode(
|
||||
createObjectSpreadLike(
|
||||
t,
|
||||
state.file,
|
||||
t.objectExpression(prodProperties.concat(devProperties)),
|
||||
optionsArgument
|
||||
)
|
||||
)
|
||||
)
|
||||
: prodNode
|
||||
}
|
||||
|
||||
prodProperties.unshift(...optionsArgument.properties)
|
||||
}
|
||||
|
||||
return devProperties
|
||||
? createNodeEnvConditional(
|
||||
t,
|
||||
t.objectExpression(prodProperties),
|
||||
t.cloneNode(t.objectExpression(prodProperties.concat(devProperties)))
|
||||
)
|
||||
: t.objectExpression(prodProperties)
|
||||
}
|
||||
51
node_modules/@emotion/babel-plugin/src/utils/get-target-class-name.js
generated
vendored
Normal file
51
node_modules/@emotion/babel-plugin/src/utils/get-target-class-name.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import findRoot from 'find-root'
|
||||
import memoize from '@emotion/memoize'
|
||||
import nodePath from 'path'
|
||||
import hashString from '@emotion/hash'
|
||||
import escapeRegexp from 'escape-string-regexp'
|
||||
|
||||
let hashArray = (arr /*: Array<string> */) => hashString(arr.join(''))
|
||||
|
||||
const unsafeRequire = require
|
||||
|
||||
const getPackageRootPath = memoize(filename => findRoot(filename))
|
||||
|
||||
const separator = new RegExp(escapeRegexp(nodePath.sep), 'g')
|
||||
|
||||
const normalizePath = path => nodePath.normalize(path).replace(separator, '/')
|
||||
|
||||
export function getTargetClassName(state, t) {
|
||||
if (state.emotionTargetClassNameCount === undefined) {
|
||||
state.emotionTargetClassNameCount = 0
|
||||
}
|
||||
|
||||
const hasFilepath =
|
||||
state.file.opts.filename && state.file.opts.filename !== 'unknown'
|
||||
const filename = hasFilepath ? state.file.opts.filename : ''
|
||||
// normalize the file path to ignore folder structure
|
||||
// outside the current node project and arch-specific delimiters
|
||||
let moduleName = ''
|
||||
let rootPath = filename
|
||||
|
||||
try {
|
||||
rootPath = getPackageRootPath(filename)
|
||||
moduleName = unsafeRequire(rootPath + '/package.json').name
|
||||
} catch (err) {}
|
||||
|
||||
const finalPath =
|
||||
filename === rootPath ? 'root' : filename.slice(rootPath.length)
|
||||
|
||||
const positionInFile = state.emotionTargetClassNameCount++
|
||||
|
||||
const stuffToHash = [moduleName]
|
||||
|
||||
if (finalPath) {
|
||||
stuffToHash.push(normalizePath(finalPath))
|
||||
} else {
|
||||
stuffToHash.push(state.file.code)
|
||||
}
|
||||
|
||||
const stableClassName = `e${hashArray(stuffToHash)}${positionInFile}`
|
||||
|
||||
return stableClassName
|
||||
}
|
||||
12
node_modules/@emotion/babel-plugin/src/utils/index.js
generated
vendored
Normal file
12
node_modules/@emotion/babel-plugin/src/utils/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export { getLabelFromPath } from './label'
|
||||
export { getSourceMap } from './source-maps'
|
||||
export { getTargetClassName } from './get-target-class-name'
|
||||
export { simplifyObject } from './object-to-string'
|
||||
export { transformExpressionWithStyles } from './transform-expression-with-styles'
|
||||
export { getStyledOptions } from './get-styled-options'
|
||||
export {
|
||||
appendStringReturningExpressionToArguments,
|
||||
joinStringLiterals
|
||||
} from './strings'
|
||||
export { addImport } from './add-import'
|
||||
export { createTransformerMacro } from './transformer-macro'
|
||||
192
node_modules/@emotion/babel-plugin/src/utils/label.js
generated
vendored
Normal file
192
node_modules/@emotion/babel-plugin/src/utils/label.js
generated
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
import nodePath from 'path'
|
||||
|
||||
/*
|
||||
type LabelFormatOptions = {
|
||||
name: string,
|
||||
path: string
|
||||
}
|
||||
*/
|
||||
|
||||
const invalidClassNameCharacters = /[!"#$%&'()*+,./:;<=>?@[\]^`|}~{]/g
|
||||
|
||||
const sanitizeLabelPart = (labelPart /*: string */) =>
|
||||
labelPart.trim().replace(invalidClassNameCharacters, '-')
|
||||
|
||||
function getLabel(
|
||||
identifierName /* ?: string */,
|
||||
labelFormat /* ?: string | (LabelFormatOptions => string) */,
|
||||
filename /*: string */
|
||||
) {
|
||||
if (!identifierName) return null
|
||||
|
||||
const sanitizedName = sanitizeLabelPart(identifierName)
|
||||
|
||||
if (!labelFormat) {
|
||||
return sanitizedName
|
||||
}
|
||||
|
||||
if (typeof labelFormat === 'function') {
|
||||
return labelFormat({
|
||||
name: sanitizedName,
|
||||
path: filename
|
||||
})
|
||||
}
|
||||
|
||||
const parsedPath = nodePath.parse(filename)
|
||||
let localDirname = nodePath.basename(parsedPath.dir)
|
||||
let localFilename = parsedPath.name
|
||||
|
||||
if (localFilename === 'index') {
|
||||
localFilename = localDirname
|
||||
}
|
||||
|
||||
return labelFormat
|
||||
.replace(/\[local\]/gi, sanitizedName)
|
||||
.replace(/\[filename\]/gi, sanitizeLabelPart(localFilename))
|
||||
.replace(/\[dirname\]/gi, sanitizeLabelPart(localDirname))
|
||||
}
|
||||
|
||||
export function getLabelFromPath(path, state, t) {
|
||||
return getLabel(
|
||||
getIdentifierName(path, t),
|
||||
state.opts.labelFormat,
|
||||
state.file.opts.filename
|
||||
)
|
||||
}
|
||||
|
||||
const getObjPropertyLikeName = (path, t) => {
|
||||
if (
|
||||
(!t.isObjectProperty(path) && !t.isObjectMethod(path)) ||
|
||||
path.node.computed
|
||||
) {
|
||||
return null
|
||||
}
|
||||
if (t.isIdentifier(path.node.key)) {
|
||||
return path.node.key.name
|
||||
}
|
||||
|
||||
if (t.isStringLiteral(path.node.key)) {
|
||||
return path.node.key.value.replace(/\s+/g, '-')
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function getDeclaratorName(path, t) {
|
||||
const parent = path.findParent(
|
||||
p =>
|
||||
p.isVariableDeclarator() ||
|
||||
p.isAssignmentExpression() ||
|
||||
p.isFunctionDeclaration() ||
|
||||
p.isFunctionExpression() ||
|
||||
p.isArrowFunctionExpression() ||
|
||||
p.isObjectProperty() ||
|
||||
p.isObjectMethod()
|
||||
)
|
||||
if (!parent) {
|
||||
return ''
|
||||
}
|
||||
|
||||
// we probably have a css call assigned to a variable
|
||||
// so we'll just return the variable name
|
||||
if (parent.isVariableDeclarator()) {
|
||||
if (t.isIdentifier(parent.node.id)) {
|
||||
return parent.node.id.name
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
if (parent.isAssignmentExpression()) {
|
||||
let { left } = parent.node
|
||||
if (t.isIdentifier(left)) {
|
||||
return left.name
|
||||
}
|
||||
if (t.isMemberExpression(left)) {
|
||||
let memberExpression = left
|
||||
let name = ''
|
||||
while (true) {
|
||||
if (!t.isIdentifier(memberExpression.property)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
name = `${memberExpression.property.name}${name ? `-${name}` : ''}`
|
||||
|
||||
if (t.isIdentifier(memberExpression.object)) {
|
||||
return `${memberExpression.object.name}-${name}`
|
||||
}
|
||||
|
||||
if (!t.isMemberExpression(memberExpression.object)) {
|
||||
return ''
|
||||
}
|
||||
memberExpression = memberExpression.object
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
// we probably have an inline css prop usage
|
||||
if (parent.isFunctionDeclaration()) {
|
||||
return parent.node.id.name || ''
|
||||
}
|
||||
|
||||
if (parent.isFunctionExpression()) {
|
||||
if (parent.node.id) {
|
||||
return parent.node.id.name || ''
|
||||
}
|
||||
return getDeclaratorName(parent, t)
|
||||
}
|
||||
|
||||
if (parent.isArrowFunctionExpression()) {
|
||||
return getDeclaratorName(parent, t)
|
||||
}
|
||||
|
||||
// we could also have an object property
|
||||
const objPropertyLikeName = getObjPropertyLikeName(parent, t)
|
||||
|
||||
if (objPropertyLikeName) {
|
||||
return objPropertyLikeName
|
||||
}
|
||||
|
||||
let variableDeclarator = parent.findParent(p => p.isVariableDeclarator())
|
||||
if (!variableDeclarator || !variableDeclarator.get('id').isIdentifier()) {
|
||||
return ''
|
||||
}
|
||||
return variableDeclarator.node.id.name
|
||||
}
|
||||
|
||||
function getIdentifierName(path, t) {
|
||||
let objPropertyLikeName = getObjPropertyLikeName(path.parentPath, t)
|
||||
|
||||
if (objPropertyLikeName) {
|
||||
return objPropertyLikeName
|
||||
}
|
||||
|
||||
let classOrClassPropertyParent = path.findParent(
|
||||
p => t.isClassProperty(p) || t.isClass(p)
|
||||
)
|
||||
|
||||
if (classOrClassPropertyParent) {
|
||||
if (
|
||||
t.isClassProperty(classOrClassPropertyParent) &&
|
||||
classOrClassPropertyParent.node.computed === false &&
|
||||
t.isIdentifier(classOrClassPropertyParent.node.key)
|
||||
) {
|
||||
return classOrClassPropertyParent.node.key.name
|
||||
}
|
||||
if (
|
||||
t.isClass(classOrClassPropertyParent) &&
|
||||
classOrClassPropertyParent.node.id
|
||||
) {
|
||||
return t.isIdentifier(classOrClassPropertyParent.node.id)
|
||||
? classOrClassPropertyParent.node.id.name
|
||||
: ''
|
||||
}
|
||||
}
|
||||
|
||||
let declaratorName = getDeclaratorName(path, t)
|
||||
// if the name starts with _ it was probably generated by babel so we should ignore it
|
||||
if (declaratorName.charAt(0) === '_') {
|
||||
return ''
|
||||
}
|
||||
return declaratorName
|
||||
}
|
||||
153
node_modules/@emotion/babel-plugin/src/utils/minify.js
generated
vendored
Normal file
153
node_modules/@emotion/babel-plugin/src/utils/minify.js
generated
vendored
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
import { compile } from 'stylis'
|
||||
|
||||
const haveSameLocation = (element1, element2) => {
|
||||
return element1.line === element2.line && element1.column === element2.column
|
||||
}
|
||||
|
||||
const isAutoInsertedRule = element =>
|
||||
element.type === 'rule' &&
|
||||
element.parent &&
|
||||
haveSameLocation(element, element.parent)
|
||||
|
||||
const toInputTree = (elements, tree) => {
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
const element = elements[i]
|
||||
const { parent, children } = element
|
||||
|
||||
if (!parent) {
|
||||
tree.push(element)
|
||||
} else if (!isAutoInsertedRule(element)) {
|
||||
parent.children.push(element)
|
||||
}
|
||||
|
||||
if (Array.isArray(children)) {
|
||||
element.children = []
|
||||
toInputTree(children, tree)
|
||||
}
|
||||
}
|
||||
|
||||
return tree
|
||||
}
|
||||
|
||||
var stringifyTree = elements => {
|
||||
return elements
|
||||
.map(element => {
|
||||
switch (element.type) {
|
||||
case 'import':
|
||||
case 'decl':
|
||||
return element.value
|
||||
case 'comm':
|
||||
// When we encounter a standard multi-line CSS comment and it contains a '@'
|
||||
// character, we keep the comment. Some Stylis plugins, such as
|
||||
// the stylis-rtl via the cssjanus plugin, use this special comment syntax
|
||||
// to control behavior (such as: /* @noflip */). We can do this
|
||||
// with standard CSS comments because they will work with compression,
|
||||
// as opposed to non-standard single-line comments that will break compressed CSS.
|
||||
return element.props === '/' && element.value.includes('@')
|
||||
? element.value
|
||||
: ''
|
||||
case 'rule':
|
||||
return `${element.value.replace(/&\f/g, '&')}{${stringifyTree(
|
||||
element.children
|
||||
)}}`
|
||||
default: {
|
||||
return `${element.value}{${stringifyTree(element.children)}}`
|
||||
}
|
||||
}
|
||||
})
|
||||
.join('')
|
||||
}
|
||||
|
||||
const interleave = (strings /*: Array<*> */, interpolations /*: Array<*> */) =>
|
||||
interpolations.reduce(
|
||||
(array, interp, i) => array.concat([interp], strings[i + 1]),
|
||||
[strings[0]]
|
||||
)
|
||||
|
||||
function getDynamicMatches(str /*: string */) {
|
||||
const re = /xxx(\d+):xxx/gm
|
||||
let match
|
||||
const matches = []
|
||||
while ((match = re.exec(str)) !== null) {
|
||||
if (match !== null) {
|
||||
matches.push({
|
||||
value: match[0],
|
||||
p1: parseInt(match[1], 10),
|
||||
index: match.index
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return matches
|
||||
}
|
||||
|
||||
function replacePlaceholdersWithExpressions(
|
||||
str /*: string */,
|
||||
expressions /*: Array<*> */,
|
||||
t
|
||||
) {
|
||||
const matches = getDynamicMatches(str)
|
||||
if (matches.length === 0) {
|
||||
if (str === '') {
|
||||
return []
|
||||
}
|
||||
return [t.stringLiteral(str)]
|
||||
}
|
||||
const strings = []
|
||||
const finalExpressions = []
|
||||
let cursor = 0
|
||||
|
||||
matches.forEach(({ value, p1, index }, i) => {
|
||||
const preMatch = str.substring(cursor, index)
|
||||
cursor = cursor + preMatch.length + value.length
|
||||
|
||||
if (!preMatch && i === 0) {
|
||||
strings.push(t.stringLiteral(''))
|
||||
} else {
|
||||
strings.push(t.stringLiteral(preMatch))
|
||||
}
|
||||
|
||||
finalExpressions.push(expressions[p1])
|
||||
if (i === matches.length - 1) {
|
||||
strings.push(t.stringLiteral(str.substring(index + value.length)))
|
||||
}
|
||||
})
|
||||
|
||||
return interleave(strings, finalExpressions).filter(
|
||||
(node /*: { value: string } */) => {
|
||||
return node.value !== ''
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function createRawStringFromTemplateLiteral(
|
||||
quasi /*: {
|
||||
quasis: Array<{ value: { cooked: string } }>
|
||||
} */
|
||||
) {
|
||||
let strs = quasi.quasis.map(x => x.value.cooked)
|
||||
|
||||
const src = strs
|
||||
.reduce((arr, str, i) => {
|
||||
arr.push(str)
|
||||
if (i !== strs.length - 1) {
|
||||
arr.push(`xxx${i}:xxx`)
|
||||
}
|
||||
return arr
|
||||
}, [])
|
||||
.join('')
|
||||
.trim()
|
||||
return src
|
||||
}
|
||||
|
||||
export default function minify(path, t) {
|
||||
const quasi = path.node.quasi
|
||||
const raw = createRawStringFromTemplateLiteral(quasi)
|
||||
const minified = stringifyTree(toInputTree(compile(raw), []))
|
||||
const expressions = replacePlaceholdersWithExpressions(
|
||||
minified,
|
||||
quasi.expressions || [],
|
||||
t
|
||||
)
|
||||
path.replaceWith(t.callExpression(path.node.tag, expressions))
|
||||
}
|
||||
39
node_modules/@emotion/babel-plugin/src/utils/object-to-string.js
generated
vendored
Normal file
39
node_modules/@emotion/babel-plugin/src/utils/object-to-string.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { serializeStyles } from '@emotion/serialize'
|
||||
|
||||
// to anyone looking at this, this isn't intended to simplify every single case
|
||||
// it's meant to simplify the most common cases so i don't want to make it especially complex
|
||||
// also, this will be unnecessary when prepack is ready
|
||||
export function simplifyObject(node, t /*: Object */) {
|
||||
let finalString = ''
|
||||
for (let i = 0; i < node.properties.length; i++) {
|
||||
let property = node.properties[i]
|
||||
|
||||
if (
|
||||
!t.isObjectProperty(property) ||
|
||||
property.computed ||
|
||||
(!t.isIdentifier(property.key) && !t.isStringLiteral(property.key)) ||
|
||||
(!t.isStringLiteral(property.value) &&
|
||||
!t.isNumericLiteral(property.value) &&
|
||||
!t.isObjectExpression(property.value))
|
||||
) {
|
||||
return node
|
||||
}
|
||||
|
||||
let key = property.key.name || property.key.value
|
||||
if (key === 'styles') {
|
||||
return node
|
||||
}
|
||||
if (t.isObjectExpression(property.value)) {
|
||||
let simplifiedChild = simplifyObject(property.value, t)
|
||||
if (!t.isStringLiteral(simplifiedChild)) {
|
||||
return node
|
||||
}
|
||||
finalString += `${key}{${simplifiedChild.value}}`
|
||||
continue
|
||||
}
|
||||
let value = property.value.value
|
||||
|
||||
finalString += serializeStyles([{ [key]: value }]).styles
|
||||
}
|
||||
return t.stringLiteral(finalString)
|
||||
}
|
||||
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 ''
|
||||
}
|
||||
60
node_modules/@emotion/babel-plugin/src/utils/strings.js
generated
vendored
Normal file
60
node_modules/@emotion/babel-plugin/src/utils/strings.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import {
|
||||
getTypeScriptMakeTemplateObjectPath,
|
||||
isTaggedTemplateTranspiledByBabel
|
||||
} from './transpiled-output-utils'
|
||||
|
||||
export const appendStringReturningExpressionToArguments = (
|
||||
t,
|
||||
path,
|
||||
expression
|
||||
) => {
|
||||
let lastIndex = path.node.arguments.length - 1
|
||||
let last = path.node.arguments[lastIndex]
|
||||
if (t.isStringLiteral(last)) {
|
||||
if (typeof expression === 'string') {
|
||||
path.node.arguments[lastIndex].value += expression
|
||||
} else {
|
||||
path.node.arguments[lastIndex] = t.binaryExpression('+', last, expression)
|
||||
}
|
||||
} else {
|
||||
const makeTemplateObjectCallPath = getTypeScriptMakeTemplateObjectPath(path)
|
||||
|
||||
if (makeTemplateObjectCallPath) {
|
||||
makeTemplateObjectCallPath.get('arguments').forEach(argPath => {
|
||||
const elements = argPath.get('elements')
|
||||
const lastElement = elements[elements.length - 1]
|
||||
if (typeof expression === 'string') {
|
||||
lastElement.replaceWith(
|
||||
t.stringLiteral(lastElement.node.value + expression)
|
||||
)
|
||||
} else {
|
||||
lastElement.replaceWith(
|
||||
t.binaryExpression('+', lastElement.node, t.cloneNode(expression))
|
||||
)
|
||||
}
|
||||
})
|
||||
} else if (!isTaggedTemplateTranspiledByBabel(path)) {
|
||||
if (typeof expression === 'string') {
|
||||
path.node.arguments.push(t.stringLiteral(expression))
|
||||
} else {
|
||||
path.node.arguments.push(expression)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const joinStringLiterals = (expressions /*: Array<*> */, t) => {
|
||||
return expressions.reduce((finalExpressions, currentExpression, i) => {
|
||||
if (!t.isStringLiteral(currentExpression)) {
|
||||
finalExpressions.push(currentExpression)
|
||||
} else if (
|
||||
t.isStringLiteral(finalExpressions[finalExpressions.length - 1])
|
||||
) {
|
||||
finalExpressions[finalExpressions.length - 1].value +=
|
||||
currentExpression.value
|
||||
} else {
|
||||
finalExpressions.push(currentExpression)
|
||||
}
|
||||
return finalExpressions
|
||||
}, [])
|
||||
}
|
||||
144
node_modules/@emotion/babel-plugin/src/utils/transform-expression-with-styles.js
generated
vendored
Normal file
144
node_modules/@emotion/babel-plugin/src/utils/transform-expression-with-styles.js
generated
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
import { serializeStyles } from '@emotion/serialize'
|
||||
import minify from './minify'
|
||||
import { getLabelFromPath } from './label'
|
||||
import { getSourceMap } from './source-maps'
|
||||
import { simplifyObject } from './object-to-string'
|
||||
import {
|
||||
appendStringReturningExpressionToArguments,
|
||||
joinStringLiterals
|
||||
} from './strings'
|
||||
import createNodeEnvConditional from './create-node-env-conditional'
|
||||
|
||||
const CSS_OBJECT_STRINGIFIED_ERROR =
|
||||
"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)."
|
||||
|
||||
export let transformExpressionWithStyles = (
|
||||
{ babel, state, path, shouldLabel, sourceMap = '' } /*: {
|
||||
babel,
|
||||
state,
|
||||
path,
|
||||
shouldLabel: boolean,
|
||||
sourceMap?: string
|
||||
} */
|
||||
) => {
|
||||
const autoLabel = state.opts.autoLabel || 'dev-only'
|
||||
let t = babel.types
|
||||
if (t.isTaggedTemplateExpression(path)) {
|
||||
if (
|
||||
!sourceMap &&
|
||||
state.emotionSourceMap &&
|
||||
path.node.quasi.loc !== undefined
|
||||
) {
|
||||
sourceMap = getSourceMap(path.node.quasi.loc.start, state)
|
||||
}
|
||||
minify(path, t)
|
||||
}
|
||||
|
||||
if (t.isCallExpression(path)) {
|
||||
const canAppendStrings = path.node.arguments.every(
|
||||
arg => arg.type !== 'SpreadElement'
|
||||
)
|
||||
|
||||
path.get('arguments').forEach(node => {
|
||||
if (t.isObjectExpression(node)) {
|
||||
node.replaceWith(simplifyObject(node.node, t))
|
||||
}
|
||||
})
|
||||
|
||||
path.node.arguments = joinStringLiterals(path.node.arguments, t)
|
||||
|
||||
if (
|
||||
!sourceMap &&
|
||||
canAppendStrings &&
|
||||
state.emotionSourceMap &&
|
||||
path.node.loc !== undefined
|
||||
) {
|
||||
sourceMap = getSourceMap(path.node.loc.start, state)
|
||||
}
|
||||
|
||||
const label =
|
||||
shouldLabel && autoLabel !== 'never'
|
||||
? getLabelFromPath(path, state, t)
|
||||
: null
|
||||
|
||||
if (
|
||||
path.node.arguments.length === 1 &&
|
||||
t.isStringLiteral(path.node.arguments[0])
|
||||
) {
|
||||
let cssString = path.node.arguments[0].value.replace(/;$/, '')
|
||||
let res = serializeStyles([
|
||||
`${cssString}${
|
||||
label && autoLabel === 'always' ? `;label:${label};` : ''
|
||||
}`
|
||||
])
|
||||
let prodNode = t.objectExpression([
|
||||
t.objectProperty(t.identifier('name'), t.stringLiteral(res.name)),
|
||||
t.objectProperty(t.identifier('styles'), t.stringLiteral(res.styles))
|
||||
])
|
||||
|
||||
if (!state.emotionStringifiedCssId) {
|
||||
const uid = state.file.scope.generateUidIdentifier(
|
||||
'__EMOTION_STRINGIFIED_CSS_ERROR__'
|
||||
)
|
||||
state.emotionStringifiedCssId = uid
|
||||
const cssObjectToString = t.functionDeclaration(
|
||||
uid,
|
||||
[],
|
||||
t.blockStatement([
|
||||
t.returnStatement(t.stringLiteral(CSS_OBJECT_STRINGIFIED_ERROR))
|
||||
])
|
||||
)
|
||||
cssObjectToString._compact = true
|
||||
state.file.path.unshiftContainer('body', [cssObjectToString])
|
||||
}
|
||||
|
||||
if (label && autoLabel === 'dev-only') {
|
||||
res = serializeStyles([`${cssString};label:${label};`])
|
||||
}
|
||||
|
||||
let devNode = t.objectExpression(
|
||||
[
|
||||
t.objectProperty(t.identifier('name'), t.stringLiteral(res.name)),
|
||||
t.objectProperty(
|
||||
t.identifier('styles'),
|
||||
t.stringLiteral(res.styles + sourceMap)
|
||||
),
|
||||
t.objectProperty(
|
||||
t.identifier('toString'),
|
||||
t.cloneNode(state.emotionStringifiedCssId)
|
||||
)
|
||||
].filter(Boolean)
|
||||
)
|
||||
|
||||
return createNodeEnvConditional(t, prodNode, devNode)
|
||||
}
|
||||
|
||||
if (canAppendStrings && label) {
|
||||
const labelString = `;label:${label};`
|
||||
|
||||
switch (autoLabel) {
|
||||
case 'dev-only': {
|
||||
const labelConditional = createNodeEnvConditional(
|
||||
t,
|
||||
t.stringLiteral(''),
|
||||
t.stringLiteral(labelString)
|
||||
)
|
||||
appendStringReturningExpressionToArguments(t, path, labelConditional)
|
||||
break
|
||||
}
|
||||
case 'always':
|
||||
appendStringReturningExpressionToArguments(t, path, labelString)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (sourceMap) {
|
||||
let sourceMapConditional = createNodeEnvConditional(
|
||||
t,
|
||||
t.stringLiteral(''),
|
||||
t.stringLiteral(sourceMap)
|
||||
)
|
||||
appendStringReturningExpressionToArguments(t, path, sourceMapConditional)
|
||||
}
|
||||
}
|
||||
}
|
||||
59
node_modules/@emotion/babel-plugin/src/utils/transformer-macro.js
generated
vendored
Normal file
59
node_modules/@emotion/babel-plugin/src/utils/transformer-macro.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import { createMacro } from 'babel-plugin-macros'
|
||||
|
||||
/*
|
||||
type Transformer = Function
|
||||
*/
|
||||
|
||||
export function createTransformerMacro(
|
||||
transformers /*: { [key: string]: Transformer | [Transformer, Object] } */,
|
||||
{ importSource } /*: { importSource: string } */
|
||||
) {
|
||||
let macro = createMacro(
|
||||
({ path, source, references, state, babel, isEmotionCall }) => {
|
||||
if (!path) {
|
||||
path = state.file.scope.path
|
||||
.get('body')
|
||||
.find(p => p.isImportDeclaration() && p.node.source.value === source)
|
||||
}
|
||||
|
||||
if (/\/macro$/.test(source)) {
|
||||
path
|
||||
.get('source')
|
||||
.replaceWith(
|
||||
babel.types.stringLiteral(source.replace(/\/macro$/, ''))
|
||||
)
|
||||
}
|
||||
|
||||
if (!isEmotionCall) {
|
||||
state.emotionSourceMap = true
|
||||
}
|
||||
Object.keys(references).forEach(importSpecifierName => {
|
||||
if (transformers[importSpecifierName]) {
|
||||
references[importSpecifierName].reverse().forEach(reference => {
|
||||
let options
|
||||
let transformer
|
||||
if (Array.isArray(transformers[importSpecifierName])) {
|
||||
transformer = transformers[importSpecifierName][0]
|
||||
options = transformers[importSpecifierName][1]
|
||||
} else {
|
||||
transformer = transformers[importSpecifierName]
|
||||
options = {}
|
||||
}
|
||||
transformer({
|
||||
state,
|
||||
babel,
|
||||
path,
|
||||
importSource,
|
||||
importSpecifierName,
|
||||
options,
|
||||
reference
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
return { keepImports: true }
|
||||
}
|
||||
)
|
||||
macro.transformers = transformers
|
||||
return macro
|
||||
}
|
||||
78
node_modules/@emotion/babel-plugin/src/utils/transpiled-output-utils.js
generated
vendored
Normal file
78
node_modules/@emotion/babel-plugin/src/utils/transpiled-output-utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// this only works correctly in modules, but we don't run on scripts anyway, so it's fine
|
||||
// the difference is that in modules template objects are being cached per call site
|
||||
export function getTypeScriptMakeTemplateObjectPath(path) {
|
||||
if (path.node.arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
const firstArgPath = path.get('arguments')[0]
|
||||
|
||||
if (
|
||||
firstArgPath.isLogicalExpression() &&
|
||||
firstArgPath.get('left').isIdentifier() &&
|
||||
firstArgPath.get('right').isAssignmentExpression() &&
|
||||
firstArgPath.get('right.right').isCallExpression() &&
|
||||
firstArgPath.get('right.right.callee').isIdentifier() &&
|
||||
firstArgPath.node.right.right.callee.name.includes('makeTemplateObject') &&
|
||||
firstArgPath.node.right.right.arguments.length === 2
|
||||
) {
|
||||
return firstArgPath.get('right.right')
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
// this is only used to prevent appending strings/expressions to arguments incorectly
|
||||
// we could push them to found array expressions, as we do it for TS-transpile output ¯\_(ツ)_/¯
|
||||
// it seems overly complicated though - mainly because we'd also have to check against existing stuff of a particular type (source maps & labels)
|
||||
// considering Babel double-transpilation as a valid use case seems rather far-fetched
|
||||
export function isTaggedTemplateTranspiledByBabel(path) {
|
||||
if (path.node.arguments.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
const firstArgPath = path.get('arguments')[0]
|
||||
|
||||
if (
|
||||
!firstArgPath.isCallExpression() ||
|
||||
!firstArgPath.get('callee').isIdentifier()
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
const calleeName = firstArgPath.node.callee.name
|
||||
|
||||
if (!calleeName.includes('templateObject')) {
|
||||
return false
|
||||
}
|
||||
|
||||
const bindingPath = path.scope.getBinding(calleeName).path
|
||||
|
||||
if (!bindingPath.isFunction()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const functionBody = bindingPath.get('body.body')
|
||||
|
||||
if (!functionBody[0].isVariableDeclaration()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const declarationInit = functionBody[0].get('declarations')[0].get('init')
|
||||
|
||||
if (!declarationInit.isCallExpression()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const declarationInitArguments = declarationInit.get('arguments')
|
||||
|
||||
if (
|
||||
declarationInitArguments.length === 0 ||
|
||||
declarationInitArguments.length > 2 ||
|
||||
declarationInitArguments.some(argPath => !argPath.isArrayExpression())
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
21
node_modules/@emotion/cache/LICENSE
generated
vendored
Normal file
21
node_modules/@emotion/cache/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Emotion team and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
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.
|
||||
16
node_modules/@emotion/cache/dist/declarations/src/index.d.ts
generated
vendored
Normal file
16
node_modules/@emotion/cache/dist/declarations/src/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import type { EmotionCache } from '@emotion/utils';
|
||||
import { StylisPlugin } from "./types.js";
|
||||
export interface Options {
|
||||
nonce?: string;
|
||||
stylisPlugins?: Array<StylisPlugin>;
|
||||
key: string;
|
||||
container?: Node;
|
||||
speedy?: boolean;
|
||||
/** @deprecate use `insertionPoint` instead */
|
||||
prepend?: boolean;
|
||||
insertionPoint?: HTMLElement;
|
||||
}
|
||||
declare let createCache: (options: Options) => EmotionCache;
|
||||
export default createCache;
|
||||
export type { EmotionCache };
|
||||
export type { StylisElement, StylisPlugin, StylisPluginCallback } from "./types.js";
|
||||
14
node_modules/@emotion/cache/dist/declarations/src/types.d.ts
generated
vendored
Normal file
14
node_modules/@emotion/cache/dist/declarations/src/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
export interface StylisElement {
|
||||
type: string;
|
||||
value: string;
|
||||
props: Array<string> | string;
|
||||
root: StylisElement | null;
|
||||
parent: StylisElement | null;
|
||||
children: Array<StylisElement> | string;
|
||||
line: number;
|
||||
column: number;
|
||||
length: number;
|
||||
return: string;
|
||||
}
|
||||
export type StylisPluginCallback = (element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback) => string | void;
|
||||
export type StylisPlugin = (element: StylisElement, index: number, children: Array<StylisElement>, callback: StylisPluginCallback) => string | void;
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.browser.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.browser.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-cache.browser.cjs.js").default;
|
||||
442
node_modules/@emotion/cache/dist/emotion-cache.browser.cjs.js
generated
vendored
Normal file
442
node_modules/@emotion/cache/dist/emotion-cache.browser.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,442 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var sheet = require('@emotion/sheet');
|
||||
var stylis = require('stylis');
|
||||
require('@emotion/weak-memoize');
|
||||
require('@emotion/memoize');
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = stylis.peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (stylis.token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
stylis.next();
|
||||
}
|
||||
|
||||
return stylis.slice(begin, stylis.position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (stylis.token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && stylis.peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += stylis.delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = stylis.peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += stylis.from(character);
|
||||
}
|
||||
} while (character = stylis.next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return stylis.dealloc(toRules(stylis.alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (stylis.hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return stylis.WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return stylis.WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (stylis.charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (stylis.charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (stylis.charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case stylis.DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case stylis.KEYFRAMES:
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case stylis.RULESET:
|
||||
if (element.length) return stylis.combine(element.props, function (value) {
|
||||
switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
{
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stylis.stringify, stylis.rulesheet(function (rule) {
|
||||
currentSheet.insert(rule);
|
||||
})];
|
||||
var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis$1 = function stylis$1(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new sheet.StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
exports["default"] = createCache;
|
||||
2
node_modules/@emotion/cache/dist/emotion-cache.browser.cjs.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/dist/emotion-cache.browser.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import "./emotion-cache.browser.cjs.js";
|
||||
export { _default as default } from "./emotion-cache.browser.cjs.default.js";
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.browser.development.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.browser.development.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-cache.browser.development.cjs.js").default;
|
||||
600
node_modules/@emotion/cache/dist/emotion-cache.browser.development.cjs.js
generated
vendored
Normal file
600
node_modules/@emotion/cache/dist/emotion-cache.browser.development.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,600 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var sheet = require('@emotion/sheet');
|
||||
var stylis = require('stylis');
|
||||
require('@emotion/weak-memoize');
|
||||
require('@emotion/memoize');
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = stylis.peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (stylis.token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
stylis.next();
|
||||
}
|
||||
|
||||
return stylis.slice(begin, stylis.position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (stylis.token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && stylis.peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += stylis.delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = stylis.peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += stylis.from(character);
|
||||
}
|
||||
} while (character = stylis.next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return stylis.dealloc(toRules(stylis.alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
||||
|
||||
var isIgnoringComment = function isIgnoringComment(element) {
|
||||
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
||||
};
|
||||
|
||||
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
||||
return function (element, index, children) {
|
||||
if (element.type !== 'rule' || cache.compat) return;
|
||||
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
|
||||
var commentContainer = isNested ? element.parent.children : // global rule at the root level
|
||||
children;
|
||||
|
||||
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
||||
var node = commentContainer[i];
|
||||
|
||||
if (node.line < element.line) {
|
||||
break;
|
||||
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
|
||||
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
||||
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var isImportRule = function isImportRule(element) {
|
||||
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
||||
};
|
||||
|
||||
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
||||
for (var i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
|
||||
|
||||
var nullifyElement = function nullifyElement(element) {
|
||||
element.type = '';
|
||||
element.value = '';
|
||||
element["return"] = '';
|
||||
element.children = '';
|
||||
element.props = '';
|
||||
};
|
||||
|
||||
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
||||
if (!isImportRule(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
||||
nullifyElement(element);
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
||||
nullifyElement(element);
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (stylis.hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return stylis.WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return stylis.WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (stylis.charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (stylis.charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (stylis.charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case stylis.DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case stylis.KEYFRAMES:
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case stylis.RULESET:
|
||||
if (element.length) return stylis.combine(element.props, function (value) {
|
||||
switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
var getSourceMap;
|
||||
|
||||
{
|
||||
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
||||
|
||||
getSourceMap = function getSourceMap(styles) {
|
||||
var matches = styles.match(sourceMapPattern);
|
||||
if (!matches) return;
|
||||
return matches[matches.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (!key) {
|
||||
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
||||
}
|
||||
|
||||
if (key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
{
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
||||
}
|
||||
}
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
{
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat;
|
||||
}
|
||||
|
||||
}), incorrectImportAlarm);
|
||||
}
|
||||
|
||||
{
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stylis.stringify, function (element) {
|
||||
if (!element.root) {
|
||||
if (element["return"]) {
|
||||
currentSheet.insert(element["return"]);
|
||||
} else if (element.value && element.type !== stylis.COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(element.value + "{}");
|
||||
}
|
||||
}
|
||||
} ];
|
||||
var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis$1 = function stylis$1(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: function insert(rule) {
|
||||
sheet.insert(rule + sourceMap);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new sheet.StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
exports["default"] = createCache;
|
||||
2
node_modules/@emotion/cache/dist/emotion-cache.browser.development.cjs.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/dist/emotion-cache.browser.development.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import "./emotion-cache.browser.development.cjs.js";
|
||||
export { _default as default } from "./emotion-cache.browser.development.cjs.default.js";
|
||||
596
node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js
generated
vendored
Normal file
596
node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,596 @@
|
|||
import { StyleSheet } from '@emotion/sheet';
|
||||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, middleware, stringify, COMMENT, compile } from 'stylis';
|
||||
import '@emotion/weak-memoize';
|
||||
import '@emotion/memoize';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
return slice(begin, position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += from(character);
|
||||
}
|
||||
} while (character = next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return dealloc(toRules(alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
||||
|
||||
var isIgnoringComment = function isIgnoringComment(element) {
|
||||
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
||||
};
|
||||
|
||||
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
||||
return function (element, index, children) {
|
||||
if (element.type !== 'rule' || cache.compat) return;
|
||||
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
|
||||
var commentContainer = isNested ? element.parent.children : // global rule at the root level
|
||||
children;
|
||||
|
||||
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
||||
var node = commentContainer[i];
|
||||
|
||||
if (node.line < element.line) {
|
||||
break;
|
||||
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
|
||||
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
||||
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var isImportRule = function isImportRule(element) {
|
||||
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
||||
};
|
||||
|
||||
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
||||
for (var i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
|
||||
|
||||
var nullifyElement = function nullifyElement(element) {
|
||||
element.type = '';
|
||||
element.value = '';
|
||||
element["return"] = '';
|
||||
element.children = '';
|
||||
element.props = '';
|
||||
};
|
||||
|
||||
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
||||
if (!isImportRule(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
||||
nullifyElement(element);
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
||||
nullifyElement(element);
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case RULESET:
|
||||
if (element.length) return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
var getSourceMap;
|
||||
|
||||
{
|
||||
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
||||
|
||||
getSourceMap = function getSourceMap(styles) {
|
||||
var matches = styles.match(sourceMapPattern);
|
||||
if (!matches) return;
|
||||
return matches[matches.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (!key) {
|
||||
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
||||
}
|
||||
|
||||
if (key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
{
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
||||
}
|
||||
}
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
{
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat;
|
||||
}
|
||||
|
||||
}), incorrectImportAlarm);
|
||||
}
|
||||
|
||||
{
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stringify, function (element) {
|
||||
if (!element.root) {
|
||||
if (element["return"]) {
|
||||
currentSheet.insert(element["return"]);
|
||||
} else if (element.value && element.type !== COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(element.value + "{}");
|
||||
}
|
||||
}
|
||||
} ];
|
||||
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis = function stylis(styles) {
|
||||
return serialize(compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: function insert(rule) {
|
||||
sheet.insert(rule + sourceMap);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
export { createCache as default };
|
||||
438
node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
generated
vendored
Normal file
438
node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
import { StyleSheet } from '@emotion/sheet';
|
||||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';
|
||||
import '@emotion/weak-memoize';
|
||||
import '@emotion/memoize';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
return slice(begin, position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += from(character);
|
||||
}
|
||||
} while (character = next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return dealloc(toRules(alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case RULESET:
|
||||
if (element.length) return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
{
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stringify, rulesheet(function (rule) {
|
||||
currentSheet.insert(rule);
|
||||
})];
|
||||
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis = function stylis(styles) {
|
||||
return serialize(compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
export { createCache as default };
|
||||
3
node_modules/@emotion/cache/dist/emotion-cache.cjs.d.mts
generated
vendored
Normal file
3
node_modules/@emotion/cache/dist/emotion-cache.cjs.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export * from "./declarations/src/index.js";
|
||||
export { _default as default } from "./emotion-cache.cjs.default.js";
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1jYWNoZS5janMuZC5tdHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
||||
3
node_modules/@emotion/cache/dist/emotion-cache.cjs.d.ts
generated
vendored
Normal file
3
node_modules/@emotion/cache/dist/emotion-cache.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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vdGlvbi1jYWNoZS5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.cjs.default.d.ts
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.cjs.default.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as _default } from "./declarations/src/index.js"
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-cache.cjs.js").default;
|
||||
503
node_modules/@emotion/cache/dist/emotion-cache.cjs.js
generated
vendored
Normal file
503
node_modules/@emotion/cache/dist/emotion-cache.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var sheet = require('@emotion/sheet');
|
||||
var stylis = require('stylis');
|
||||
var weakMemoize = require('@emotion/weak-memoize');
|
||||
var memoize = require('@emotion/memoize');
|
||||
|
||||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
||||
|
||||
var weakMemoize__default = /*#__PURE__*/_interopDefault(weakMemoize);
|
||||
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
||||
|
||||
var isBrowser = typeof document !== 'undefined';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = stylis.peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (stylis.token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
stylis.next();
|
||||
}
|
||||
|
||||
return stylis.slice(begin, stylis.position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (stylis.token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && stylis.peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += stylis.delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = stylis.peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += stylis.from(character);
|
||||
}
|
||||
} while (character = stylis.next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return stylis.dealloc(toRules(stylis.alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (stylis.hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return stylis.WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return stylis.WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (stylis.charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (stylis.charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (stylis.charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case stylis.DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case stylis.KEYFRAMES:
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case stylis.RULESET:
|
||||
if (element.length) return stylis.combine(element.props, function (value) {
|
||||
switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = isBrowser ? undefined : weakMemoize__default["default"](function () {
|
||||
return memoize__default["default"](function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (isBrowser && key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
if (isBrowser) {
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stylis.stringify, stylis.rulesheet(function (rule) {
|
||||
currentSheet.insert(rule);
|
||||
})];
|
||||
var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis$1 = function stylis$1(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stylis.stringify];
|
||||
|
||||
var _serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new sheet.StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
exports["default"] = createCache;
|
||||
2
node_modules/@emotion/cache/dist/emotion-cache.cjs.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/dist/emotion-cache.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import "./emotion-cache.cjs.js";
|
||||
export { _default as default } from "./emotion-cache.cjs.default.js";
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.development.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.development.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-cache.development.cjs.js").default;
|
||||
669
node_modules/@emotion/cache/dist/emotion-cache.development.cjs.js
generated
vendored
Normal file
669
node_modules/@emotion/cache/dist/emotion-cache.development.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,669 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var sheet = require('@emotion/sheet');
|
||||
var stylis = require('stylis');
|
||||
var weakMemoize = require('@emotion/weak-memoize');
|
||||
var memoize = require('@emotion/memoize');
|
||||
|
||||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
||||
|
||||
var weakMemoize__default = /*#__PURE__*/_interopDefault(weakMemoize);
|
||||
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
||||
|
||||
var isBrowser = typeof document !== 'undefined';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = stylis.peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (stylis.token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
stylis.next();
|
||||
}
|
||||
|
||||
return stylis.slice(begin, stylis.position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (stylis.token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && stylis.peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += stylis.delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = stylis.peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += stylis.from(character);
|
||||
}
|
||||
} while (character = stylis.next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return stylis.dealloc(toRules(stylis.alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
||||
|
||||
var isIgnoringComment = function isIgnoringComment(element) {
|
||||
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
||||
};
|
||||
|
||||
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
||||
return function (element, index, children) {
|
||||
if (element.type !== 'rule' || cache.compat) return;
|
||||
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
|
||||
var commentContainer = isNested ? element.parent.children : // global rule at the root level
|
||||
children;
|
||||
|
||||
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
||||
var node = commentContainer[i];
|
||||
|
||||
if (node.line < element.line) {
|
||||
break;
|
||||
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
|
||||
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
||||
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var isImportRule = function isImportRule(element) {
|
||||
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
||||
};
|
||||
|
||||
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
||||
for (var i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
|
||||
|
||||
var nullifyElement = function nullifyElement(element) {
|
||||
element.type = '';
|
||||
element.value = '';
|
||||
element["return"] = '';
|
||||
element.children = '';
|
||||
element.props = '';
|
||||
};
|
||||
|
||||
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
||||
if (!isImportRule(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
||||
nullifyElement(element);
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
||||
nullifyElement(element);
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (stylis.hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return stylis.WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return stylis.WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (stylis.charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (stylis.charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (stylis.charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case stylis.DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case stylis.KEYFRAMES:
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case stylis.RULESET:
|
||||
if (element.length) return stylis.combine(element.props, function (value) {
|
||||
switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = isBrowser ? undefined : weakMemoize__default["default"](function () {
|
||||
return memoize__default["default"](function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
var getSourceMap;
|
||||
|
||||
{
|
||||
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
||||
|
||||
getSourceMap = function getSourceMap(styles) {
|
||||
var matches = styles.match(sourceMapPattern);
|
||||
if (!matches) return;
|
||||
return matches[matches.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (!key) {
|
||||
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
||||
}
|
||||
|
||||
if (isBrowser && key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
{
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
||||
}
|
||||
}
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
if (isBrowser) {
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat;
|
||||
}
|
||||
|
||||
}), incorrectImportAlarm);
|
||||
}
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stylis.stringify, function (element) {
|
||||
if (!element.root) {
|
||||
if (element["return"]) {
|
||||
currentSheet.insert(element["return"]);
|
||||
} else if (element.value && element.type !== stylis.COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(element.value + "{}");
|
||||
}
|
||||
}
|
||||
} ];
|
||||
var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis$1 = function stylis$1(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: function insert(rule) {
|
||||
sheet.insert(rule + sourceMap);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stylis.stringify];
|
||||
|
||||
var _serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
return rules + sourceMap;
|
||||
}
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new sheet.StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
exports["default"] = createCache;
|
||||
2
node_modules/@emotion/cache/dist/emotion-cache.development.cjs.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/dist/emotion-cache.development.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import "./emotion-cache.development.cjs.js";
|
||||
export { _default as default } from "./emotion-cache.development.cjs.default.js";
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-cache.development.edge-light.cjs.js").default;
|
||||
628
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.cjs.js
generated
vendored
Normal file
628
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,628 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var sheet = require('@emotion/sheet');
|
||||
var stylis = require('stylis');
|
||||
var weakMemoize = require('@emotion/weak-memoize');
|
||||
var memoize = require('@emotion/memoize');
|
||||
|
||||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
||||
|
||||
var weakMemoize__default = /*#__PURE__*/_interopDefault(weakMemoize);
|
||||
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = stylis.peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (stylis.token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
stylis.next();
|
||||
}
|
||||
|
||||
return stylis.slice(begin, stylis.position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (stylis.token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && stylis.peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += stylis.delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = stylis.peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += stylis.from(character);
|
||||
}
|
||||
} while (character = stylis.next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return stylis.dealloc(toRules(stylis.alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
||||
|
||||
var isIgnoringComment = function isIgnoringComment(element) {
|
||||
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
||||
};
|
||||
|
||||
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
||||
return function (element, index, children) {
|
||||
if (element.type !== 'rule' || cache.compat) return;
|
||||
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
|
||||
var commentContainer = isNested ? element.parent.children : // global rule at the root level
|
||||
children;
|
||||
|
||||
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
||||
var node = commentContainer[i];
|
||||
|
||||
if (node.line < element.line) {
|
||||
break;
|
||||
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
|
||||
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
||||
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var isImportRule = function isImportRule(element) {
|
||||
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
||||
};
|
||||
|
||||
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
||||
for (var i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
|
||||
|
||||
var nullifyElement = function nullifyElement(element) {
|
||||
element.type = '';
|
||||
element.value = '';
|
||||
element["return"] = '';
|
||||
element.children = '';
|
||||
element.props = '';
|
||||
};
|
||||
|
||||
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
||||
if (!isImportRule(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
||||
nullifyElement(element);
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
||||
nullifyElement(element);
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (stylis.hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return stylis.WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return stylis.WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (stylis.charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (stylis.charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (stylis.charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case stylis.DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case stylis.KEYFRAMES:
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case stylis.RULESET:
|
||||
if (element.length) return stylis.combine(element.props, function (value) {
|
||||
switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = weakMemoize__default["default"](function () {
|
||||
return memoize__default["default"](function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
var getSourceMap;
|
||||
|
||||
{
|
||||
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
||||
|
||||
getSourceMap = function getSourceMap(styles) {
|
||||
var matches = styles.match(sourceMapPattern);
|
||||
if (!matches) return;
|
||||
return matches[matches.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (!key) {
|
||||
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
{
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
||||
}
|
||||
}
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat;
|
||||
}
|
||||
|
||||
}), incorrectImportAlarm);
|
||||
}
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stylis.stringify, function (element) {
|
||||
if (!element.root) {
|
||||
if (element["return"]) {
|
||||
currentSheet.insert(element["return"]);
|
||||
} else if (element.value && element.type !== stylis.COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(element.value + "{}");
|
||||
}
|
||||
}
|
||||
} ];
|
||||
var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis$1 = function stylis$1(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: function insert(rule) {
|
||||
sheet.insert(rule + sourceMap);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stylis.stringify];
|
||||
|
||||
var _serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
return rules + sourceMap;
|
||||
}
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new sheet.StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
exports["default"] = createCache;
|
||||
2
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.cjs.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.cjs.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import "./emotion-cache.development.edge-light.cjs.js";
|
||||
export { _default as default } from "./emotion-cache.development.edge-light.cjs.default.js";
|
||||
619
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.esm.js
generated
vendored
Normal file
619
node_modules/@emotion/cache/dist/emotion-cache.development.edge-light.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,619 @@
|
|||
import { StyleSheet } from '@emotion/sheet';
|
||||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, middleware, stringify, COMMENT, compile } from 'stylis';
|
||||
import weakMemoize from '@emotion/weak-memoize';
|
||||
import memoize from '@emotion/memoize';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
return slice(begin, position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += from(character);
|
||||
}
|
||||
} while (character = next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return dealloc(toRules(alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
||||
|
||||
var isIgnoringComment = function isIgnoringComment(element) {
|
||||
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
||||
};
|
||||
|
||||
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
||||
return function (element, index, children) {
|
||||
if (element.type !== 'rule' || cache.compat) return;
|
||||
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
|
||||
var commentContainer = isNested ? element.parent.children : // global rule at the root level
|
||||
children;
|
||||
|
||||
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
||||
var node = commentContainer[i];
|
||||
|
||||
if (node.line < element.line) {
|
||||
break;
|
||||
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
|
||||
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
||||
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var isImportRule = function isImportRule(element) {
|
||||
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
||||
};
|
||||
|
||||
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
||||
for (var i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
|
||||
|
||||
var nullifyElement = function nullifyElement(element) {
|
||||
element.type = '';
|
||||
element.value = '';
|
||||
element["return"] = '';
|
||||
element.children = '';
|
||||
element.props = '';
|
||||
};
|
||||
|
||||
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
||||
if (!isImportRule(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
||||
nullifyElement(element);
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
||||
nullifyElement(element);
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case RULESET:
|
||||
if (element.length) return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = weakMemoize(function () {
|
||||
return memoize(function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
var getSourceMap;
|
||||
|
||||
{
|
||||
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
||||
|
||||
getSourceMap = function getSourceMap(styles) {
|
||||
var matches = styles.match(sourceMapPattern);
|
||||
if (!matches) return;
|
||||
return matches[matches.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (!key) {
|
||||
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
{
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
||||
}
|
||||
}
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat;
|
||||
}
|
||||
|
||||
}), incorrectImportAlarm);
|
||||
}
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stringify, function (element) {
|
||||
if (!element.root) {
|
||||
if (element["return"]) {
|
||||
currentSheet.insert(element["return"]);
|
||||
} else if (element.value && element.type !== COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(element.value + "{}");
|
||||
}
|
||||
}
|
||||
} ];
|
||||
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis = function stylis(styles) {
|
||||
return serialize(compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: function insert(rule) {
|
||||
sheet.insert(rule + sourceMap);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stringify];
|
||||
|
||||
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return serialize(compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
return rules + sourceMap;
|
||||
}
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
export { createCache as default };
|
||||
660
node_modules/@emotion/cache/dist/emotion-cache.development.esm.js
generated
vendored
Normal file
660
node_modules/@emotion/cache/dist/emotion-cache.development.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,660 @@
|
|||
import { StyleSheet } from '@emotion/sheet';
|
||||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, middleware, stringify, COMMENT, compile } from 'stylis';
|
||||
import weakMemoize from '@emotion/weak-memoize';
|
||||
import memoize from '@emotion/memoize';
|
||||
|
||||
var isBrowser = typeof document !== 'undefined';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
return slice(begin, position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += from(character);
|
||||
}
|
||||
} while (character = next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return dealloc(toRules(alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
|
||||
|
||||
var isIgnoringComment = function isIgnoringComment(element) {
|
||||
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
|
||||
};
|
||||
|
||||
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
|
||||
return function (element, index, children) {
|
||||
if (element.type !== 'rule' || cache.compat) return;
|
||||
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
|
||||
var commentContainer = isNested ? element.parent.children : // global rule at the root level
|
||||
children;
|
||||
|
||||
for (var i = commentContainer.length - 1; i >= 0; i--) {
|
||||
var node = commentContainer[i];
|
||||
|
||||
if (node.line < element.line) {
|
||||
break;
|
||||
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
|
||||
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
|
||||
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var isImportRule = function isImportRule(element) {
|
||||
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
|
||||
};
|
||||
|
||||
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
|
||||
for (var i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}; // use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
|
||||
|
||||
var nullifyElement = function nullifyElement(element) {
|
||||
element.type = '';
|
||||
element.value = '';
|
||||
element["return"] = '';
|
||||
element.children = '';
|
||||
element.props = '';
|
||||
};
|
||||
|
||||
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
|
||||
if (!isImportRule(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
|
||||
nullifyElement(element);
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
|
||||
nullifyElement(element);
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case RULESET:
|
||||
if (element.length) return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
|
||||
return memoize(function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
var getSourceMap;
|
||||
|
||||
{
|
||||
var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
||||
|
||||
getSourceMap = function getSourceMap(styles) {
|
||||
var matches = styles.match(sourceMapPattern);
|
||||
if (!matches) return;
|
||||
return matches[matches.length - 1];
|
||||
};
|
||||
}
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (!key) {
|
||||
throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
|
||||
}
|
||||
|
||||
if (isBrowser && key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
{
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
||||
}
|
||||
}
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
if (isBrowser) {
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
{
|
||||
omnipresentPlugins.push(createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat;
|
||||
}
|
||||
|
||||
}), incorrectImportAlarm);
|
||||
}
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stringify, function (element) {
|
||||
if (!element.root) {
|
||||
if (element["return"]) {
|
||||
currentSheet.insert(element["return"]);
|
||||
} else if (element.value && element.type !== COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(element.value + "{}");
|
||||
}
|
||||
}
|
||||
} ];
|
||||
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis = function stylis(styles) {
|
||||
return serialize(compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: function insert(rule) {
|
||||
sheet.insert(rule + sourceMap);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stringify];
|
||||
|
||||
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return serialize(compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
if (getSourceMap) {
|
||||
var sourceMap = getSourceMap(serialized.styles);
|
||||
|
||||
if (sourceMap) {
|
||||
return rules + sourceMap;
|
||||
}
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
export { createCache as default };
|
||||
1
node_modules/@emotion/cache/dist/emotion-cache.edge-light.cjs.default.js
generated
vendored
Normal file
1
node_modules/@emotion/cache/dist/emotion-cache.edge-light.cjs.default.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
exports._default = require("./emotion-cache.edge-light.cjs.js").default;
|
||||
462
node_modules/@emotion/cache/dist/emotion-cache.edge-light.cjs.js
generated
vendored
Normal file
462
node_modules/@emotion/cache/dist/emotion-cache.edge-light.cjs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,462 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var sheet = require('@emotion/sheet');
|
||||
var stylis = require('stylis');
|
||||
var weakMemoize = require('@emotion/weak-memoize');
|
||||
var memoize = require('@emotion/memoize');
|
||||
|
||||
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
||||
|
||||
var weakMemoize__default = /*#__PURE__*/_interopDefault(weakMemoize);
|
||||
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = stylis.peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (stylis.token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
stylis.next();
|
||||
}
|
||||
|
||||
return stylis.slice(begin, stylis.position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (stylis.token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && stylis.peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(stylis.position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += stylis.delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = stylis.peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += stylis.from(character);
|
||||
}
|
||||
} while (character = stylis.next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return stylis.dealloc(toRules(stylis.alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (stylis.hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return stylis.WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return stylis.WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return stylis.WEBKIT + value + stylis.MOZ + value + stylis.MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return stylis.WEBKIT + value + stylis.replace(value, /(\w+).+(:[^]+)/, stylis.WEBKIT + 'box-$1$2' + stylis.MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-item-' + stylis.replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return stylis.WEBKIT + value + stylis.MS + 'flex-line-pack' + stylis.replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return stylis.WEBKIT + 'box-' + stylis.replace(value, '-grow', '') + stylis.WEBKIT + value + stylis.MS + stylis.replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return stylis.WEBKIT + stylis.replace(value, /([^-])(transform)/g, '$1' + stylis.WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return stylis.replace(stylis.replace(stylis.replace(value, /(zoom-|grab)/, stylis.WEBKIT + '$1'), /(image-set)/, stylis.WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return stylis.replace(value, /(image-set\([^]*)/, stylis.WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return stylis.replace(stylis.replace(value, /(.+:)(flex-)?(.*)/, stylis.WEBKIT + 'box-pack:$3' + stylis.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis.WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return stylis.replace(value, /(.+)-inline(.+)/, stylis.WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (stylis.strlen(value) - 1 - length > 6) switch (stylis.charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (stylis.charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return stylis.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylis.WEBKIT + '$2-$3' + '$1' + stylis.MOZ + (stylis.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~stylis.indexof(value, 'stretch') ? prefix(stylis.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (stylis.charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (stylis.charat(value, stylis.strlen(value) - 3 - (~stylis.indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return stylis.replace(value, ':', ':' + stylis.WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return stylis.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis.WEBKIT + (stylis.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis.WEBKIT + '$2$3' + '$1' + stylis.MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (stylis.charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return stylis.WEBKIT + value + stylis.MS + stylis.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return stylis.WEBKIT + value + stylis.MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case stylis.DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case stylis.KEYFRAMES:
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
value: stylis.replace(element.value, '@', '@' + stylis.WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case stylis.RULESET:
|
||||
if (element.length) return stylis.combine(element.props, function (value) {
|
||||
switch (stylis.match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(read-\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return stylis.serialize([stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.WEBKIT + 'input-$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, ':' + stylis.MOZ + '$1')]
|
||||
}), stylis.copy(element, {
|
||||
props: [stylis.replace(value, /:(plac\w+)/, stylis.MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = weakMemoize__default["default"](function () {
|
||||
return memoize__default["default"](function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stylis.stringify, stylis.rulesheet(function (rule) {
|
||||
currentSheet.insert(rule);
|
||||
})];
|
||||
var serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis$1 = function stylis$1(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
stylis$1(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stylis.stringify];
|
||||
|
||||
var _serializer = stylis.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return stylis.serialize(stylis.compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new sheet.StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
exports["default"] = createCache;
|
||||
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";
|
||||
453
node_modules/@emotion/cache/dist/emotion-cache.edge-light.esm.js
generated
vendored
Normal file
453
node_modules/@emotion/cache/dist/emotion-cache.edge-light.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,453 @@
|
|||
import { StyleSheet } from '@emotion/sheet';
|
||||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';
|
||||
import weakMemoize from '@emotion/weak-memoize';
|
||||
import memoize from '@emotion/memoize';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
return slice(begin, position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += from(character);
|
||||
}
|
||||
} while (character = next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return dealloc(toRules(alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case RULESET:
|
||||
if (element.length) return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = weakMemoize(function () {
|
||||
return memoize(function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stringify, rulesheet(function (rule) {
|
||||
currentSheet.insert(rule);
|
||||
})];
|
||||
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis = function stylis(styles) {
|
||||
return serialize(compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stringify];
|
||||
|
||||
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return serialize(compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
export { createCache as default };
|
||||
494
node_modules/@emotion/cache/dist/emotion-cache.esm.js
generated
vendored
Normal file
494
node_modules/@emotion/cache/dist/emotion-cache.esm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,494 @@
|
|||
import { StyleSheet } from '@emotion/sheet';
|
||||
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';
|
||||
import weakMemoize from '@emotion/weak-memoize';
|
||||
import memoize from '@emotion/memoize';
|
||||
|
||||
var isBrowser = typeof document !== 'undefined';
|
||||
|
||||
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
||||
var previous = 0;
|
||||
var character = 0;
|
||||
|
||||
while (true) {
|
||||
previous = character;
|
||||
character = peek(); // &\f
|
||||
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break;
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
return slice(begin, position);
|
||||
};
|
||||
|
||||
var toRules = function toRules(parsed, points) {
|
||||
// pretend we've started with a comma
|
||||
var index = -1;
|
||||
var character = 44;
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1;
|
||||
}
|
||||
|
||||
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
parsed[index] += delimit(character);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : '';
|
||||
points[index] = parsed[index].length;
|
||||
break;
|
||||
}
|
||||
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
parsed[index] += from(character);
|
||||
}
|
||||
} while (character = next());
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var getRules = function getRules(value, points) {
|
||||
return dealloc(toRules(alloc(value), points));
|
||||
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
|
||||
|
||||
var fixedElements = /* #__PURE__ */new WeakMap();
|
||||
var compat = function compat(element) {
|
||||
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var value = element.value;
|
||||
var parent = element.parent;
|
||||
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent;
|
||||
if (!parent) return;
|
||||
} // short-circuit for the simplest case
|
||||
|
||||
|
||||
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
||||
/* colon */
|
||||
&& !fixedElements.get(parent)) {
|
||||
return;
|
||||
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
|
||||
|
||||
if (isImplicitRule) {
|
||||
return;
|
||||
}
|
||||
|
||||
fixedElements.set(element, true);
|
||||
var points = [];
|
||||
var rules = getRules(value, points);
|
||||
var parentRules = parent.props;
|
||||
|
||||
for (var i = 0, k = 0; i < rules.length; i++) {
|
||||
for (var j = 0; j < parentRules.length; j++, k++) {
|
||||
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLabel = function removeLabel(element) {
|
||||
if (element.type === 'decl') {
|
||||
var value = element.value;
|
||||
|
||||
if ( // charcode for l
|
||||
value.charCodeAt(0) === 108 && // charcode for b
|
||||
value.charCodeAt(2) === 98) {
|
||||
// this ignores label
|
||||
element["return"] = '';
|
||||
element.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
|
||||
function prefix(value, length) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value;
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value;
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value;
|
||||
// flex, flex-direction
|
||||
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value;
|
||||
// order
|
||||
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value;
|
||||
// align-items
|
||||
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
||||
// align-self
|
||||
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
||||
// align-content
|
||||
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
||||
// flex-shrink
|
||||
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
||||
// flex-basis
|
||||
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
||||
// flex-grow
|
||||
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
||||
// transition
|
||||
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
||||
// cursor
|
||||
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
||||
// background, background-image
|
||||
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
||||
// justify-content
|
||||
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
||||
// (margin|padding)-inline-(start|end)
|
||||
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break;
|
||||
// (f)ill-available, (f)it-content
|
||||
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
||||
// (s)tretch
|
||||
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
||||
}
|
||||
break;
|
||||
// position: sticky
|
||||
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break;
|
||||
// display: (flex|inline-flex)
|
||||
|
||||
case 6444:
|
||||
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value;
|
||||
// (inline-)?fl(e)x
|
||||
|
||||
case 101:
|
||||
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
||||
}
|
||||
|
||||
break;
|
||||
// writing-mode
|
||||
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
||||
// vertical-r(l)
|
||||
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
||||
// horizontal(-)tb
|
||||
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var prefixer = function prefixer(element, index, children, callback) {
|
||||
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
||||
case DECLARATION:
|
||||
element["return"] = prefix(element.value, element.length);
|
||||
break;
|
||||
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})], callback);
|
||||
|
||||
case RULESET:
|
||||
if (element.length) return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})], callback);
|
||||
// :placeholder
|
||||
|
||||
case '::placeholder':
|
||||
return serialize([copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}), copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})], callback);
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
|
||||
return memoize(function () {
|
||||
return {};
|
||||
});
|
||||
});
|
||||
var defaultStylisPlugins = [prefixer];
|
||||
|
||||
var createCache = function createCache(options) {
|
||||
var key = options.key;
|
||||
|
||||
if (isBrowser && key === 'css') {
|
||||
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
|
||||
Array.prototype.forEach.call(ssrStyles, function (node) {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
||||
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.head.appendChild(node);
|
||||
node.setAttribute('data-s', '');
|
||||
});
|
||||
}
|
||||
|
||||
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
||||
|
||||
var inserted = {};
|
||||
var container;
|
||||
var nodesToHydrate = [];
|
||||
|
||||
if (isBrowser) {
|
||||
container = options.container || document.head;
|
||||
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
||||
var attrib = node.getAttribute("data-emotion").split(' ');
|
||||
|
||||
for (var i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true;
|
||||
}
|
||||
|
||||
nodesToHydrate.push(node);
|
||||
});
|
||||
}
|
||||
|
||||
var _insert;
|
||||
|
||||
var omnipresentPlugins = [compat, removeLabel];
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
var currentSheet;
|
||||
var finalizingPlugins = [stringify, rulesheet(function (rule) {
|
||||
currentSheet.insert(rule);
|
||||
})];
|
||||
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
||||
|
||||
var stylis = function stylis(styles) {
|
||||
return serialize(compile(styles), serializer);
|
||||
};
|
||||
|
||||
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
||||
currentSheet = sheet;
|
||||
|
||||
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var _finalizingPlugins = [stringify];
|
||||
|
||||
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
||||
|
||||
var _stylis = function _stylis(styles) {
|
||||
return serialize(compile(styles), _serializer);
|
||||
};
|
||||
|
||||
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
||||
|
||||
var getRules = function getRules(selector, serialized) {
|
||||
var name = serialized.name;
|
||||
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
||||
}
|
||||
|
||||
return serverStylisCache[name];
|
||||
};
|
||||
|
||||
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
||||
var name = serialized.name;
|
||||
var rules = getRules(selector, serialized);
|
||||
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true;
|
||||
}
|
||||
|
||||
return rules;
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules;
|
||||
} else {
|
||||
return rules;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var cache = {
|
||||
key: key,
|
||||
sheet: new StyleSheet({
|
||||
key: key,
|
||||
container: container,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted: inserted,
|
||||
registered: {},
|
||||
insert: _insert
|
||||
};
|
||||
cache.sheet.hydrate(nodesToHydrate);
|
||||
return cache;
|
||||
};
|
||||
|
||||
export { createCache as default };
|
||||
21
node_modules/@emotion/cache/node_modules/stylis/LICENSE
generated
vendored
Normal file
21
node_modules/@emotion/cache/node_modules/stylis/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-present Sultan Tarimo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
161
node_modules/@emotion/cache/node_modules/stylis/README.md
generated
vendored
Normal file
161
node_modules/@emotion/cache/node_modules/stylis/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
# STYLIS
|
||||
|
||||
[](https://github.com/thysultan/stylis.js)
|
||||
|
||||
A Light–weight CSS Preprocessor.
|
||||
|
||||
[](https://coveralls.io/github/thysultan/stylis.js)
|
||||
[](https://bundlephobia.com/result?p=stylis)
|
||||
[](https://github.com/thysultan/stylis.js/blob/master/LICENSE)
|
||||
[](https://www.npmjs.com/package/stylis)
|
||||
|
||||
## Installation
|
||||
|
||||
* Use a Direct Download: `<script src=stylis.js></script>`
|
||||
* Use a CDN: `<script src=unpkg.com/stylis></script>`
|
||||
* Use NPM: `npm install stylis --save`
|
||||
|
||||
## Features
|
||||
|
||||
- nesting `a { &:hover {} }`
|
||||
- selector namespacing
|
||||
- vendor prefixing (flex-box, etc...)
|
||||
- minification
|
||||
- esm module compatible
|
||||
- tree-shaking-able
|
||||
|
||||
## Abstract Syntax Structure
|
||||
|
||||
```js
|
||||
const declaration = {
|
||||
value: 'color:red;',
|
||||
type: 'decl',
|
||||
props: 'color',
|
||||
children: 'red',
|
||||
line: 1, column: 1
|
||||
}
|
||||
|
||||
const comment = {
|
||||
value: '/*@noflip*/',
|
||||
type: 'comm',
|
||||
props: '/',
|
||||
children: '@noflip',
|
||||
line: 1, column: 1
|
||||
}
|
||||
|
||||
const ruleset = {
|
||||
value: 'h1,h2',
|
||||
type: 'rule',
|
||||
props: ['h1', 'h2'],
|
||||
children: [/* ... */],
|
||||
line: 1, column: 1
|
||||
}
|
||||
|
||||
const atruleset = {
|
||||
value: '@media (max-width:100), (min-width:100)',
|
||||
type: '@media',
|
||||
props: ['(max-width:100)', '(min-width:100)'],
|
||||
children: [/* ... */],
|
||||
line: 1, column: 1
|
||||
}
|
||||
```
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
import {compile, serialize, stringify} from 'stylis'
|
||||
|
||||
serialize(compile(`h1{all:unset}`), stringify)
|
||||
```
|
||||
|
||||
### Compile
|
||||
|
||||
```js
|
||||
compile('h1{all:unset}') === [{value: 'h1', type: 'rule', props: ['h1'], children: [/* ... */]}]
|
||||
compile('--foo:unset;') === [{value: '--foo:unset;', type: 'decl', props: '--foo', children: 'unset'}]
|
||||
```
|
||||
|
||||
### Tokenize
|
||||
|
||||
```js
|
||||
tokenize('h1 h2 h3 [h4 h5] fn(args) "a b c"') === ['h1', 'h2', 'h3', '[h4 h5]', 'fn', '(args)', '"a b c"']
|
||||
```
|
||||
|
||||
### Serialize
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), stringify)
|
||||
```
|
||||
|
||||
### Vendor Prefixing
|
||||
|
||||
```js
|
||||
import {compile, serialize, stringify, middleware, prefixer } from 'stylis';
|
||||
|
||||
serialize(compile('div{display:flex;}'), middleware([prefixer, stringify]))
|
||||
```
|
||||
|
||||
|
||||
## Middleware
|
||||
|
||||
The middleware helper is a convenient helper utility, that for all intents and purposes you can do without if you intend to implement your own traversal logic. The `stringify` middleware is one such middleware that can be used in conjunction with it.
|
||||
|
||||
Elements passed to middlewares have a `root` property that is the immediate root/parent of the current element **in the compiled output**, so it references the parent in the already expanded CSS-like structure. Elements have also `parent` property that is the immediate parent of the current element **from the input structure** (structure representing the input string).
|
||||
|
||||
### Traversal
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([(element, index, children) => {
|
||||
assert(children === element.root.children && children[index] === element.children)
|
||||
}, stringify])) === 'h1{all:unset;}'
|
||||
```
|
||||
|
||||
The abstract syntax tree also includes an additional `return` property for more niche uses.
|
||||
|
||||
### Prefixing
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([(element, index, children, callback) => {
|
||||
if (element.type === 'decl' && element.props === 'all' && element.children === 'unset')
|
||||
element.return = 'color:red;' + element.value
|
||||
}, stringify])) === 'h1{color:red;all:unset;}'
|
||||
```
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([(element, index, children, callback) => {
|
||||
if (element.type === 'rule' && element.props.indexOf('h1') > -1)
|
||||
return serialize([{...element, props: ['h2', 'h3']}], callback)
|
||||
}, stringify])) === 'h2,h3{all:unset;}h1{all:unset;}'
|
||||
```
|
||||
|
||||
### Reading
|
||||
|
||||
```js
|
||||
serialize(compile('h1{all:unset}'), middleware([stringify, (element, index, children) => {
|
||||
assert(element.return === 'h1{all:unset;}')
|
||||
}])) === 'h1{all:unset;color:red;}'
|
||||
```
|
||||
|
||||
The middlewares in [src/Middleware.js](src/Middleware.js) dive into tangible examples of how you might implement a middleware, alternatively you could also create your own middleware system as `compile` returns all the nessessary structure to fork from.
|
||||
|
||||
## Variables
|
||||
|
||||
CSS variables are supported but a note should be made about the exotic use of css variables. The css spec mentions the following
|
||||
|
||||
>The allowed syntax for custom properties is extremely permissive. The <declaration-value> production matches any sequence of one or more tokens, so long as the sequence does not contain <bad-string-token>, <bad-url-token>, unmatched <)-token>, <]-token>, or <}-token>, or top-level <semicolon-token> tokens or <delim-token> tokens with a value of "!".
|
||||
|
||||
That is to say css variables according to the spec allows: `--foo: if(x > 5) this.width = 10;` and while this value is obviously useless as a variable, and would be invalid in any normal property, it still might be read and acted on by JavaScript and this is supported by Stylis, however things become slightly undefined when we start to include the `{` and `}` productions in our use of exotic css variables.
|
||||
|
||||
For example consider the following: `--foo: {};`
|
||||
|
||||
While this is valid CSS and supported. It is unclear what should happen when the rule collides with the implicit block termination rule that allows i.e `h1{color:red}`(notice the omitted semicolon) to also be a valid CSS production. This results in the following contradiction in: `h1{--example: {}` is it to be treated as `h1{--foo:{;}` or `h1{--foo:{}` the later of which is an unterminated block or in the following: `h1{--foo:{} h1{color:red;}` should it be `h1 {--foo:{}h1{color:red;};` where `{}h1{color:red;` is part of the css variable `--foo` and not a new rule or should it be something else?
|
||||
|
||||
Nevertheless Stylis still supports the exotic forms highlighted in the spec, however you should consider it as a general rule to delimit such exotic uses of variables in strings or parentheses i.e: `h1{--foo:'{'}` or `h1{--foo:({)}`.
|
||||
|
||||
## Benchmark
|
||||
|
||||
Stylis is at-least 2X faster than its predecesor.
|
||||
|
||||
### License
|
||||
|
||||
Stylis is [MIT licensed](./LICENSE).
|
||||
2
node_modules/@emotion/cache/node_modules/stylis/dist/stylis.mjs
generated
vendored
Normal file
2
node_modules/@emotion/cache/node_modules/stylis/dist/stylis.mjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@emotion/cache/node_modules/stylis/dist/stylis.mjs.map
generated
vendored
Normal file
1
node_modules/@emotion/cache/node_modules/stylis/dist/stylis.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@emotion/cache/node_modules/stylis/dist/umd/package.json
generated
vendored
Normal file
1
node_modules/@emotion/cache/node_modules/stylis/dist/umd/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ "type": "commonjs" }
|
||||
2
node_modules/@emotion/cache/node_modules/stylis/dist/umd/stylis.js
generated
vendored
Normal file
2
node_modules/@emotion/cache/node_modules/stylis/dist/umd/stylis.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@emotion/cache/node_modules/stylis/dist/umd/stylis.js.map
generated
vendored
Normal file
1
node_modules/@emotion/cache/node_modules/stylis/dist/umd/stylis.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@emotion/cache/node_modules/stylis/index.js
generated
vendored
Normal file
7
node_modules/@emotion/cache/node_modules/stylis/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export * from './src/Enum.js'
|
||||
export * from './src/Utility.js'
|
||||
export * from './src/Parser.js'
|
||||
export * from './src/Prefixer.js'
|
||||
export * from './src/Tokenizer.js'
|
||||
export * from './src/Serializer.js'
|
||||
export * from './src/Middleware.js'
|
||||
167
node_modules/@emotion/cache/node_modules/stylis/package.json
generated
vendored
Normal file
167
node_modules/@emotion/cache/node_modules/stylis/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
{
|
||||
"name": "stylis",
|
||||
"version": "4.2.0",
|
||||
"license": "MIT",
|
||||
"description": "A Light–weight CSS Preprocessor",
|
||||
"homepage": "https://github.com/thysultan/stylis.js",
|
||||
"author": "Sultan Tarimo <sultantarimo@me.com>",
|
||||
"repository": "https://github.com/thysultan/stylis.js",
|
||||
"bugs": "https://github.com/thysultan/stylis.js/issues",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "dist/umd/stylis.js",
|
||||
"module": "dist/stylis.mjs",
|
||||
"react-native": "./index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./index.js",
|
||||
"require": "./dist/umd/stylis.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist/",
|
||||
"src/"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint ./",
|
||||
"pretest": "npm run lint && npm run build",
|
||||
"test": "nyc npm run spec",
|
||||
"spec": "mocha --harmony --require esm script/setup.js --recursive test",
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "rollup --config script/build.js --configSrc ./",
|
||||
"start": "npm run build -- --watch",
|
||||
"prepare": "npm run build",
|
||||
"postversion": "git push --follow-tags && npm publish",
|
||||
"release-major": "npm version major -m '%s'",
|
||||
"release-minor": "npm version minor -m '%s'",
|
||||
"release-patch": "npm version patch -m '%s'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "4.3.4",
|
||||
"eslint": "6.8.0",
|
||||
"esm": "3.2.25",
|
||||
"mocha": "9.1.1",
|
||||
"nyc": "15.1.0",
|
||||
"rimraf": "3.0.2",
|
||||
"rollup": "1.28.0",
|
||||
"rollup-plugin-size": "0.2.1",
|
||||
"rollup-plugin-terser": "5.1.3",
|
||||
"stylis": "./"
|
||||
},
|
||||
"nyc": {
|
||||
"temp-dir": "./coverage/.nyc_output",
|
||||
"exclude": [
|
||||
"**/dist/",
|
||||
"**/test/",
|
||||
"**/script/"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"esm": {
|
||||
"cjs": true,
|
||||
"cache": false
|
||||
},
|
||||
"eslintIgnore": [
|
||||
"script/",
|
||||
"test/",
|
||||
"dist/",
|
||||
"docs/"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 7,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
"tab",
|
||||
{
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"no-cond-assign": [
|
||||
"off"
|
||||
],
|
||||
"no-redeclare": [
|
||||
"off"
|
||||
],
|
||||
"no-fallthrough": [
|
||||
"off"
|
||||
],
|
||||
"no-console": [
|
||||
"off"
|
||||
],
|
||||
"no-unsafe-finally": [
|
||||
"off"
|
||||
],
|
||||
"no-shadow-restricted-names": [
|
||||
"error"
|
||||
],
|
||||
"no-whitespace-before-property": [
|
||||
"error"
|
||||
],
|
||||
"no-else-return": [
|
||||
"error"
|
||||
],
|
||||
"eol-last": [
|
||||
"error"
|
||||
],
|
||||
"func-call-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"brace-style": [
|
||||
"error",
|
||||
"1tbs",
|
||||
{
|
||||
"allowSingleLine": true
|
||||
}
|
||||
],
|
||||
"require-jsdoc": [
|
||||
"error",
|
||||
{
|
||||
"require": {
|
||||
"FunctionDeclaration": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"no-trailing-spaces": [
|
||||
"error",
|
||||
{
|
||||
"skipBlankLines": true
|
||||
}
|
||||
],
|
||||
"no-constant-condition": [
|
||||
"off"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/@emotion/cache/node_modules/stylis/src/Enum.js
generated
vendored
Normal file
21
node_modules/@emotion/cache/node_modules/stylis/src/Enum.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export var MS = '-ms-'
|
||||
export var MOZ = '-moz-'
|
||||
export var WEBKIT = '-webkit-'
|
||||
|
||||
export var COMMENT = 'comm'
|
||||
export var RULESET = 'rule'
|
||||
export var DECLARATION = 'decl'
|
||||
|
||||
export var PAGE = '@page'
|
||||
export var MEDIA = '@media'
|
||||
export var IMPORT = '@import'
|
||||
export var CHARSET = '@charset'
|
||||
export var VIEWPORT = '@viewport'
|
||||
export var SUPPORTS = '@supports'
|
||||
export var DOCUMENT = '@document'
|
||||
export var NAMESPACE = '@namespace'
|
||||
export var KEYFRAMES = '@keyframes'
|
||||
export var FONT_FACE = '@font-face'
|
||||
export var COUNTER_STYLE = '@counter-style'
|
||||
export var FONT_FEATURE_VALUES = '@font-feature-values'
|
||||
export var LAYER = '@layer'
|
||||
108
node_modules/@emotion/cache/node_modules/stylis/src/Middleware.js
generated
vendored
Normal file
108
node_modules/@emotion/cache/node_modules/stylis/src/Middleware.js
generated
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'
|
||||
import {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'
|
||||
import {copy, tokenize} from './Tokenizer.js'
|
||||
import {serialize} from './Serializer.js'
|
||||
import {prefix} from './Prefixer.js'
|
||||
|
||||
/**
|
||||
* @param {function[]} collection
|
||||
* @return {function}
|
||||
*/
|
||||
export function middleware (collection) {
|
||||
var length = sizeof(collection)
|
||||
|
||||
return function (element, index, children, callback) {
|
||||
var output = ''
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
output += collection[i](element, index, children, callback) || ''
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {function} callback
|
||||
* @return {function}
|
||||
*/
|
||||
export function rulesheet (callback) {
|
||||
return function (element) {
|
||||
if (!element.root)
|
||||
if (element = element.return)
|
||||
callback(element)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
*/
|
||||
export function prefixer (element, index, children, callback) {
|
||||
if (element.length > -1)
|
||||
if (!element.return)
|
||||
switch (element.type) {
|
||||
case DECLARATION: element.return = prefix(element.value, element.length, children)
|
||||
return
|
||||
case KEYFRAMES:
|
||||
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
|
||||
case RULESET:
|
||||
if (element.length)
|
||||
return combine(element.props, function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only': case ':read-write':
|
||||
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
|
||||
// :placeholder
|
||||
case '::placeholder':
|
||||
return serialize([
|
||||
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
|
||||
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
|
||||
copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
|
||||
], callback)
|
||||
}
|
||||
|
||||
return ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
*/
|
||||
export function namespace (element) {
|
||||
switch (element.type) {
|
||||
case RULESET:
|
||||
element.props = element.props.map(function (value) {
|
||||
return combine(tokenize(value), function (value, index, children) {
|
||||
switch (charat(value, 0)) {
|
||||
// \f
|
||||
case 12:
|
||||
return substr(value, 1, strlen(value))
|
||||
// \0 ( + > ~
|
||||
case 0: case 40: case 43: case 62: case 126:
|
||||
return value
|
||||
// :
|
||||
case 58:
|
||||
if (children[++index] === 'global')
|
||||
children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
|
||||
// \s
|
||||
case 32:
|
||||
return index === 1 ? '' : value
|
||||
default:
|
||||
switch (index) {
|
||||
case 0: element = value
|
||||
return sizeof(children) > 1 ? '' : value
|
||||
case index = sizeof(children) - 1: case 2:
|
||||
return index === 2 ? value + element + element : value + element
|
||||
default:
|
||||
return value
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
191
node_modules/@emotion/cache/node_modules/stylis/src/Parser.js
generated
vendored
Normal file
191
node_modules/@emotion/cache/node_modules/stylis/src/Parser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
import {COMMENT, RULESET, DECLARATION} from './Enum.js'
|
||||
import {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'
|
||||
import {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {object[]}
|
||||
*/
|
||||
export function compile (value) {
|
||||
return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @param {string[]} rule
|
||||
* @param {string[]} rules
|
||||
* @param {string[]} rulesets
|
||||
* @param {number[]} pseudo
|
||||
* @param {number[]} points
|
||||
* @param {string[]} declarations
|
||||
* @return {object}
|
||||
*/
|
||||
export function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
||||
var index = 0
|
||||
var offset = 0
|
||||
var length = pseudo
|
||||
var atrule = 0
|
||||
var property = 0
|
||||
var previous = 0
|
||||
var variable = 1
|
||||
var scanning = 1
|
||||
var ampersand = 1
|
||||
var character = 0
|
||||
var type = ''
|
||||
var props = rules
|
||||
var children = rulesets
|
||||
var reference = rule
|
||||
var characters = type
|
||||
|
||||
while (scanning)
|
||||
switch (previous = character, character = next()) {
|
||||
// (
|
||||
case 40:
|
||||
if (previous != 108 && charat(characters, length - 1) == 58) {
|
||||
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
|
||||
ampersand = -1
|
||||
break
|
||||
}
|
||||
// " ' [
|
||||
case 34: case 39: case 91:
|
||||
characters += delimit(character)
|
||||
break
|
||||
// \t \n \r \s
|
||||
case 9: case 10: case 13: case 32:
|
||||
characters += whitespace(previous)
|
||||
break
|
||||
// \
|
||||
case 92:
|
||||
characters += escaping(caret() - 1, 7)
|
||||
continue
|
||||
// /
|
||||
case 47:
|
||||
switch (peek()) {
|
||||
case 42: case 47:
|
||||
append(comment(commenter(next(), caret()), root, parent), declarations)
|
||||
break
|
||||
default:
|
||||
characters += '/'
|
||||
}
|
||||
break
|
||||
// {
|
||||
case 123 * variable:
|
||||
points[index++] = strlen(characters) * ampersand
|
||||
// } ; \0
|
||||
case 125 * variable: case 59: case 0:
|
||||
switch (character) {
|
||||
// \0 }
|
||||
case 0: case 125: scanning = 0
|
||||
// ;
|
||||
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '')
|
||||
if (property > 0 && (strlen(characters) - length))
|
||||
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
|
||||
break
|
||||
// @ ;
|
||||
case 59: characters += ';'
|
||||
// { rule/at-rule
|
||||
default:
|
||||
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
|
||||
|
||||
if (character === 123)
|
||||
if (offset === 0)
|
||||
parse(characters, root, reference, reference, props, rulesets, length, points, children)
|
||||
else
|
||||
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
||||
// d l m s
|
||||
case 100: case 108: case 109: case 115:
|
||||
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)
|
||||
break
|
||||
default:
|
||||
parse(characters, reference, reference, reference, [''], children, 0, points, children)
|
||||
}
|
||||
}
|
||||
|
||||
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
|
||||
break
|
||||
// :
|
||||
case 58:
|
||||
length = 1 + strlen(characters), property = previous
|
||||
default:
|
||||
if (variable < 1)
|
||||
if (character == 123)
|
||||
--variable
|
||||
else if (character == 125 && variable++ == 0 && prev() == 125)
|
||||
continue
|
||||
|
||||
switch (characters += from(character), character * variable) {
|
||||
// &
|
||||
case 38:
|
||||
ampersand = offset > 0 ? 1 : (characters += '\f', -1)
|
||||
break
|
||||
// ,
|
||||
case 44:
|
||||
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1
|
||||
break
|
||||
// @
|
||||
case 64:
|
||||
// -
|
||||
if (peek() === 45)
|
||||
characters += delimit(next())
|
||||
|
||||
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++
|
||||
break
|
||||
// -
|
||||
case 45:
|
||||
if (previous === 45 && strlen(characters) == 2)
|
||||
variable = 0
|
||||
}
|
||||
}
|
||||
|
||||
return rulesets
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @param {number} index
|
||||
* @param {number} offset
|
||||
* @param {string[]} rules
|
||||
* @param {number[]} points
|
||||
* @param {string} type
|
||||
* @param {string[]} props
|
||||
* @param {string[]} children
|
||||
* @param {number} length
|
||||
* @return {object}
|
||||
*/
|
||||
export function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
|
||||
var post = offset - 1
|
||||
var rule = offset === 0 ? rules : ['']
|
||||
var size = sizeof(rule)
|
||||
|
||||
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
||||
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
||||
if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
|
||||
props[k++] = z
|
||||
|
||||
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @return {object}
|
||||
*/
|
||||
export function comment (value, root, parent) {
|
||||
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object} root
|
||||
* @param {object?} parent
|
||||
* @param {number} length
|
||||
* @return {object}
|
||||
*/
|
||||
export function declaration (value, root, parent, length) {
|
||||
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)
|
||||
}
|
||||
145
node_modules/@emotion/cache/node_modules/stylis/src/Prefixer.js
generated
vendored
Normal file
145
node_modules/@emotion/cache/node_modules/stylis/src/Prefixer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
import {MS, MOZ, WEBKIT} from './Enum.js'
|
||||
import {hash, charat, strlen, indexof, replace, substr, match} from './Utility.js'
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} length
|
||||
* @param {object[]} children
|
||||
* @return {string}
|
||||
*/
|
||||
export function prefix (value, length, children) {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
|
||||
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
|
||||
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
|
||||
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
|
||||
return WEBKIT + value + value
|
||||
// tab-size
|
||||
case 4789:
|
||||
return MOZ + value + value
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
case 5349: case 4246: case 4810: case 6968: case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value
|
||||
// writing-mode
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
|
||||
// vertical-r(l)
|
||||
case 108:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
|
||||
// horizontal(-)tb
|
||||
case 45:
|
||||
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
|
||||
// default: fallthrough to below
|
||||
}
|
||||
// flex, flex-direction, scroll-snap-type, writing-mode
|
||||
case 6828: case 4268: case 2903:
|
||||
return WEBKIT + value + MS + value + value
|
||||
// order
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value
|
||||
// align-items
|
||||
case 5187:
|
||||
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
|
||||
// align-self
|
||||
case 5443:
|
||||
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/g, '') + (!match(value, /flex-|baseline/) ? MS + 'grid-row-' + replace(value, /flex-|-self/g, '') : '') + value
|
||||
// align-content
|
||||
case 4675:
|
||||
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/g, '') + value
|
||||
// flex-shrink
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
|
||||
// flex-basis
|
||||
case 5292:
|
||||
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
|
||||
// flex-grow
|
||||
case 6060:
|
||||
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
|
||||
// transition
|
||||
case 4554:
|
||||
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
|
||||
// cursor
|
||||
case 6187:
|
||||
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
|
||||
// background, background-image
|
||||
case 5495: case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
|
||||
// justify-content
|
||||
case 4968:
|
||||
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
|
||||
// justify-self
|
||||
case 4200:
|
||||
if (!match(value, /flex-|baseline/)) return MS + 'grid-column-align' + substr(value, length) + value
|
||||
break
|
||||
// grid-template-(columns|rows)
|
||||
case 2592: case 3360:
|
||||
return MS + replace(value, 'template-', '') + value
|
||||
// grid-(row|column)-start
|
||||
case 4384: case 3616:
|
||||
if (children && children.some(function (element, index) { return length = index, match(element.props, /grid-\w+-end/) })) {
|
||||
return ~indexof(value + (children = children[length].value), 'span') ? value : (MS + replace(value, '-start', '') + value + MS + 'grid-row-span:' + (~indexof(children, 'span') ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ';')
|
||||
}
|
||||
return MS + replace(value, '-start', '') + value
|
||||
// grid-(row|column)-end
|
||||
case 4896: case 4128:
|
||||
return (children && children.some(function (element) { return match(element.props, /grid-\w+-start/) })) ? value : MS + replace(replace(value, '-end', '-span'), 'span ', '') + value
|
||||
// (margin|padding)-inline-(start|end)
|
||||
case 4095: case 3583: case 4068: case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
case 8116: case 7059: case 5753: case 5535:
|
||||
case 5445: case 5701: case 4933: case 4677:
|
||||
case 5533: case 5789: case 5021: case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6)
|
||||
switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45)
|
||||
break
|
||||
// (f)ill-available, (f)it-content
|
||||
case 102:
|
||||
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
|
||||
// (s)tretch
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length, children) + value : value
|
||||
}
|
||||
break
|
||||
// grid-(column|row)
|
||||
case 5152: case 5920:
|
||||
return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (MS + a + ':' + b + f) + (c ? (MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })
|
||||
// position: sticky
|
||||
case 4949:
|
||||
// stick(y)?
|
||||
if (charat(value, length + 6) === 121)
|
||||
return replace(value, ':', ':' + WEBKIT) + value
|
||||
break
|
||||
// display: (flex|inline-flex|grid|inline-grid)
|
||||
case 6444:
|
||||
switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
|
||||
// (inline-)?fle(x)
|
||||
case 120:
|
||||
return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
|
||||
// (inline-)?gri(d)
|
||||
case 100:
|
||||
return replace(value, ':', ':' + MS) + value
|
||||
}
|
||||
break
|
||||
// scroll-margin, scroll-margin-(top|right|bottom|left)
|
||||
case 5719: case 2647: case 2135: case 3927: case 2391:
|
||||
return replace(value, 'scroll-', 'scroll-snap-') + value
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
36
node_modules/@emotion/cache/node_modules/stylis/src/Serializer.js
generated
vendored
Normal file
36
node_modules/@emotion/cache/node_modules/stylis/src/Serializer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'
|
||||
import {strlen, sizeof} from './Utility.js'
|
||||
|
||||
/**
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function serialize (children, callback) {
|
||||
var output = ''
|
||||
var length = sizeof(children)
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
output += callback(children[i], i, children, callback) || ''
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function stringify (element, index, children, callback) {
|
||||
switch (element.type) {
|
||||
case LAYER: if (element.children.length) break
|
||||
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
||||
case COMMENT: return ''
|
||||
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
||||
case RULESET: element.value = element.props.join(',')
|
||||
}
|
||||
|
||||
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
||||
}
|
||||
246
node_modules/@emotion/cache/node_modules/stylis/src/Tokenizer.js
generated
vendored
Normal file
246
node_modules/@emotion/cache/node_modules/stylis/src/Tokenizer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'
|
||||
|
||||
export var line = 1
|
||||
export var column = 1
|
||||
export var length = 0
|
||||
export var position = 0
|
||||
export var character = 0
|
||||
export var characters = ''
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {object | null} root
|
||||
* @param {object | null} parent
|
||||
* @param {string} type
|
||||
* @param {string[] | string} props
|
||||
* @param {object[] | string} children
|
||||
* @param {number} length
|
||||
*/
|
||||
export function node (value, root, parent, type, props, children, length) {
|
||||
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} root
|
||||
* @param {object} props
|
||||
* @return {object}
|
||||
*/
|
||||
export function copy (root, props) {
|
||||
return assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function char () {
|
||||
return character
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function prev () {
|
||||
character = position > 0 ? charat(characters, --position) : 0
|
||||
|
||||
if (column--, character === 10)
|
||||
column = 1, line--
|
||||
|
||||
return character
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function next () {
|
||||
character = position < length ? charat(characters, position++) : 0
|
||||
|
||||
if (column++, character === 10)
|
||||
column = 1, line++
|
||||
|
||||
return character
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function peek () {
|
||||
return charat(characters, position)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
export function caret () {
|
||||
return position
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} begin
|
||||
* @param {number} end
|
||||
* @return {string}
|
||||
*/
|
||||
export function slice (begin, end) {
|
||||
return substr(characters, begin, end)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {number}
|
||||
*/
|
||||
export function token (type) {
|
||||
switch (type) {
|
||||
// \0 \t \n \r \s whitespace token
|
||||
case 0: case 9: case 10: case 13: case 32:
|
||||
return 5
|
||||
// ! + , / > @ ~ isolate token
|
||||
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
|
||||
// ; { } breakpoint token
|
||||
case 59: case 123: case 125:
|
||||
return 4
|
||||
// : accompanied token
|
||||
case 58:
|
||||
return 3
|
||||
// " ' ( [ opening delimit token
|
||||
case 34: case 39: case 40: case 91:
|
||||
return 2
|
||||
// ) ] closing delimit token
|
||||
case 41: case 93:
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {any[]}
|
||||
*/
|
||||
export function alloc (value) {
|
||||
return line = column = 1, length = strlen(characters = value), position = 0, []
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} value
|
||||
* @return {any}
|
||||
*/
|
||||
export function dealloc (value) {
|
||||
return characters = '', value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {string}
|
||||
*/
|
||||
export function delimit (type) {
|
||||
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {string[]}
|
||||
*/
|
||||
export function tokenize (value) {
|
||||
return dealloc(tokenizer(alloc(value)))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {string}
|
||||
*/
|
||||
export function whitespace (type) {
|
||||
while (character = peek())
|
||||
if (character < 33)
|
||||
next()
|
||||
else
|
||||
break
|
||||
|
||||
return token(type) > 2 || token(character) > 3 ? '' : ' '
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} children
|
||||
* @return {string[]}
|
||||
*/
|
||||
export function tokenizer (children) {
|
||||
while (next())
|
||||
switch (token(character)) {
|
||||
case 0: append(identifier(position - 1), children)
|
||||
break
|
||||
case 2: append(delimit(character), children)
|
||||
break
|
||||
default: append(from(character), children)
|
||||
}
|
||||
|
||||
return children
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @param {number} count
|
||||
* @return {string}
|
||||
*/
|
||||
export function escaping (index, count) {
|
||||
while (--count && next())
|
||||
// not 0-9 A-F a-f
|
||||
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
|
||||
break
|
||||
|
||||
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @return {number}
|
||||
*/
|
||||
export function delimiter (type) {
|
||||
while (next())
|
||||
switch (character) {
|
||||
// ] ) " '
|
||||
case type:
|
||||
return position
|
||||
// " '
|
||||
case 34: case 39:
|
||||
if (type !== 34 && type !== 39)
|
||||
delimiter(character)
|
||||
break
|
||||
// (
|
||||
case 40:
|
||||
if (type === 41)
|
||||
delimiter(type)
|
||||
break
|
||||
// \
|
||||
case 92:
|
||||
next()
|
||||
break
|
||||
}
|
||||
|
||||
return position
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} type
|
||||
* @param {number} index
|
||||
* @return {number}
|
||||
*/
|
||||
export function commenter (type, index) {
|
||||
while (next())
|
||||
// //
|
||||
if (type + character === 47 + 10)
|
||||
break
|
||||
// /*
|
||||
else if (type + character === 42 + 42 && peek() === 47)
|
||||
break
|
||||
|
||||
return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @return {string}
|
||||
*/
|
||||
export function identifier (index) {
|
||||
while (!token(peek()))
|
||||
next()
|
||||
|
||||
return slice(index, position)
|
||||
}
|
||||
115
node_modules/@emotion/cache/node_modules/stylis/src/Utility.js
generated
vendored
Normal file
115
node_modules/@emotion/cache/node_modules/stylis/src/Utility.js
generated
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* @param {number}
|
||||
* @return {number}
|
||||
*/
|
||||
export var abs = Math.abs
|
||||
|
||||
/**
|
||||
* @param {number}
|
||||
* @return {string}
|
||||
*/
|
||||
export var from = String.fromCharCode
|
||||
|
||||
/**
|
||||
* @param {object}
|
||||
* @return {object}
|
||||
*/
|
||||
export var assign = Object.assign
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} length
|
||||
* @return {number}
|
||||
*/
|
||||
export function hash (value, length) {
|
||||
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {string}
|
||||
*/
|
||||
export function trim (value) {
|
||||
return value.trim()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {RegExp} pattern
|
||||
* @return {string?}
|
||||
*/
|
||||
export function match (value, pattern) {
|
||||
return (value = pattern.exec(value)) ? value[0] : value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {(string|RegExp)} pattern
|
||||
* @param {string} replacement
|
||||
* @return {string}
|
||||
*/
|
||||
export function replace (value, pattern, replacement) {
|
||||
return value.replace(pattern, replacement)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {string} search
|
||||
* @return {number}
|
||||
*/
|
||||
export function indexof (value, search) {
|
||||
return value.indexOf(search)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} index
|
||||
* @return {number}
|
||||
*/
|
||||
export function charat (value, index) {
|
||||
return value.charCodeAt(index) | 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} begin
|
||||
* @param {number} end
|
||||
* @return {string}
|
||||
*/
|
||||
export function substr (value, begin, end) {
|
||||
return value.slice(begin, end)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {number}
|
||||
*/
|
||||
export function strlen (value) {
|
||||
return value.length
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any[]} value
|
||||
* @return {number}
|
||||
*/
|
||||
export function sizeof (value) {
|
||||
return value.length
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} value
|
||||
* @param {any[]} array
|
||||
* @return {any}
|
||||
*/
|
||||
export function append (value, array) {
|
||||
return array.push(value), value
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} array
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function combine (array, callback) {
|
||||
return array.map(callback).join('')
|
||||
}
|
||||
100
node_modules/@emotion/cache/package.json
generated
vendored
Normal file
100
node_modules/@emotion/cache/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
{
|
||||
"name": "@emotion/cache",
|
||||
"version": "11.14.0",
|
||||
"description": "emotion's cache",
|
||||
"main": "dist/emotion-cache.cjs.js",
|
||||
"module": "dist/emotion-cache.esm.js",
|
||||
"types": "dist/emotion-cache.cjs.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"import": "./dist/emotion-cache.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.cjs.js"
|
||||
},
|
||||
"development": {
|
||||
"edge-light": {
|
||||
"module": "./dist/emotion-cache.development.edge-light.esm.js",
|
||||
"import": "./dist/emotion-cache.development.edge-light.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.development.edge-light.cjs.js"
|
||||
},
|
||||
"worker": {
|
||||
"module": "./dist/emotion-cache.development.edge-light.esm.js",
|
||||
"import": "./dist/emotion-cache.development.edge-light.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.development.edge-light.cjs.js"
|
||||
},
|
||||
"workerd": {
|
||||
"module": "./dist/emotion-cache.development.edge-light.esm.js",
|
||||
"import": "./dist/emotion-cache.development.edge-light.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.development.edge-light.cjs.js"
|
||||
},
|
||||
"browser": {
|
||||
"module": "./dist/emotion-cache.browser.development.esm.js",
|
||||
"import": "./dist/emotion-cache.browser.development.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.browser.development.cjs.js"
|
||||
},
|
||||
"module": "./dist/emotion-cache.development.esm.js",
|
||||
"import": "./dist/emotion-cache.development.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.development.cjs.js"
|
||||
},
|
||||
"edge-light": {
|
||||
"module": "./dist/emotion-cache.edge-light.esm.js",
|
||||
"import": "./dist/emotion-cache.edge-light.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.edge-light.cjs.js"
|
||||
},
|
||||
"worker": {
|
||||
"module": "./dist/emotion-cache.edge-light.esm.js",
|
||||
"import": "./dist/emotion-cache.edge-light.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.edge-light.cjs.js"
|
||||
},
|
||||
"workerd": {
|
||||
"module": "./dist/emotion-cache.edge-light.esm.js",
|
||||
"import": "./dist/emotion-cache.edge-light.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.edge-light.cjs.js"
|
||||
},
|
||||
"browser": {
|
||||
"module": "./dist/emotion-cache.browser.esm.js",
|
||||
"import": "./dist/emotion-cache.browser.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.browser.cjs.js"
|
||||
},
|
||||
"module": "./dist/emotion-cache.esm.js",
|
||||
"import": "./dist/emotion-cache.cjs.mjs",
|
||||
"default": "./dist/emotion-cache.cjs.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"imports": {
|
||||
"#is-development": {
|
||||
"development": "./src/conditions/true.ts",
|
||||
"default": "./src/conditions/false.ts"
|
||||
},
|
||||
"#is-browser": {
|
||||
"edge-light": "./src/conditions/false.ts",
|
||||
"workerd": "./src/conditions/false.ts",
|
||||
"worker": "./src/conditions/false.ts",
|
||||
"browser": "./src/conditions/true.ts",
|
||||
"default": "./src/conditions/is-browser.ts"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/cache",
|
||||
"scripts": {
|
||||
"test:typescript": "dtslint types"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/memoize": "^0.9.0",
|
||||
"@emotion/sheet": "^1.4.0",
|
||||
"@emotion/utils": "^1.4.2",
|
||||
"@emotion/weak-memoize": "^0.4.0",
|
||||
"stylis": "4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@definitelytyped/dtslint": "0.0.112",
|
||||
"@emotion/hash": "*",
|
||||
"@types/stylis": "^4.2.7",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
1
node_modules/@emotion/cache/src/conditions/false.ts
generated
vendored
Normal file
1
node_modules/@emotion/cache/src/conditions/false.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default false
|
||||
1
node_modules/@emotion/cache/src/conditions/is-browser.ts
generated
vendored
Normal file
1
node_modules/@emotion/cache/src/conditions/is-browser.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default typeof document !== 'undefined'
|
||||
1
node_modules/@emotion/cache/src/conditions/true.ts
generated
vendored
Normal file
1
node_modules/@emotion/cache/src/conditions/true.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default true
|
||||
259
node_modules/@emotion/cache/src/index.ts
generated
vendored
Normal file
259
node_modules/@emotion/cache/src/index.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
import { StyleSheet } from '@emotion/sheet'
|
||||
import type { EmotionCache, SerializedStyles } from '@emotion/utils'
|
||||
import {
|
||||
serialize,
|
||||
compile,
|
||||
middleware,
|
||||
rulesheet,
|
||||
stringify,
|
||||
COMMENT
|
||||
} from 'stylis'
|
||||
import type { Element as StylisElement } from 'stylis'
|
||||
import weakMemoize from '@emotion/weak-memoize'
|
||||
import memoize from '@emotion/memoize'
|
||||
import isDevelopment from '#is-development'
|
||||
import isBrowser from '#is-browser'
|
||||
import {
|
||||
compat,
|
||||
removeLabel,
|
||||
createUnsafeSelectorsAlarm,
|
||||
incorrectImportAlarm
|
||||
} from './stylis-plugins'
|
||||
import { prefixer } from './prefixer'
|
||||
import { StylisPlugin } from './types'
|
||||
|
||||
export interface Options {
|
||||
nonce?: string
|
||||
stylisPlugins?: Array<StylisPlugin>
|
||||
key: string
|
||||
container?: Node
|
||||
speedy?: boolean
|
||||
/** @deprecate use `insertionPoint` instead */
|
||||
prepend?: boolean
|
||||
insertionPoint?: HTMLElement
|
||||
}
|
||||
|
||||
let getServerStylisCache = isBrowser
|
||||
? undefined
|
||||
: weakMemoize(() => memoize<Record<string, string>>(() => ({})))
|
||||
|
||||
const defaultStylisPlugins = [prefixer]
|
||||
|
||||
let getSourceMap: ((styles: string) => string | undefined) | undefined
|
||||
if (isDevelopment) {
|
||||
let sourceMapPattern =
|
||||
/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g
|
||||
getSourceMap = styles => {
|
||||
let matches = styles.match(sourceMapPattern)
|
||||
if (!matches) return
|
||||
return matches[matches.length - 1]
|
||||
}
|
||||
}
|
||||
|
||||
let createCache = (options: Options): EmotionCache => {
|
||||
let key = options.key
|
||||
|
||||
if (isDevelopment && !key) {
|
||||
throw new Error(
|
||||
"You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" +
|
||||
`If multiple caches share the same key they might "fight" for each other's style elements.`
|
||||
)
|
||||
}
|
||||
|
||||
if (isBrowser && key === 'css') {
|
||||
const ssrStyles = document.querySelectorAll(
|
||||
`style[data-emotion]:not([data-s])`
|
||||
)
|
||||
|
||||
// get SSRed styles out of the way of React's hydration
|
||||
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
||||
// note this very very intentionally targets all style elements regardless of the key to ensure
|
||||
// that creating a cache works inside of render of a React component
|
||||
Array.prototype.forEach.call(ssrStyles, (node: HTMLStyleElement) => {
|
||||
// we want to only move elements which have a space in the data-emotion attribute value
|
||||
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
||||
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
||||
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
||||
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
||||
// will not result in the Emotion 10 styles being destroyed
|
||||
const dataEmotionAttribute = node.getAttribute('data-emotion')!
|
||||
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
||||
return
|
||||
}
|
||||
|
||||
document.head.appendChild(node)
|
||||
node.setAttribute('data-s', '')
|
||||
})
|
||||
}
|
||||
|
||||
const stylisPlugins = options.stylisPlugins || defaultStylisPlugins
|
||||
|
||||
if (isDevelopment) {
|
||||
if (/[^a-z-]/.test(key)) {
|
||||
throw new Error(
|
||||
`Emotion key must only contain lower case alphabetical characters and - but "${key}" was passed`
|
||||
)
|
||||
}
|
||||
}
|
||||
let inserted: EmotionCache['inserted'] = {}
|
||||
let container: Node
|
||||
const nodesToHydrate: HTMLStyleElement[] = []
|
||||
if (isBrowser) {
|
||||
container = options.container || document.head
|
||||
|
||||
Array.prototype.forEach.call(
|
||||
// this means we will ignore elements which don't have a space in them which
|
||||
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
||||
document.querySelectorAll(`style[data-emotion^="${key} "]`),
|
||||
(node: HTMLStyleElement) => {
|
||||
const attrib = node.getAttribute(`data-emotion`)!.split(' ')
|
||||
for (let i = 1; i < attrib.length; i++) {
|
||||
inserted[attrib[i]] = true
|
||||
}
|
||||
nodesToHydrate.push(node)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
let insert: (
|
||||
selector: string,
|
||||
serialized: SerializedStyles,
|
||||
sheet: StyleSheet,
|
||||
shouldCache: boolean
|
||||
) => string | void
|
||||
const omnipresentPlugins = [compat, removeLabel]
|
||||
|
||||
if (isDevelopment) {
|
||||
omnipresentPlugins.push(
|
||||
createUnsafeSelectorsAlarm({
|
||||
get compat() {
|
||||
return cache.compat
|
||||
}
|
||||
}),
|
||||
incorrectImportAlarm
|
||||
)
|
||||
}
|
||||
|
||||
if (!getServerStylisCache) {
|
||||
let currentSheet: Pick<StyleSheet, 'insert'>
|
||||
|
||||
const finalizingPlugins = [
|
||||
stringify,
|
||||
isDevelopment
|
||||
? (element: StylisElement) => {
|
||||
if (!element.root) {
|
||||
if (element.return) {
|
||||
currentSheet.insert(element.return)
|
||||
} else if (element.value && element.type !== COMMENT) {
|
||||
// insert empty rule in non-production environments
|
||||
// so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
|
||||
currentSheet.insert(`${element.value}{}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
: rulesheet(rule => {
|
||||
currentSheet.insert(rule)
|
||||
})
|
||||
]
|
||||
|
||||
const serializer = middleware(
|
||||
omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)
|
||||
)
|
||||
const stylis = (styles: string) => serialize(compile(styles), serializer)
|
||||
|
||||
insert = (selector, serialized, sheet, shouldCache) => {
|
||||
currentSheet = sheet
|
||||
|
||||
if (getSourceMap) {
|
||||
let sourceMap = getSourceMap(serialized.styles)
|
||||
if (sourceMap) {
|
||||
currentSheet = {
|
||||
insert: rule => {
|
||||
sheet.insert(rule + sourceMap)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stylis(selector ? `${selector}{${serialized.styles}}` : serialized.styles)
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[serialized.name] = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const finalizingPlugins = [stringify]
|
||||
const serializer = middleware(
|
||||
omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)
|
||||
)
|
||||
const stylis = (styles: string) => serialize(compile(styles), serializer)
|
||||
|
||||
let serverStylisCache = getServerStylisCache(stylisPlugins)(key)
|
||||
let getRules = (selector: string, serialized: SerializedStyles): string => {
|
||||
let name = serialized.name
|
||||
if (serverStylisCache[name] === undefined) {
|
||||
serverStylisCache[name] = stylis(
|
||||
selector ? `${selector}{${serialized.styles}}` : serialized.styles
|
||||
)
|
||||
}
|
||||
return serverStylisCache[name]
|
||||
}
|
||||
insert = (selector, serialized, sheet, shouldCache) => {
|
||||
let name = serialized.name
|
||||
let rules = getRules(selector, serialized)
|
||||
if (cache.compat === undefined) {
|
||||
// in regular mode, we don't set the styles on the inserted cache
|
||||
// since we don't need to and that would be wasting memory
|
||||
// we return them so that they are rendered in a style tag
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = true
|
||||
}
|
||||
if (getSourceMap) {
|
||||
let sourceMap = getSourceMap(serialized.styles)
|
||||
if (sourceMap) {
|
||||
return rules + sourceMap
|
||||
}
|
||||
}
|
||||
return rules
|
||||
} else {
|
||||
// in compat mode, we put the styles on the inserted cache so
|
||||
// that emotion-server can pull out the styles
|
||||
// except when we don't want to cache it which was in Global but now
|
||||
// is nowhere but we don't want to do a major right now
|
||||
// and just in case we're going to leave the case here
|
||||
// it's also not affecting client side bundle size
|
||||
// so it's really not a big deal
|
||||
|
||||
if (shouldCache) {
|
||||
cache.inserted[name] = rules
|
||||
} else {
|
||||
return rules
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const cache: EmotionCache = {
|
||||
key,
|
||||
sheet: new StyleSheet({
|
||||
key,
|
||||
container: container!,
|
||||
nonce: options.nonce,
|
||||
speedy: options.speedy,
|
||||
prepend: options.prepend,
|
||||
insertionPoint: options.insertionPoint
|
||||
}),
|
||||
nonce: options.nonce,
|
||||
inserted,
|
||||
registered: {},
|
||||
insert
|
||||
}
|
||||
|
||||
cache.sheet.hydrate(nodesToHydrate)
|
||||
|
||||
return cache
|
||||
}
|
||||
|
||||
export default createCache
|
||||
export type { EmotionCache }
|
||||
export type { StylisElement, StylisPlugin, StylisPluginCallback } from './types'
|
||||
347
node_modules/@emotion/cache/src/prefixer.ts
generated
vendored
Normal file
347
node_modules/@emotion/cache/src/prefixer.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
/* eslint-disable no-fallthrough */
|
||||
/* eslint-disable eqeqeq */
|
||||
import {
|
||||
charat,
|
||||
combine,
|
||||
copy,
|
||||
DECLARATION,
|
||||
hash,
|
||||
indexof,
|
||||
KEYFRAMES,
|
||||
match,
|
||||
MOZ,
|
||||
MS,
|
||||
replace,
|
||||
RULESET,
|
||||
serialize,
|
||||
strlen,
|
||||
WEBKIT,
|
||||
Element,
|
||||
Middleware
|
||||
} from 'stylis'
|
||||
|
||||
// this is a copy of stylis@4.0.13 prefixer, the latter version introduced grid prefixing which we don't want
|
||||
|
||||
function prefix(value: string, length: number): string {
|
||||
switch (hash(value, length)) {
|
||||
// color-adjust
|
||||
case 5103:
|
||||
return WEBKIT + 'print-' + value + value
|
||||
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
||||
case 5737:
|
||||
case 4201:
|
||||
case 3177:
|
||||
case 3433:
|
||||
case 1641:
|
||||
case 4457:
|
||||
case 2921:
|
||||
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
||||
case 5572:
|
||||
case 6356:
|
||||
case 5844:
|
||||
case 3191:
|
||||
case 6645:
|
||||
case 3005:
|
||||
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
||||
case 6391:
|
||||
case 5879:
|
||||
case 5623:
|
||||
case 6135:
|
||||
case 4599:
|
||||
case 4855:
|
||||
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
||||
case 4215:
|
||||
case 6389:
|
||||
case 5109:
|
||||
case 5365:
|
||||
case 5621:
|
||||
case 3829:
|
||||
return WEBKIT + value + value
|
||||
// appearance, user-select, transform, hyphens, text-size-adjust
|
||||
case 5349:
|
||||
case 4246:
|
||||
case 4810:
|
||||
case 6968:
|
||||
case 2756:
|
||||
return WEBKIT + value + MOZ + value + MS + value + value
|
||||
// flex, flex-direction
|
||||
case 6828:
|
||||
case 4268:
|
||||
return WEBKIT + value + MS + value + value
|
||||
// order
|
||||
case 6165:
|
||||
return WEBKIT + value + MS + 'flex-' + value + value
|
||||
// align-items
|
||||
case 5187:
|
||||
return (
|
||||
WEBKIT +
|
||||
value +
|
||||
replace(
|
||||
value,
|
||||
/(\w+).+(:[^]+)/,
|
||||
WEBKIT + 'box-$1$2' + MS + 'flex-$1$2'
|
||||
) +
|
||||
value
|
||||
)
|
||||
// align-self
|
||||
case 5443:
|
||||
return (
|
||||
WEBKIT +
|
||||
value +
|
||||
MS +
|
||||
'flex-item-' +
|
||||
replace(value, /flex-|-self/, '') +
|
||||
value
|
||||
)
|
||||
// align-content
|
||||
case 4675:
|
||||
return (
|
||||
WEBKIT +
|
||||
value +
|
||||
MS +
|
||||
'flex-line-pack' +
|
||||
replace(value, /align-content|flex-|-self/, '') +
|
||||
value
|
||||
)
|
||||
// flex-shrink
|
||||
case 5548:
|
||||
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
|
||||
// flex-basis
|
||||
case 5292:
|
||||
return (
|
||||
WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
|
||||
)
|
||||
// flex-grow
|
||||
case 6060:
|
||||
return (
|
||||
WEBKIT +
|
||||
'box-' +
|
||||
replace(value, '-grow', '') +
|
||||
WEBKIT +
|
||||
value +
|
||||
MS +
|
||||
replace(value, 'grow', 'positive') +
|
||||
value
|
||||
)
|
||||
// transition
|
||||
case 4554:
|
||||
return (
|
||||
WEBKIT +
|
||||
replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') +
|
||||
value
|
||||
)
|
||||
// cursor
|
||||
case 6187:
|
||||
return (
|
||||
replace(
|
||||
replace(
|
||||
replace(value, /(zoom-|grab)/, WEBKIT + '$1'),
|
||||
/(image-set)/,
|
||||
WEBKIT + '$1'
|
||||
),
|
||||
value,
|
||||
''
|
||||
) + value
|
||||
)
|
||||
// background, background-image
|
||||
case 5495:
|
||||
case 3959:
|
||||
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
|
||||
// justify-content
|
||||
case 4968:
|
||||
return (
|
||||
replace(
|
||||
replace(
|
||||
value,
|
||||
/(.+:)(flex-)?(.*)/,
|
||||
WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'
|
||||
),
|
||||
/s.+-b[^;]+/,
|
||||
'justify'
|
||||
) +
|
||||
WEBKIT +
|
||||
value +
|
||||
value
|
||||
)
|
||||
// (margin|padding)-inline-(start|end)
|
||||
case 4095:
|
||||
case 3583:
|
||||
case 4068:
|
||||
case 2532:
|
||||
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
|
||||
// (min|max)?(width|height|inline-size|block-size)
|
||||
case 8116:
|
||||
case 7059:
|
||||
case 5753:
|
||||
case 5535:
|
||||
case 5445:
|
||||
case 5701:
|
||||
case 4933:
|
||||
case 4677:
|
||||
case 5533:
|
||||
case 5789:
|
||||
case 5021:
|
||||
case 4765:
|
||||
// stretch, max-content, min-content, fill-available
|
||||
if (strlen(value) - 1 - length > 6)
|
||||
switch (charat(value, length + 1)) {
|
||||
// (m)ax-content, (m)in-content
|
||||
case 109:
|
||||
// -
|
||||
if (charat(value, length + 4) !== 45) break
|
||||
// (f)ill-available, (f)it-content
|
||||
case 102:
|
||||
return (
|
||||
replace(
|
||||
value,
|
||||
/(.+:)(.+)-([^]+)/,
|
||||
'$1' +
|
||||
WEBKIT +
|
||||
'$2-$3' +
|
||||
'$1' +
|
||||
MOZ +
|
||||
(charat(value, length + 3) == 108 ? '$3' : '$2-$3')
|
||||
) + value
|
||||
)
|
||||
// (s)tretch
|
||||
case 115:
|
||||
return ~indexof(value, 'stretch')
|
||||
? prefix(replace(value, 'stretch', 'fill-available'), length) +
|
||||
value
|
||||
: value
|
||||
}
|
||||
break
|
||||
// position: sticky
|
||||
case 4949:
|
||||
// (s)ticky?
|
||||
if (charat(value, length + 1) !== 115) break
|
||||
// display: (flex|inline-flex)
|
||||
case 6444:
|
||||
switch (
|
||||
charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))
|
||||
) {
|
||||
// stic(k)y
|
||||
case 107:
|
||||
return replace(value, ':', ':' + WEBKIT) + value
|
||||
// (inline-)?fl(e)x
|
||||
case 101:
|
||||
return (
|
||||
replace(
|
||||
value,
|
||||
/(.+:)([^;!]+)(;|!.+)?/,
|
||||
'$1' +
|
||||
WEBKIT +
|
||||
(charat(value, 14) === 45 ? 'inline-' : '') +
|
||||
'box$3' +
|
||||
'$1' +
|
||||
WEBKIT +
|
||||
'$2$3' +
|
||||
'$1' +
|
||||
MS +
|
||||
'$2box$3'
|
||||
) + value
|
||||
)
|
||||
}
|
||||
break
|
||||
// writing-mode
|
||||
case 5936:
|
||||
switch (charat(value, length + 11)) {
|
||||
// vertical-l(r)
|
||||
case 114:
|
||||
return (
|
||||
WEBKIT +
|
||||
value +
|
||||
MS +
|
||||
replace(value, /[svh]\w+-[tblr]{2}/, 'tb') +
|
||||
value
|
||||
)
|
||||
// vertical-r(l)
|
||||
case 108:
|
||||
return (
|
||||
WEBKIT +
|
||||
value +
|
||||
MS +
|
||||
replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') +
|
||||
value
|
||||
)
|
||||
// horizontal(-)tb
|
||||
case 45:
|
||||
return (
|
||||
WEBKIT +
|
||||
value +
|
||||
MS +
|
||||
replace(value, /[svh]\w+-[tblr]{2}/, 'lr') +
|
||||
value
|
||||
)
|
||||
}
|
||||
|
||||
return WEBKIT + value + MS + value + value
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
export let prefixer = (
|
||||
element: Element,
|
||||
index: number,
|
||||
children: Element[],
|
||||
callback: Middleware
|
||||
) => {
|
||||
if (element.length > -1)
|
||||
if (!element.return)
|
||||
switch (element.type) {
|
||||
case DECLARATION:
|
||||
element.return = prefix(element.value, element.length)
|
||||
break
|
||||
case KEYFRAMES:
|
||||
return serialize(
|
||||
[
|
||||
copy(element, {
|
||||
value: replace(element.value, '@', '@' + WEBKIT)
|
||||
})
|
||||
],
|
||||
callback
|
||||
)
|
||||
case RULESET:
|
||||
if (element.length)
|
||||
return combine(element.props as string[], function (value) {
|
||||
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
||||
// :read-(only|write)
|
||||
case ':read-only':
|
||||
case ':read-write':
|
||||
return serialize(
|
||||
[
|
||||
copy(element, {
|
||||
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
||||
})
|
||||
],
|
||||
callback
|
||||
)
|
||||
// :placeholder
|
||||
case '::placeholder':
|
||||
return serialize(
|
||||
[
|
||||
copy(element, {
|
||||
props: [
|
||||
replace(
|
||||
value,
|
||||
/:(plac\w+)/,
|
||||
':' + WEBKIT + 'input-$1'
|
||||
)
|
||||
]
|
||||
}),
|
||||
copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
||||
}),
|
||||
copy(element, {
|
||||
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
||||
})
|
||||
],
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
return ''
|
||||
})
|
||||
}
|
||||
}
|
||||
277
node_modules/@emotion/cache/src/stylis-plugins.ts
generated
vendored
Normal file
277
node_modules/@emotion/cache/src/stylis-plugins.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,277 @@
|
|||
import { EmotionCache } from '@emotion/utils'
|
||||
import {
|
||||
alloc,
|
||||
dealloc,
|
||||
delimit,
|
||||
Element,
|
||||
from,
|
||||
Middleware,
|
||||
next,
|
||||
peek,
|
||||
position,
|
||||
slice,
|
||||
token
|
||||
} from 'stylis'
|
||||
|
||||
// based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
|
||||
const identifierWithPointTracking = (
|
||||
begin: number,
|
||||
points: number[],
|
||||
index: number
|
||||
) => {
|
||||
let previous = 0
|
||||
let character = 0
|
||||
|
||||
while (true) {
|
||||
previous = character
|
||||
character = peek()
|
||||
|
||||
// &\f
|
||||
if (previous === 38 && character === 12) {
|
||||
points[index] = 1
|
||||
}
|
||||
|
||||
if (token(character)) {
|
||||
break
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
return slice(begin, position)
|
||||
}
|
||||
|
||||
const toRules = (parsed: string[], points: number[]) => {
|
||||
// pretend we've started with a comma
|
||||
let index = -1
|
||||
let character = 44
|
||||
|
||||
do {
|
||||
switch (token(character)) {
|
||||
case 0:
|
||||
// &\f
|
||||
if (character === 38 && peek() === 12) {
|
||||
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
||||
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
||||
// and when it should just concatenate the outer and inner selectors
|
||||
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
||||
points[index] = 1
|
||||
}
|
||||
parsed[index] += identifierWithPointTracking(
|
||||
position - 1,
|
||||
points,
|
||||
index
|
||||
)
|
||||
break
|
||||
case 2:
|
||||
parsed[index] += delimit(character)
|
||||
break
|
||||
case 4:
|
||||
// comma
|
||||
if (character === 44) {
|
||||
// colon
|
||||
parsed[++index] = peek() === 58 ? '&\f' : ''
|
||||
points[index] = parsed[index].length
|
||||
break
|
||||
}
|
||||
// fallthrough
|
||||
default:
|
||||
parsed[index] += from(character)
|
||||
}
|
||||
} while ((character = next()))
|
||||
|
||||
return parsed
|
||||
}
|
||||
|
||||
const getRules = (value: string, points: number[]) =>
|
||||
dealloc(toRules(alloc(value) as string[], points))
|
||||
|
||||
// WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
||||
const fixedElements = /* #__PURE__ */ new WeakMap()
|
||||
|
||||
export let compat: Middleware = element => {
|
||||
if (
|
||||
element.type !== 'rule' ||
|
||||
!element.parent ||
|
||||
// positive .length indicates that this rule contains pseudo
|
||||
// negative .length indicates that this rule has been already prefixed
|
||||
element.length < 1
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
let value = element.value
|
||||
let parent: Element | null = element.parent
|
||||
let isImplicitRule =
|
||||
element.column === parent.column && element.line === parent.line
|
||||
|
||||
while (parent.type !== 'rule') {
|
||||
parent = parent.parent
|
||||
if (!parent) return
|
||||
}
|
||||
|
||||
// short-circuit for the simplest case
|
||||
if (
|
||||
element.props.length === 1 &&
|
||||
value.charCodeAt(0) !== 58 /* colon */ &&
|
||||
!fixedElements.get(parent)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
||||
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
||||
if (isImplicitRule) {
|
||||
return
|
||||
}
|
||||
|
||||
fixedElements.set(element, true)
|
||||
|
||||
const points: number[] = []
|
||||
const rules = getRules(value, points)
|
||||
const parentRules = parent.props
|
||||
|
||||
for (let i = 0, k = 0; i < rules.length; i++) {
|
||||
for (let j = 0; j < parentRules.length; j++, k++) {
|
||||
;(element.props as string[])[k] = points[i]
|
||||
? rules[i].replace(/&\f/g, parentRules[j])
|
||||
: `${parentRules[j]} ${rules[i]}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export let removeLabel: Middleware = element => {
|
||||
if (element.type === 'decl') {
|
||||
const value = element.value
|
||||
if (
|
||||
// charcode for l
|
||||
value.charCodeAt(0) === 108 &&
|
||||
// charcode for b
|
||||
value.charCodeAt(2) === 98
|
||||
) {
|
||||
// this ignores label
|
||||
element.return = ''
|
||||
element.value = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ignoreFlag =
|
||||
'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'
|
||||
|
||||
const isIgnoringComment = (element: Element) =>
|
||||
element.type === 'comm' &&
|
||||
(element.children as string).indexOf(ignoreFlag) > -1
|
||||
|
||||
export let createUnsafeSelectorsAlarm =
|
||||
(cache: Pick<EmotionCache, 'compat'>): Middleware =>
|
||||
(element, index, children) => {
|
||||
if (element.type !== 'rule' || cache.compat) return
|
||||
|
||||
const unsafePseudoClasses = element.value.match(
|
||||
/(:first|:nth|:nth-last)-child/g
|
||||
)
|
||||
|
||||
if (unsafePseudoClasses) {
|
||||
const isNested = !!element.parent
|
||||
// in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
|
||||
//
|
||||
// considering this input:
|
||||
// .a {
|
||||
// .b /* comm */ {}
|
||||
// color: hotpink;
|
||||
// }
|
||||
// we get output corresponding to this:
|
||||
// .a {
|
||||
// & {
|
||||
// /* comm */
|
||||
// color: hotpink;
|
||||
// }
|
||||
// .b {}
|
||||
// }
|
||||
const commentContainer = isNested
|
||||
? element.parent!.children
|
||||
: // global rule at the root level
|
||||
children
|
||||
|
||||
for (let i = commentContainer.length - 1; i >= 0; i--) {
|
||||
const node = commentContainer[i] as Element
|
||||
|
||||
if (node.line < element.line) {
|
||||
break
|
||||
}
|
||||
|
||||
// it is quite weird but comments are *usually* put at `column: element.column - 1`
|
||||
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
|
||||
// this will also match inputs like this:
|
||||
// .a {
|
||||
// /* comm */
|
||||
// .b {}
|
||||
// }
|
||||
//
|
||||
// but that is fine
|
||||
//
|
||||
// it would be the easiest to change the placement of the comment to be the first child of the rule:
|
||||
// .a {
|
||||
// .b { /* comm */ }
|
||||
// }
|
||||
// with such inputs we wouldn't have to search for the comment at all
|
||||
// TODO: consider changing this comment placement in the next major version
|
||||
if (node.column < element.column) {
|
||||
if (isIgnoringComment(node)) {
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
unsafePseudoClasses.forEach(unsafePseudoClass => {
|
||||
console.error(
|
||||
`The pseudo class "${unsafePseudoClass}" is potentially unsafe when doing server-side rendering. Try changing it to "${
|
||||
unsafePseudoClass.split('-child')[0]
|
||||
}-of-type".`
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let isImportRule = (element: Element) =>
|
||||
element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64
|
||||
|
||||
const isPrependedWithRegularRules = (index: number, children: Element[]) => {
|
||||
for (let i = index - 1; i >= 0; i--) {
|
||||
if (!isImportRule(children[i])) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// use this to remove incorrect elements from further processing
|
||||
// so they don't get handed to the `sheet` (or anything else)
|
||||
// as that could potentially lead to additional logs which in turn could be overhelming to the user
|
||||
const nullifyElement = (element: Element) => {
|
||||
element.type = ''
|
||||
element.value = ''
|
||||
element.return = ''
|
||||
element.children = ''
|
||||
element.props = ''
|
||||
}
|
||||
|
||||
export let incorrectImportAlarm: Middleware = (element, index, children) => {
|
||||
if (!isImportRule(element)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (element.parent) {
|
||||
console.error(
|
||||
"`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."
|
||||
)
|
||||
nullifyElement(element)
|
||||
} else if (isPrependedWithRegularRules(index, children)) {
|
||||
console.error(
|
||||
"`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."
|
||||
)
|
||||
nullifyElement(element)
|
||||
}
|
||||
}
|
||||
25
node_modules/@emotion/cache/src/types.ts
generated
vendored
Normal file
25
node_modules/@emotion/cache/src/types.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
export interface StylisElement {
|
||||
type: string
|
||||
value: string
|
||||
props: Array<string> | string
|
||||
root: StylisElement | null
|
||||
parent: StylisElement | null
|
||||
children: Array<StylisElement> | string
|
||||
line: number
|
||||
column: number
|
||||
length: number
|
||||
return: string
|
||||
}
|
||||
export type StylisPluginCallback = (
|
||||
element: StylisElement,
|
||||
index: number,
|
||||
children: Array<StylisElement>,
|
||||
callback: StylisPluginCallback
|
||||
) => string | void
|
||||
|
||||
export type StylisPlugin = (
|
||||
element: StylisElement,
|
||||
index: number,
|
||||
children: Array<StylisElement>,
|
||||
callback: StylisPluginCallback
|
||||
) => string | void
|
||||
21
node_modules/@emotion/hash/LICENSE
generated
vendored
Normal file
21
node_modules/@emotion/hash/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Emotion team and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
11
node_modules/@emotion/hash/README.md
generated
vendored
Normal file
11
node_modules/@emotion/hash/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# @emotion/hash
|
||||
|
||||
> A MurmurHash2 implementation
|
||||
|
||||
```jsx
|
||||
import hash from '@emotion/hash'
|
||||
|
||||
hash('some-string') // 12fj1d
|
||||
```
|
||||
|
||||
The source of this is from https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js.
|
||||
1
node_modules/@emotion/hash/dist/declarations/src/index.d.ts
generated
vendored
Normal file
1
node_modules/@emotion/hash/dist/declarations/src/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default function murmur2(str: string): string;
|
||||
3
node_modules/@emotion/hash/dist/emotion-hash.cjs.d.mts
generated
vendored
Normal file
3
node_modules/@emotion/hash/dist/emotion-hash.cjs.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export * from "./declarations/src/index.js";
|
||||
export { _default as default } from "./emotion-hash.cjs.default.js";
|
||||
//# sourceMappingURL=emotion-hash.cjs.d.mts.map
|
||||
1
node_modules/@emotion/hash/dist/emotion-hash.cjs.d.mts.map
generated
vendored
Normal file
1
node_modules/@emotion/hash/dist/emotion-hash.cjs.d.mts.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"emotion-hash.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue