mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-16 21:11:52 +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
18
web/node_modules/postcss-image-set-function/CHANGELOG.md
generated
vendored
Normal file
18
web/node_modules/postcss-image-set-function/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Changes to PostCSS image-set() Function
|
||||
|
||||
### 3.0.1 (September 18, 2018)
|
||||
|
||||
- Updated: PostCSS Values Parser 2
|
||||
|
||||
### 3.0.0 (September 17, 2018)
|
||||
|
||||
- Updated: Support for PostCSS 7+
|
||||
- Updated: Support for Node 6+
|
||||
|
||||
### 2.0.0 (May 7, 2018)
|
||||
|
||||
- Sort images by DPR and use the lowest as the default
|
||||
|
||||
### 1.0.0 (May 2, 2018)
|
||||
|
||||
- Initial version
|
108
web/node_modules/postcss-image-set-function/LICENSE.md
generated
vendored
Normal file
108
web/node_modules/postcss-image-set-function/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
# CC0 1.0 Universal
|
||||
|
||||
## Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator and
|
||||
subsequent owner(s) (each and all, an “owner”) of an original work of
|
||||
authorship and/or a database (each, a “Work”).
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for the
|
||||
purpose of contributing to a commons of creative, cultural and scientific works
|
||||
(“Commons”) that the public can reliably and without fear of later claims of
|
||||
infringement build upon, modify, incorporate in other works, reuse and
|
||||
redistribute as freely as possible in any form whatsoever and for any purposes,
|
||||
including without limitation commercial purposes. These owners may contribute
|
||||
to the Commons to promote the ideal of a free culture and the further
|
||||
production of creative, cultural and scientific works, or to gain reputation or
|
||||
greater distribution for their Work in part through the use and efforts of
|
||||
others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any expectation of
|
||||
additional consideration or compensation, the person associating CC0 with a
|
||||
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
|
||||
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
|
||||
publicly distribute the Work under its terms, with knowledge of his or her
|
||||
Copyright and Related Rights in the Work and the meaning and intended legal
|
||||
effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights (“Copyright and
|
||||
Related Rights”). Copyright and Related Rights include, but are not limited
|
||||
to, the following:
|
||||
1. the right to reproduce, adapt, distribute, perform, display, communicate,
|
||||
and translate a Work;
|
||||
2. moral rights retained by the original author(s) and/or performer(s);
|
||||
3. publicity and privacy rights pertaining to a person’s image or likeness
|
||||
depicted in a Work;
|
||||
4. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(i), below;
|
||||
5. rights protecting the extraction, dissemination, use and reuse of data in
|
||||
a Work;
|
||||
6. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation thereof,
|
||||
including any amended or successor version of such directive); and
|
||||
7. other similar, equivalent or corresponding rights throughout the world
|
||||
based on applicable law or treaty, and any national implementations
|
||||
thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
||||
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
||||
unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
|
||||
and Related Rights and associated claims and causes of action, whether now
|
||||
known or unknown (including existing as well as future claims and causes of
|
||||
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
||||
duration provided by applicable law or treaty (including future time
|
||||
extensions), (iii) in any current or future medium and for any number of
|
||||
copies, and (iv) for any purpose whatsoever, including without limitation
|
||||
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
|
||||
makes the Waiver for the benefit of each member of the public at large and
|
||||
to the detriment of Affirmer’s heirs and successors, fully intending that
|
||||
such Waiver shall not be subject to revocation, rescission, cancellation,
|
||||
termination, or any other legal or equitable action to disrupt the quiet
|
||||
enjoyment of the Work by the public as contemplated by Affirmer’s express
|
||||
Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason be
|
||||
judged legally invalid or ineffective under applicable law, then the Waiver
|
||||
shall be preserved to the maximum extent permitted taking into account
|
||||
Affirmer’s express Statement of Purpose. In addition, to the extent the
|
||||
Waiver is so judged Affirmer hereby grants to each affected person a
|
||||
royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer’s Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future time
|
||||
extensions), (iii) in any current or future medium and for any number of
|
||||
copies, and (iv) for any purpose whatsoever, including without limitation
|
||||
commercial, advertising or promotional purposes (the “License”). The License
|
||||
shall be deemed effective as of the date CC0 was applied by Affirmer to the
|
||||
Work. Should any part of the License for any reason be judged legally
|
||||
invalid or ineffective under applicable law, such partial invalidity or
|
||||
ineffectiveness shall not invalidate the remainder of the License, and in
|
||||
such case Affirmer hereby affirms that he or she will not (i) exercise any
|
||||
of his or her remaining Copyright and Related Rights in the Work or (ii)
|
||||
assert any associated claims and causes of action with respect to the Work,
|
||||
in either case contrary to Affirmer’s express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
1. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
2. Affirmer offers the Work as-is and makes no representations or warranties
|
||||
of any kind concerning the Work, express, implied, statutory or
|
||||
otherwise, including without limitation warranties of title,
|
||||
merchantability, fitness for a particular purpose, non infringement, or
|
||||
the absence of latent or other defects, accuracy, or the present or
|
||||
absence of errors, whether or not discoverable, all to the greatest
|
||||
extent permissible under applicable law.
|
||||
3. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person’s Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the Work.
|
||||
4. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to this
|
||||
CC0 or use of the Work.
|
||||
|
||||
For more information, please see
|
||||
http://creativecommons.org/publicdomain/zero/1.0/.
|
167
web/node_modules/postcss-image-set-function/README.md
generated
vendored
Normal file
167
web/node_modules/postcss-image-set-function/README.md
generated
vendored
Normal file
|
@ -0,0 +1,167 @@
|
|||
# PostCSS image-set() Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
|
||||
|
||||
[![NPM Version][npm-img]][npm-url]
|
||||
[![CSS Standard Status][css-img]][css-url]
|
||||
[![Build Status][cli-img]][cli-url]
|
||||
[![Support Chat][git-img]][git-url]
|
||||
|
||||
[PostCSS image-set() Function] lets you display resolution-dependent images
|
||||
using the `image-set()` function in CSS, following the [CSS Images]
|
||||
specification.
|
||||
|
||||
```pcss
|
||||
.example {
|
||||
background-image: image-set(
|
||||
url(img.png) 1x,
|
||||
url(img@2x.png) 2x,
|
||||
url(img@print.png) 600dpi
|
||||
);
|
||||
}
|
||||
|
||||
/* becomes */
|
||||
|
||||
.example {
|
||||
background-image: url(img.png);
|
||||
}
|
||||
|
||||
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
||||
.example {
|
||||
background-image: url(img@2x.png);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (-webkit-min-device-pixel-ratio: 6.25), (min-resolution: 600dpi) {
|
||||
.example {
|
||||
background-image: url(my@print.png);
|
||||
}
|
||||
}
|
||||
|
||||
.example {
|
||||
background-image: image-set(
|
||||
url(img.png) 1x,
|
||||
url(img@2x.png) 2x,
|
||||
url(img@print.png) 600dpi
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add [PostCSS image-set() Function] to your project:
|
||||
|
||||
```bash
|
||||
npm install postcss-image-set-function --save-dev
|
||||
```
|
||||
|
||||
Use [PostCSS image-set() Function] to process your CSS:
|
||||
|
||||
```js
|
||||
const postcssImageSetFunction = require('postcss-image-set-function');
|
||||
|
||||
postcssImageSetFunction.process(YOUR_CSS /*, processOptions, pluginOptions */);
|
||||
```
|
||||
|
||||
Or use it as a [PostCSS] plugin:
|
||||
|
||||
```js
|
||||
const postcss = require('postcss');
|
||||
const postcssImageSetFunction = require('postcss-image-set-function');
|
||||
|
||||
postcss([
|
||||
postcssImageSetFunction(/* pluginOptions */)
|
||||
]).process(YOUR_CSS /*, processOptions */);
|
||||
```
|
||||
|
||||
[PostCSS image-set() Function] runs in all Node environments, with special
|
||||
instructions for:
|
||||
|
||||
| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
|
||||
## Options
|
||||
|
||||
### preserve
|
||||
|
||||
The `preserve` option determines whether the original declaration using
|
||||
`image-set()` is preserved. By default, it is preserved.
|
||||
|
||||
```js
|
||||
postcssImageSetFunction({ preserve: false })
|
||||
```
|
||||
|
||||
```pcss
|
||||
.example {
|
||||
background-image: image-set(
|
||||
url(img.png) 1x,
|
||||
url(img@2x.png) 2x,
|
||||
url(img@print.png) 600dpi
|
||||
);
|
||||
}
|
||||
|
||||
/* becomes */
|
||||
|
||||
.example {
|
||||
background-image: url(img.png);
|
||||
}
|
||||
|
||||
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
||||
.example {
|
||||
background-image: url(img@2x.png);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (-webkit-min-device-pixel-ratio: 6.25), (min-resolution: 600dpi) {
|
||||
.example {
|
||||
background-image: url(my@print.png);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### onvalid
|
||||
|
||||
The `oninvalid` option determines how invalid usage of `image-set()` should be
|
||||
handled. By default, invalid usages of `image-set()` are ignored. They can be
|
||||
configured to display a `warning` or `throw` an error.
|
||||
|
||||
```js
|
||||
postcssImageSetFunction({ oninvalid: 'warning' }) // warn on invalid usages
|
||||
```
|
||||
|
||||
```js
|
||||
postcssImageSetFunction({ oninvalid: 'throw' }) // throw on invalid usages
|
||||
```
|
||||
|
||||
## Image Resolution
|
||||
|
||||
The `image-set()` function allows an author to provide multiple resolutions of
|
||||
an image and let the browser decide which is most appropriate in a given
|
||||
situation. The `image-set()` also never fails to choose an image; the
|
||||
`<resolution>` just helps determine which of the images is chosen.
|
||||
|
||||
Since this plugin is not a browser, the image options are sorted by device
|
||||
pixel ratio and the lowest ratio is used as the default, while the remaining
|
||||
images are pushed behind media queries.
|
||||
|
||||
Therefore, this plugin can only approximate native browser behavior. While
|
||||
images should typically match the resolution as the device they’re being viewed
|
||||
in, other factors can affect the chosen image. For example, if the user is on a
|
||||
slow mobile connection, the browser may prefer to select a lower-res image
|
||||
rather than wait for a larger, resolution-matching image to load.
|
||||
|
||||
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-image-set-function.svg
|
||||
[cli-url]: https://travis-ci.org/jonathantneal/postcss-image-set-function
|
||||
[css-img]: https://cssdb.org/badge/image-set-function.svg
|
||||
[css-url]: https://cssdb.org/#image-set-function
|
||||
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
|
||||
[git-url]: https://gitter.im/postcss/postcss
|
||||
[npm-img]: https://img.shields.io/npm/v/postcss-image-set-function.svg
|
||||
[npm-url]: https://www.npmjs.com/package/postcss-image-set-function
|
||||
|
||||
[CSS Images]: https://drafts.csswg.org/css-images-4/#image-set-notation
|
||||
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
|
||||
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
[PostCSS Loader]: https://github.com/postcss/postcss-loader
|
||||
[PostCSS image-set() Function]: https://github.com/jonathantneal/postcss-image-set-function
|
146
web/node_modules/postcss-image-set-function/index.cjs.js
generated
vendored
Normal file
146
web/node_modules/postcss-image-set-function/index.cjs.js
generated
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
'use strict';
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var postcss = _interopDefault(require('postcss'));
|
||||
var valueParser = _interopDefault(require('postcss-values-parser'));
|
||||
|
||||
// return whether a node is a valid comma
|
||||
var getComma = (node => Object(node).type === 'comma');
|
||||
|
||||
const imageSetFunctionMatchRegExp = /^(-webkit-)?image-set$/i; // return a valid image
|
||||
|
||||
var getImage = (node => // <url> | <image()> | <cross-fade()> | <gradient>
|
||||
// the image-set() function can not be nested inside of itself
|
||||
Object(node).type === 'func' && /^(cross-fade|image|(repeating-)?(conic|linear|radial)-gradient|url)$/i.test(node.value) && !(node.parent.parent && node.parent.parent.type === 'func' && imageSetFunctionMatchRegExp.test(node.parent.parent.value)) ? String(node) : Object(node).type === 'string' ? node.value : false);
|
||||
|
||||
const dpiRatios = {
|
||||
dpcm: 2.54,
|
||||
dpi: 1,
|
||||
dppx: 96,
|
||||
x: 96
|
||||
}; // return a valid @media rule
|
||||
|
||||
var getMedia = ((node, mediasByDpr) => {
|
||||
if (Object(node).type === 'number' && node.unit in dpiRatios) {
|
||||
// calculate min-device-pixel-ratio and min-resolution
|
||||
const dpi = Number(node.value) * dpiRatios[node.unit.toLowerCase()];
|
||||
const dpr = Math.floor(dpi / dpiRatios.x * 100) / 100;
|
||||
|
||||
if (dpi in mediasByDpr) {
|
||||
return false;
|
||||
} else {
|
||||
const media = mediasByDpr[dpi] = postcss.atRule({
|
||||
name: 'media',
|
||||
params: `(-webkit-min-device-pixel-ratio: ${dpr}), (min-resolution: ${dpi}dpi)`
|
||||
});
|
||||
return media;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var handleInvalidation = ((opts, message, word) => {
|
||||
if (opts.oninvalid === 'warn') {
|
||||
opts.decl.warn(opts.result, message, {
|
||||
word: String(word)
|
||||
});
|
||||
} else if (opts.oninvalid === 'throw') {
|
||||
throw opts.decl.error(message, {
|
||||
word: String(word)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var processImageSet = ((imageSetOptionNodes, decl, opts) => {
|
||||
const parent = decl.parent;
|
||||
const mediasByDpr = {};
|
||||
let length = imageSetOptionNodes.length;
|
||||
let index = -1;
|
||||
|
||||
while (index < length) {
|
||||
const _ref = [index < 0 ? true : getComma(imageSetOptionNodes[index]), getImage(imageSetOptionNodes[index + 1]), getMedia(imageSetOptionNodes[index + 2], mediasByDpr)],
|
||||
comma = _ref[0],
|
||||
value = _ref[1],
|
||||
media = _ref[2]; // handle invalidations
|
||||
|
||||
if (!comma) {
|
||||
return handleInvalidation(opts, 'unexpected comma', imageSetOptionNodes[index]);
|
||||
} else if (!value) {
|
||||
return handleInvalidation(opts, 'unexpected image', imageSetOptionNodes[index + 1]);
|
||||
} else if (!media) {
|
||||
return handleInvalidation(opts, 'unexpected resolution', imageSetOptionNodes[index + 2]);
|
||||
} // prepare @media { decl: <image> }
|
||||
|
||||
|
||||
const parentClone = parent.clone().removeAll();
|
||||
const declClone = decl.clone({
|
||||
value
|
||||
});
|
||||
parentClone.append(declClone);
|
||||
media.append(parentClone);
|
||||
index += 3;
|
||||
}
|
||||
|
||||
const medias = Object.keys(mediasByDpr).sort((a, b) => a - b).map(params => mediasByDpr[params]); // conditionally prepend previous siblings
|
||||
|
||||
if (medias.length) {
|
||||
const firstDecl = medias[0].nodes[0].nodes[0];
|
||||
|
||||
if (medias.length === 1) {
|
||||
decl.value = firstDecl.value;
|
||||
} else {
|
||||
const siblings = parent.nodes;
|
||||
const previousSiblings = siblings.slice(0, siblings.indexOf(decl)).concat(firstDecl);
|
||||
|
||||
if (previousSiblings.length) {
|
||||
const parentClone = parent.cloneBefore().removeAll();
|
||||
parentClone.append(previousSiblings);
|
||||
} // prepend any @media { decl: <image> } rules
|
||||
|
||||
|
||||
parent.before(medias.slice(1)); // conditionally remove the current rule
|
||||
|
||||
if (!opts.preserve) {
|
||||
decl.remove(); // and then conditionally remove its parent
|
||||
|
||||
if (!parent.nodes.length) {
|
||||
parent.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const imageSetValueMatchRegExp = /(^|[^\w-])(-webkit-)?image-set\(/;
|
||||
const imageSetFunctionMatchRegExp$1 = /^(-webkit-)?image-set$/i;
|
||||
var index = postcss.plugin('postcss-image-set-function', opts => {
|
||||
// prepare options
|
||||
const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
|
||||
const oninvalid = 'oninvalid' in Object(opts) ? opts.oninvalid : 'ignore';
|
||||
return (root, result) => {
|
||||
// for every declaration
|
||||
root.walkDecls(decl => {
|
||||
const value = decl.value; // if a declaration likely uses an image-set() function
|
||||
|
||||
if (imageSetValueMatchRegExp.test(value)) {
|
||||
const valueAST = valueParser(value).parse(); // process every image-set() function
|
||||
|
||||
valueAST.walkType('func', node => {
|
||||
if (imageSetFunctionMatchRegExp$1.test(node.value)) {
|
||||
processImageSet(node.nodes.slice(1, -1), decl, {
|
||||
decl,
|
||||
oninvalid,
|
||||
preserve,
|
||||
result
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
module.exports = index;
|
||||
//# sourceMappingURL=index.cjs.js.map
|
1
web/node_modules/postcss-image-set-function/index.cjs.js.map
generated
vendored
Normal file
1
web/node_modules/postcss-image-set-function/index.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
142
web/node_modules/postcss-image-set-function/index.es.mjs
generated
vendored
Normal file
142
web/node_modules/postcss-image-set-function/index.es.mjs
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
import postcss from 'postcss';
|
||||
import valueParser from 'postcss-values-parser';
|
||||
|
||||
// return whether a node is a valid comma
|
||||
var getComma = (node => Object(node).type === 'comma');
|
||||
|
||||
const imageSetFunctionMatchRegExp = /^(-webkit-)?image-set$/i; // return a valid image
|
||||
|
||||
var getImage = (node => // <url> | <image()> | <cross-fade()> | <gradient>
|
||||
// the image-set() function can not be nested inside of itself
|
||||
Object(node).type === 'func' && /^(cross-fade|image|(repeating-)?(conic|linear|radial)-gradient|url)$/i.test(node.value) && !(node.parent.parent && node.parent.parent.type === 'func' && imageSetFunctionMatchRegExp.test(node.parent.parent.value)) ? String(node) : Object(node).type === 'string' ? node.value : false);
|
||||
|
||||
const dpiRatios = {
|
||||
dpcm: 2.54,
|
||||
dpi: 1,
|
||||
dppx: 96,
|
||||
x: 96
|
||||
}; // return a valid @media rule
|
||||
|
||||
var getMedia = ((node, mediasByDpr) => {
|
||||
if (Object(node).type === 'number' && node.unit in dpiRatios) {
|
||||
// calculate min-device-pixel-ratio and min-resolution
|
||||
const dpi = Number(node.value) * dpiRatios[node.unit.toLowerCase()];
|
||||
const dpr = Math.floor(dpi / dpiRatios.x * 100) / 100;
|
||||
|
||||
if (dpi in mediasByDpr) {
|
||||
return false;
|
||||
} else {
|
||||
const media = mediasByDpr[dpi] = postcss.atRule({
|
||||
name: 'media',
|
||||
params: `(-webkit-min-device-pixel-ratio: ${dpr}), (min-resolution: ${dpi}dpi)`
|
||||
});
|
||||
return media;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var handleInvalidation = ((opts, message, word) => {
|
||||
if (opts.oninvalid === 'warn') {
|
||||
opts.decl.warn(opts.result, message, {
|
||||
word: String(word)
|
||||
});
|
||||
} else if (opts.oninvalid === 'throw') {
|
||||
throw opts.decl.error(message, {
|
||||
word: String(word)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var processImageSet = ((imageSetOptionNodes, decl, opts) => {
|
||||
const parent = decl.parent;
|
||||
const mediasByDpr = {};
|
||||
let length = imageSetOptionNodes.length;
|
||||
let index = -1;
|
||||
|
||||
while (index < length) {
|
||||
const _ref = [index < 0 ? true : getComma(imageSetOptionNodes[index]), getImage(imageSetOptionNodes[index + 1]), getMedia(imageSetOptionNodes[index + 2], mediasByDpr)],
|
||||
comma = _ref[0],
|
||||
value = _ref[1],
|
||||
media = _ref[2]; // handle invalidations
|
||||
|
||||
if (!comma) {
|
||||
return handleInvalidation(opts, 'unexpected comma', imageSetOptionNodes[index]);
|
||||
} else if (!value) {
|
||||
return handleInvalidation(opts, 'unexpected image', imageSetOptionNodes[index + 1]);
|
||||
} else if (!media) {
|
||||
return handleInvalidation(opts, 'unexpected resolution', imageSetOptionNodes[index + 2]);
|
||||
} // prepare @media { decl: <image> }
|
||||
|
||||
|
||||
const parentClone = parent.clone().removeAll();
|
||||
const declClone = decl.clone({
|
||||
value
|
||||
});
|
||||
parentClone.append(declClone);
|
||||
media.append(parentClone);
|
||||
index += 3;
|
||||
}
|
||||
|
||||
const medias = Object.keys(mediasByDpr).sort((a, b) => a - b).map(params => mediasByDpr[params]); // conditionally prepend previous siblings
|
||||
|
||||
if (medias.length) {
|
||||
const firstDecl = medias[0].nodes[0].nodes[0];
|
||||
|
||||
if (medias.length === 1) {
|
||||
decl.value = firstDecl.value;
|
||||
} else {
|
||||
const siblings = parent.nodes;
|
||||
const previousSiblings = siblings.slice(0, siblings.indexOf(decl)).concat(firstDecl);
|
||||
|
||||
if (previousSiblings.length) {
|
||||
const parentClone = parent.cloneBefore().removeAll();
|
||||
parentClone.append(previousSiblings);
|
||||
} // prepend any @media { decl: <image> } rules
|
||||
|
||||
|
||||
parent.before(medias.slice(1)); // conditionally remove the current rule
|
||||
|
||||
if (!opts.preserve) {
|
||||
decl.remove(); // and then conditionally remove its parent
|
||||
|
||||
if (!parent.nodes.length) {
|
||||
parent.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const imageSetValueMatchRegExp = /(^|[^\w-])(-webkit-)?image-set\(/;
|
||||
const imageSetFunctionMatchRegExp$1 = /^(-webkit-)?image-set$/i;
|
||||
var index = postcss.plugin('postcss-image-set-function', opts => {
|
||||
// prepare options
|
||||
const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
|
||||
const oninvalid = 'oninvalid' in Object(opts) ? opts.oninvalid : 'ignore';
|
||||
return (root, result) => {
|
||||
// for every declaration
|
||||
root.walkDecls(decl => {
|
||||
const value = decl.value; // if a declaration likely uses an image-set() function
|
||||
|
||||
if (imageSetValueMatchRegExp.test(value)) {
|
||||
const valueAST = valueParser(value).parse(); // process every image-set() function
|
||||
|
||||
valueAST.walkType('func', node => {
|
||||
if (imageSetFunctionMatchRegExp$1.test(node.value)) {
|
||||
processImageSet(node.nodes.slice(1, -1), decl, {
|
||||
decl,
|
||||
oninvalid,
|
||||
preserve,
|
||||
result
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
export default index;
|
||||
//# sourceMappingURL=index.es.mjs.map
|
1
web/node_modules/postcss-image-set-function/index.es.mjs.map
generated
vendored
Normal file
1
web/node_modules/postcss-image-set-function/index.es.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
60
web/node_modules/postcss-image-set-function/package.json
generated
vendored
Normal file
60
web/node_modules/postcss-image-set-function/package.json
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "postcss-image-set-function",
|
||||
"version": "3.0.1",
|
||||
"description": "Display resolution-dependent images using the image-set() function in CSS",
|
||||
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
||||
"license": "CC0-1.0",
|
||||
"repository": "jonathantneal/postcss-image-set-function",
|
||||
"homepage": "https://github.com/jonathantneal/postcss-image-set-function#readme",
|
||||
"bugs": "https://github.com/jonathantneal/postcss-image-set-function/issues",
|
||||
"main": "index.cjs.js",
|
||||
"module": "index.es.mjs",
|
||||
"files": [
|
||||
"index.cjs.js",
|
||||
"index.cjs.js.map",
|
||||
"index.es.mjs",
|
||||
"index.es.mjs.map"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm test",
|
||||
"pretest": "rollup -c .rollup.js --silent",
|
||||
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape",
|
||||
"test:ec": "echint --ignore index.*.js test",
|
||||
"test:js": "eslint *.js --cache --ignore-path .gitignore --quiet",
|
||||
"test:tape": "postcss-tape"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"postcss": "^7.0.2",
|
||||
"postcss-values-parser": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-config-dev": "^2.0.0",
|
||||
"postcss-tape": "^2.2.0",
|
||||
"pre-commit": "^1.2.2",
|
||||
"rollup": "^0.66.0",
|
||||
"rollup-plugin-babel": "^4.0.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "dev",
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"keywords": [
|
||||
"postcss",
|
||||
"css",
|
||||
"postcss-plugin",
|
||||
"image-set",
|
||||
"background",
|
||||
"image",
|
||||
"responsive",
|
||||
"resolution",
|
||||
"negotiation",
|
||||
"optimization"
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue