mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
7
web/node_modules/postcss-modules-values/LICENSE
generated
vendored
Normal file
7
web/node_modules/postcss-modules-values/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
ISC License (ISC)
|
||||
|
||||
Copyright (c) 2015, Glen Maddern
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
84
web/node_modules/postcss-modules-values/README.md
generated
vendored
Normal file
84
web/node_modules/postcss-modules-values/README.md
generated
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
# CSS Modules: Values
|
||||
|
||||
Pass arbitrary values between your module files
|
||||
|
||||
### Usage
|
||||
|
||||
```css
|
||||
/* colors.css */
|
||||
@value primary: #BF4040;
|
||||
@value secondary: #1F4F7F;
|
||||
|
||||
.text-primary {
|
||||
color: primary;
|
||||
}
|
||||
|
||||
.text-secondary {
|
||||
color: secondary;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
/* breakpoints.css */
|
||||
@value small: (max-width: 599px);
|
||||
@value medium: (min-width: 600px) and (max-width: 959px);
|
||||
@value large: (min-width: 960px);
|
||||
```
|
||||
|
||||
```css
|
||||
/* my-component.css */
|
||||
/* alias paths for other values or composition */
|
||||
@value colors: "./colors.css";
|
||||
/* import multiple from a single file */
|
||||
@value primary, secondary from colors;
|
||||
/* make local aliases to imported values */
|
||||
@value small as bp-small, large as bp-large from "./breakpoints.css";
|
||||
/* value as selector name */
|
||||
@value selectorValue: secondary-color;
|
||||
|
||||
.selectorValue {
|
||||
color: secondary;
|
||||
}
|
||||
|
||||
.header {
|
||||
composes: text-primary from colors;
|
||||
box-shadow: 0 0 10px secondary;
|
||||
}
|
||||
|
||||
@media bp-small {
|
||||
.header {
|
||||
box-shadow: 0 0 4px secondary;
|
||||
}
|
||||
}
|
||||
@media bp-large {
|
||||
.header {
|
||||
box-shadow: 0 0 20px secondary;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**If you are using Sass** along with this PostCSS plugin, do not use the colon `:` in your `@value` definitions. It will cause Sass to crash.
|
||||
|
||||
Note also you can _import_ multiple values at once but can only _define_ one value per line.
|
||||
|
||||
```css
|
||||
@value a: b, c: d; /* defines a as "b, c: d" */
|
||||
```
|
||||
|
||||
### Justification
|
||||
|
||||
See [this PR](https://github.com/css-modules/css-modules-loader-core/pull/28) for more background
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
## With thanks
|
||||
|
||||
- Mark Dalgleish
|
||||
- Tobias Koppers
|
||||
- Josh Johnston
|
||||
|
||||
---
|
||||
|
||||
Glen Maddern, 2015.
|
45
web/node_modules/postcss-modules-values/package.json
generated
vendored
Normal file
45
web/node_modules/postcss-modules-values/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "postcss-modules-values",
|
||||
"version": "3.0.0",
|
||||
"description": "PostCSS plugin for CSS Modules to pass arbitrary values between your module files",
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint src test",
|
||||
"pretest": "yarn lint",
|
||||
"test": "mocha",
|
||||
"autotest": "chokidar src test -c 'npm test'",
|
||||
"cover": "nyc mocha",
|
||||
"travis": "yarn lint && yarn cover",
|
||||
"prepublishOnly": "yarn test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/css-modules/postcss-modules-values.git"
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"modules",
|
||||
"postcss"
|
||||
],
|
||||
"author": "Glen Maddern",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/css-modules/postcss-modules-values/issues"
|
||||
},
|
||||
"homepage": "https://github.com/css-modules/postcss-modules-values#readme",
|
||||
"devDependencies": {
|
||||
"chokidar-cli": "^1.0.1",
|
||||
"codecov.io": "^0.1.2",
|
||||
"coveralls": "^3.0.2",
|
||||
"eslint": "^5.9.0",
|
||||
"mocha": "^6.1.4",
|
||||
"nyc": "^14.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"icss-utils": "^4.0.0",
|
||||
"postcss": "^7.0.6"
|
||||
}
|
||||
}
|
118
web/node_modules/postcss-modules-values/src/index.js
generated
vendored
Normal file
118
web/node_modules/postcss-modules-values/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
'use strict';
|
||||
|
||||
const postcss = require('postcss');
|
||||
const ICSSUtils = require('icss-utils');
|
||||
|
||||
const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/;
|
||||
const matchValueDefinition = /(?:\s+|^)([\w-]+):?\s+(.+?)\s*$/g;
|
||||
const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/;
|
||||
|
||||
let options = {};
|
||||
let importIndex = 0;
|
||||
let createImportedName =
|
||||
(options && options.createImportedName) ||
|
||||
((importName /*, path*/) =>
|
||||
`i__const_${importName.replace(/\W/g, '_')}_${importIndex++}`);
|
||||
|
||||
module.exports = postcss.plugin(
|
||||
'postcss-modules-values',
|
||||
() => (css, result) => {
|
||||
const importAliases = [];
|
||||
const definitions = {};
|
||||
|
||||
const addDefinition = atRule => {
|
||||
let matches;
|
||||
while ((matches = matchValueDefinition.exec(atRule.params))) {
|
||||
let [, /*match*/ key, value] = matches;
|
||||
// Add to the definitions, knowing that values can refer to each other
|
||||
definitions[key] = ICSSUtils.replaceValueSymbols(value, definitions);
|
||||
atRule.remove();
|
||||
}
|
||||
};
|
||||
|
||||
const addImport = atRule => {
|
||||
const matches = matchImports.exec(atRule.params);
|
||||
if (matches) {
|
||||
let [, /*match*/ aliases, path] = matches;
|
||||
// We can use constants for path names
|
||||
if (definitions[path]) {
|
||||
path = definitions[path];
|
||||
}
|
||||
const imports = aliases
|
||||
.replace(/^\(\s*([\s\S]+)\s*\)$/, '$1')
|
||||
.split(/\s*,\s*/)
|
||||
.map(alias => {
|
||||
const tokens = matchImport.exec(alias);
|
||||
if (tokens) {
|
||||
const [, /*match*/ theirName, myName = theirName] = tokens;
|
||||
const importedName = createImportedName(myName);
|
||||
definitions[myName] = importedName;
|
||||
return { theirName, importedName };
|
||||
} else {
|
||||
throw new Error(`@import statement "${alias}" is invalid!`);
|
||||
}
|
||||
});
|
||||
importAliases.push({ path, imports });
|
||||
atRule.remove();
|
||||
}
|
||||
};
|
||||
|
||||
/* Look at all the @value statements and treat them as locals or as imports */
|
||||
css.walkAtRules('value', atRule => {
|
||||
if (matchImports.exec(atRule.params)) {
|
||||
addImport(atRule);
|
||||
} else {
|
||||
if (atRule.params.indexOf('@value') !== -1) {
|
||||
result.warn('Invalid value definition: ' + atRule.params);
|
||||
}
|
||||
|
||||
addDefinition(atRule);
|
||||
}
|
||||
});
|
||||
|
||||
/* We want to export anything defined by now, but don't add it to the CSS yet or
|
||||
it well get picked up by the replacement stuff */
|
||||
const exportDeclarations = Object.keys(definitions).map(key =>
|
||||
postcss.decl({
|
||||
value: definitions[key],
|
||||
prop: key,
|
||||
raws: { before: '\n ' }
|
||||
})
|
||||
);
|
||||
|
||||
/* If we have no definitions, don't continue */
|
||||
if (!Object.keys(definitions).length) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Perform replacements */
|
||||
ICSSUtils.replaceSymbols(css, definitions);
|
||||
|
||||
/* Add export rules if any */
|
||||
if (exportDeclarations.length > 0) {
|
||||
const exportRule = postcss.rule({
|
||||
selector: ':export',
|
||||
raws: { after: '\n' }
|
||||
});
|
||||
exportRule.append(exportDeclarations);
|
||||
css.prepend(exportRule);
|
||||
}
|
||||
|
||||
/* Add import rules */
|
||||
importAliases.reverse().forEach(({ path, imports }) => {
|
||||
const importRule = postcss.rule({
|
||||
selector: `:import(${path})`,
|
||||
raws: { after: '\n' }
|
||||
});
|
||||
imports.forEach(({ theirName, importedName }) => {
|
||||
importRule.append({
|
||||
value: theirName,
|
||||
prop: importedName,
|
||||
raws: { before: '\n ' }
|
||||
});
|
||||
});
|
||||
|
||||
css.prepend(importRule);
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue