fdsfd
This commit is contained in:
parent
628618df89
commit
e031240dff
3749 changed files with 1120848 additions and 1 deletions
55
node_modules/postcss-js/CHANGELOG.md
generated
vendored
Normal file
55
node_modules/postcss-js/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
# Change Log
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 3.0.3
|
||||
* Reverted `package.exports` Node.js 15 fix.
|
||||
|
||||
## 3.0.2
|
||||
* Fixed Node.js 15 warning.
|
||||
|
||||
## 3.0.1
|
||||
* Added funding links.
|
||||
|
||||
## 3.0
|
||||
* Removed support for Node.js 6.x, 8.x, 11.x, and 13.x versions.
|
||||
* Moved to PostCSS 8.0.
|
||||
* Added ES modules support.
|
||||
* Avoid stringification of unitless values (by Rishabh Rathod).
|
||||
|
||||
## 2.0.3
|
||||
* Fix `from` option warning.
|
||||
|
||||
## 2.0.2
|
||||
* Fix `!important` support (by Adam Wathan).
|
||||
|
||||
## 2.0.1
|
||||
* Improve objectifier performance.
|
||||
* Do not change source `Root` in objectifier.
|
||||
|
||||
## 2.0.0
|
||||
* Remove Node.js 9 and Node.js 4 support.
|
||||
* Use PostCSS 7.0.
|
||||
|
||||
## 1.0.1
|
||||
* Ignore nodes with `undefined` value.
|
||||
|
||||
## 1.0
|
||||
* Use PostCSS 6.0.
|
||||
|
||||
## 0.3
|
||||
* Add support for at-rules with same name (like `@font-face`).
|
||||
|
||||
## 0.2
|
||||
* Add `!important` support (by Dan Lynch).
|
||||
|
||||
## 0.1.3
|
||||
* Fix rules merge with at-rules.
|
||||
|
||||
## 0.1.2
|
||||
* Add `cssFloat` alias support.
|
||||
|
||||
## 0.1.1
|
||||
* Fix losing rules in parser on same selector (by Bogdan Chadkin).
|
||||
|
||||
## 0.1
|
||||
* Initial release.
|
20
node_modules/postcss-js/LICENSE
generated
vendored
Normal file
20
node_modules/postcss-js/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright 2015 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
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.
|
150
node_modules/postcss-js/README.md
generated
vendored
Normal file
150
node_modules/postcss-js/README.md
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
# PostCSS JS
|
||||
|
||||
<img align="right" width="135" height="95"
|
||||
title="Philosopher’s stone, logo of PostCSS"
|
||||
src="https://postcss.org/logo-leftp.svg">
|
||||
|
||||
[PostCSS] for React Inline Styles, Radium, JSS and other CSS-in-JS.
|
||||
|
||||
For example, to use [Stylelint], [RTLCSS] or [postcss-write-svg] plugins
|
||||
in your workflow.
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=postcss-js">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
[postcss-write-svg]: https://github.com/jonathantneal/postcss-write-svg
|
||||
[Stylelint]: https://github.com/stylelint/stylelint
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
[RTLCSS]: https://github.com/MohammadYounes/rtlcss
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Processing
|
||||
|
||||
```js
|
||||
const postcssJs = require('postcss-js')
|
||||
const autoprefixer = require('autoprefixer')
|
||||
|
||||
const prefixer = postcssJs.sync([ autoprefixer ])
|
||||
|
||||
const style = prefixer({
|
||||
userSelect: 'none'
|
||||
})
|
||||
|
||||
style //=> {
|
||||
// WebkitUserSelect: 'none',
|
||||
// MozUserSelect: 'none',
|
||||
// msUserSelect: 'none',
|
||||
// userSelect: 'none'
|
||||
// }
|
||||
```
|
||||
|
||||
|
||||
### Compile CSS-in-JS to CSS
|
||||
|
||||
```js
|
||||
const postcss = require('postcss')
|
||||
const postcssJs = require('postcss-js')
|
||||
|
||||
const style = {
|
||||
top: 10,
|
||||
'&:hover': {
|
||||
top: 5
|
||||
}
|
||||
};
|
||||
|
||||
postcss().process(style, { parser: postcssJs }).then( (result) => {
|
||||
result.css //=> top: 10px;
|
||||
// &:hover { top: 5px; }
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
### Compile CSS to CSS-in-JS
|
||||
|
||||
```js
|
||||
const postcss = require('postcss')
|
||||
const postcssJs = require('postcss-js')
|
||||
|
||||
const css = '--text-color: #DD3A0A; @media screen { z-index: 1; color: var(--text-color) }'
|
||||
const root = postcss.parse(css)
|
||||
|
||||
postcssJs.objectify(root) //=> {
|
||||
// '--text-color': '#DD3A0A',
|
||||
// '@media screen': {
|
||||
// zIndex: '1',
|
||||
// color: 'var(--text-color)'
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### `sync(plugins): function`
|
||||
|
||||
Create PostCSS processor with simple API, but with only sync PostCSS plugins
|
||||
support.
|
||||
|
||||
Processor is just a function, which takes one style object and return other.
|
||||
|
||||
|
||||
### `async(plugins): function`
|
||||
|
||||
Same as `sync`, but also support async plugins.
|
||||
|
||||
Returned processor will return Promise.
|
||||
|
||||
|
||||
### `parse(obj): Root`
|
||||
|
||||
Parse CSS-in-JS style object to PostCSS `Root` instance.
|
||||
|
||||
It converts numbers to pixels and parses
|
||||
[Free Style] like selectors and at-rules:
|
||||
|
||||
```js
|
||||
{
|
||||
'@media screen': {
|
||||
'&:hover': {
|
||||
top: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This methods use Custom Syntax name convention, so you can use it like this:
|
||||
|
||||
```js
|
||||
postcss().process(obj, { parser: postcssJs })
|
||||
```
|
||||
|
||||
|
||||
### `objectify(root): object`
|
||||
|
||||
Convert PostCSS `Root` instance to CSS-in-JS style object.
|
||||
|
||||
|
||||
## Troubleshoot
|
||||
|
||||
Webpack may need some extra config for some PostCSS plugins.
|
||||
|
||||
|
||||
### `Module parse failed`
|
||||
|
||||
Autoprefixer and some other plugins
|
||||
need a [json-loader](https://github.com/webpack/json-loader) to import data.
|
||||
|
||||
So, please install this loader and add to webpack config:
|
||||
|
||||
```js
|
||||
loaders: [
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: "json-loader"
|
||||
}
|
||||
]
|
||||
```
|
15
node_modules/postcss-js/async.js
generated
vendored
Normal file
15
node_modules/postcss-js/async.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
let postcss = require('postcss')
|
||||
|
||||
let processResult = require('./process-result')
|
||||
let parse = require('./parser')
|
||||
|
||||
module.exports = function async (plugins) {
|
||||
let processor = postcss(plugins)
|
||||
return async input => {
|
||||
let result = await processor.process(input, {
|
||||
parser: parse,
|
||||
from: undefined
|
||||
})
|
||||
return processResult(result)
|
||||
}
|
||||
}
|
11
node_modules/postcss-js/index.js
generated
vendored
Normal file
11
node_modules/postcss-js/index.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
let objectify = require('./objectifier')
|
||||
let parse = require('./parser')
|
||||
let async = require('./async')
|
||||
let sync = require('./sync')
|
||||
|
||||
module.exports = {
|
||||
objectify,
|
||||
parse,
|
||||
async,
|
||||
sync
|
||||
}
|
8
node_modules/postcss-js/index.mjs
generated
vendored
Normal file
8
node_modules/postcss-js/index.mjs
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
import index from "./index.js"
|
||||
|
||||
export default index
|
||||
|
||||
export const objectify = index.objectify
|
||||
export const parse = index.parse
|
||||
export const async = index.async
|
||||
export const sync = index.sync
|
83
node_modules/postcss-js/objectifier.js
generated
vendored
Normal file
83
node_modules/postcss-js/objectifier.js
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
let camelcase = require('camelcase-css')
|
||||
|
||||
let UNITLESS = {
|
||||
boxFlex: true,
|
||||
boxFlexGroup: true,
|
||||
columnCount: true,
|
||||
flex: true,
|
||||
flexGrow: true,
|
||||
flexPositive: true,
|
||||
flexShrink: true,
|
||||
flexNegative: true,
|
||||
fontWeight: true,
|
||||
lineClamp: true,
|
||||
lineHeight: true,
|
||||
opacity: true,
|
||||
order: true,
|
||||
orphans: true,
|
||||
tabSize: true,
|
||||
widows: true,
|
||||
zIndex: true,
|
||||
zoom: true,
|
||||
fillOpacity: true,
|
||||
strokeDashoffset: true,
|
||||
strokeOpacity: true,
|
||||
strokeWidth: true
|
||||
}
|
||||
|
||||
function atRule (node) {
|
||||
if (typeof node.nodes === 'undefined') {
|
||||
return true
|
||||
} else {
|
||||
return process(node)
|
||||
}
|
||||
}
|
||||
|
||||
function process (node) {
|
||||
let name
|
||||
let result = {}
|
||||
|
||||
node.each(child => {
|
||||
if (child.type === 'atrule') {
|
||||
name = '@' + child.name
|
||||
if (child.params) name += ' ' + child.params
|
||||
if (typeof result[name] === 'undefined') {
|
||||
result[name] = atRule(child)
|
||||
} else if (Array.isArray(result[name])) {
|
||||
result[name].push(atRule(child))
|
||||
} else {
|
||||
result[name] = [result[name], atRule(child)]
|
||||
}
|
||||
} else if (child.type === 'rule') {
|
||||
let body = process(child)
|
||||
if (result[child.selector]) {
|
||||
for (let i in body) {
|
||||
result[child.selector][i] = body[i]
|
||||
}
|
||||
} else {
|
||||
result[child.selector] = body
|
||||
}
|
||||
} else if (child.type === 'decl') {
|
||||
if (child.prop[0] === '-' && child.prop[1] === '-') {
|
||||
name = child.prop
|
||||
} else {
|
||||
name = camelcase(child.prop)
|
||||
}
|
||||
let value = child.value
|
||||
if (!isNaN(child.value) && UNITLESS[name]) {
|
||||
value = parseFloat(child.value)
|
||||
}
|
||||
if (child.important) value += ' !important'
|
||||
if (typeof result[name] === 'undefined') {
|
||||
result[name] = value
|
||||
} else if (Array.isArray(result[name])) {
|
||||
result[name].push(value)
|
||||
} else {
|
||||
result[name] = [result[name], value]
|
||||
}
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = process
|
73
node_modules/postcss-js/package.json
generated
vendored
Normal file
73
node_modules/postcss-js/package.json
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"postcss-js@3.0.3",
|
||||
"/d"
|
||||
]
|
||||
],
|
||||
"_from": "postcss-js@3.0.3",
|
||||
"_id": "postcss-js@3.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-gWnoWQXKFw65Hk/mi2+WTQTHdPD5UJdDXZmX073EY/B3BWnYjO4F4t0VneTCnCGQ5E5GsCdMkzPaTXwl3r5dJw==",
|
||||
"_location": "/postcss-js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "postcss-js@3.0.3",
|
||||
"name": "postcss-js",
|
||||
"escapedName": "postcss-js",
|
||||
"rawSpec": "3.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tailwindcss"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-3.0.3.tgz",
|
||||
"_spec": "3.0.3",
|
||||
"_where": "/d",
|
||||
"author": {
|
||||
"name": "Andrey Sitnik",
|
||||
"email": "andrey@sitnik.ru"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/postcss/postcss-js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"camelcase-css": "^2.0.1",
|
||||
"postcss": "^8.1.6"
|
||||
},
|
||||
"description": "PostCSS for React Inline Styles, Radium, Free Style and other CSS-in-JS",
|
||||
"engines": {
|
||||
"node": ">=10.0"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./index.js",
|
||||
"import": "./index.mjs"
|
||||
},
|
||||
"./": "./"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
"homepage": "https://github.com/postcss/postcss-js#readme",
|
||||
"keywords": [
|
||||
"postcss",
|
||||
"postcss-runner",
|
||||
"js",
|
||||
"inline",
|
||||
"react",
|
||||
"css",
|
||||
"cssinjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "postcss-js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/postcss/postcss-js.git"
|
||||
},
|
||||
"version": "3.0.3"
|
||||
}
|
101
node_modules/postcss-js/parser.js
generated
vendored
Normal file
101
node_modules/postcss-js/parser.js
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
let postcss = require('postcss')
|
||||
|
||||
let IMPORTANT = /\s*!important\s*$/i
|
||||
|
||||
let UNITLESS = {
|
||||
'box-flex': true,
|
||||
'box-flex-group': true,
|
||||
'column-count': true,
|
||||
'flex': true,
|
||||
'flex-grow': true,
|
||||
'flex-positive': true,
|
||||
'flex-shrink': true,
|
||||
'flex-negative': true,
|
||||
'font-weight': true,
|
||||
'line-clamp': true,
|
||||
'line-height': true,
|
||||
'opacity': true,
|
||||
'order': true,
|
||||
'orphans': true,
|
||||
'tab-size': true,
|
||||
'widows': true,
|
||||
'z-index': true,
|
||||
'zoom': true,
|
||||
'fill-opacity': true,
|
||||
'stroke-dashoffset': true,
|
||||
'stroke-opacity': true,
|
||||
'stroke-width': true
|
||||
}
|
||||
|
||||
function dashify (str) {
|
||||
return str
|
||||
.replace(/([A-Z])/g, '-$1')
|
||||
.replace(/^ms-/, '-ms-')
|
||||
.toLowerCase()
|
||||
}
|
||||
|
||||
function decl (parent, name, value) {
|
||||
if (value === false || value === null) return
|
||||
|
||||
name = dashify(name)
|
||||
if (typeof value === 'number') {
|
||||
if (value === 0 || UNITLESS[name]) {
|
||||
value = value.toString()
|
||||
} else {
|
||||
value += 'px'
|
||||
}
|
||||
}
|
||||
|
||||
if (name === 'css-float') name = 'float'
|
||||
|
||||
if (IMPORTANT.test(value)) {
|
||||
value = value.replace(IMPORTANT, '')
|
||||
parent.push(postcss.decl({ prop: name, value, important: true }))
|
||||
} else {
|
||||
parent.push(postcss.decl({ prop: name, value }))
|
||||
}
|
||||
}
|
||||
|
||||
function atRule (parent, parts, value) {
|
||||
let node = postcss.atRule({ name: parts[1], params: parts[3] || '' })
|
||||
if (typeof value === 'object') {
|
||||
node.nodes = []
|
||||
parse(value, node)
|
||||
}
|
||||
parent.push(node)
|
||||
}
|
||||
|
||||
function parse (obj, parent) {
|
||||
let name, value, node
|
||||
for (name in obj) {
|
||||
value = obj[name]
|
||||
if (value === null || typeof value === 'undefined') {
|
||||
continue
|
||||
} else if (name[0] === '@') {
|
||||
let parts = name.match(/@(\S+)(\s+([\W\w]*)\s*)?/)
|
||||
if (Array.isArray(value)) {
|
||||
for (let i of value) {
|
||||
atRule(parent, parts, i)
|
||||
}
|
||||
} else {
|
||||
atRule(parent, parts, value)
|
||||
}
|
||||
} else if (Array.isArray(value)) {
|
||||
for (let i of value) {
|
||||
decl(parent, name, i)
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
node = postcss.rule({ selector: name })
|
||||
parse(value, node)
|
||||
parent.push(node)
|
||||
} else {
|
||||
decl(parent, name, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (obj) {
|
||||
let root = postcss.root()
|
||||
parse(obj, root)
|
||||
return root
|
||||
}
|
11
node_modules/postcss-js/process-result.js
generated
vendored
Normal file
11
node_modules/postcss-js/process-result.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
let objectify = require('./objectifier')
|
||||
|
||||
module.exports = function processResult (result) {
|
||||
if (console && console.warn) {
|
||||
result.warnings().forEach(warn => {
|
||||
let source = warn.plugin || 'PostCSS'
|
||||
console.warn(source + ': ' + warn.text)
|
||||
})
|
||||
}
|
||||
return objectify(result.root)
|
||||
}
|
12
node_modules/postcss-js/sync.js
generated
vendored
Normal file
12
node_modules/postcss-js/sync.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
let postcss = require('postcss')
|
||||
|
||||
let processResult = require('./process-result')
|
||||
let parse = require('./parser')
|
||||
|
||||
module.exports = function (plugins) {
|
||||
let processor = postcss(plugins)
|
||||
return input => {
|
||||
let result = processor.process(input, { parser: parse, from: undefined })
|
||||
return processResult(result)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue