It appears you have a well-structured Git repository with various files, including SVG icons and HTML documents. Here's a brief overview:
This commit is contained in:
22
backend/node_modules/postcss-svgo/LICENSE-MIT
generated
vendored
Normal file
22
backend/node_modules/postcss-svgo/LICENSE-MIT
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
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.
|
109
backend/node_modules/postcss-svgo/README.md
generated
vendored
Normal file
109
backend/node_modules/postcss-svgo/README.md
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# [postcss][postcss]-svgo
|
||||
|
||||
> Optimise inline SVG with PostCSS.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org/package/postcss-svgo) do:
|
||||
|
||||
```
|
||||
npm install postcss-svgo --save
|
||||
```
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
### Input
|
||||
|
||||
```css
|
||||
h1 {
|
||||
background: url('data:image/svg+xml;charset=utf-8,<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"><circle cx="50" cy="50" r="40" fill="yellow" /></svg>');
|
||||
}
|
||||
|
||||
h2 {
|
||||
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNDAiIGZpbGw9InllbGxvdyIgLz48IS0tdGVzdCBjb21tZW50LS0+PC9zdmc+');
|
||||
}
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```css
|
||||
h1 {
|
||||
background: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="%23ff0"/></svg>');
|
||||
}
|
||||
|
||||
h2 {
|
||||
background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjQwIiBmaWxsPSIjZmYwIi8+PC9zdmc+');
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### `svgo([options])`
|
||||
|
||||
#### options
|
||||
|
||||
##### encode
|
||||
|
||||
Type: `boolean`
|
||||
Default: `undefined`
|
||||
|
||||
If `true`, it will encode URL-unsafe characters such as `<`, `>` and `&`;
|
||||
`false` will decode these characters, and `undefined` will neither encode nor
|
||||
decode the original input. Note that regardless of this setting, `#` will
|
||||
always be URL-encoded.
|
||||
|
||||
##### plugins
|
||||
|
||||
Optionally, you can customise the output by specifying the `plugins` option. You
|
||||
will need to provide the config in comma separated objects, like the example
|
||||
below. Note that you can either disable the plugin by setting it to `false`,
|
||||
or pass different options to change the default behaviour.
|
||||
|
||||
```js
|
||||
const postcss = require('postcss');
|
||||
const svgo = require('postcss-svgo');
|
||||
|
||||
const opts = {
|
||||
plugins: [{
|
||||
name: 'preset-default',
|
||||
params: {
|
||||
overrides: {
|
||||
removeViewBox: false,
|
||||
removeComments: false,
|
||||
cleanupNumericValues: {
|
||||
floatPrecision: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
postcss([ svgo(opts) ]).process(css).then((result) => {
|
||||
console.log(result.css)
|
||||
});
|
||||
```
|
||||
|
||||
You can view the [full list of plugins here][plugins].
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
|
||||
examples for your environment.
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Briggs](http://beneb.info)
|
||||
|
||||
[postcss]: https://github.com/postcss/postcss
|
||||
[plugins]: https://svgo.dev/docs/plugins/
|
46
backend/node_modules/postcss-svgo/package.json
generated
vendored
Normal file
46
backend/node_modules/postcss-svgo/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "postcss-svgo",
|
||||
"version": "7.0.2",
|
||||
"description": "Optimise inline SVG with PostCSS.",
|
||||
"main": "src/index.js",
|
||||
"types": "types/index.d.ts",
|
||||
"files": [
|
||||
"LICENSE-MIT",
|
||||
"src",
|
||||
"types"
|
||||
],
|
||||
"keywords": [
|
||||
"css",
|
||||
"minify",
|
||||
"optimise",
|
||||
"postcss",
|
||||
"postcss-plugin",
|
||||
"svg",
|
||||
"svgo"
|
||||
],
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/cssnano/cssnano",
|
||||
"author": {
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
"repository": "cssnano/cssnano",
|
||||
"dependencies": {
|
||||
"postcss-value-parser": "^4.2.0",
|
||||
"svgo": "^3.3.2"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cssnano/cssnano/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.12.0 || ^20.9.0 || >= 18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"pleeease-filters": "^4.0.0",
|
||||
"postcss": "^8.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.4.32"
|
||||
}
|
||||
}
|
1
backend/node_modules/postcss-svgo/src/globals.d.ts
generated
vendored
Normal file
1
backend/node_modules/postcss-svgo/src/globals.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare var URL: typeof import('url').URL;
|
140
backend/node_modules/postcss-svgo/src/index.js
generated
vendored
Normal file
140
backend/node_modules/postcss-svgo/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
'use strict';
|
||||
const valueParser = require('postcss-value-parser');
|
||||
const { optimize } = require('svgo');
|
||||
const { encode, decode } = require('./lib/url');
|
||||
|
||||
const PLUGIN = 'postcss-svgo';
|
||||
const dataURI = /data:image\/svg\+xml(;((charset=)?utf-8|base64))?,/i;
|
||||
const dataURIBase64 = /data:image\/svg\+xml;base64,/i;
|
||||
|
||||
// the following regex will globally match:
|
||||
// \b([\w-]+) --> a word (a sequence of one or more [alphanumeric|underscore|dash] characters; followed by
|
||||
// \s*=\s* --> an equal sign character (=) between optional whitespaces; followed by
|
||||
// \\"([\S\s]+?)\\" --> any characters (including whitespaces and newlines) between literal escaped quotes (\")
|
||||
const escapedQuotes = /\b([\w-]+)\s*=\s*\\"([\S\s]+?)\\"/g;
|
||||
|
||||
/**
|
||||
* @param {string} input the SVG string
|
||||
* @param {Options} opts
|
||||
* @return {{result: string, isUriEncoded: boolean}} the minification result
|
||||
*/
|
||||
function minifySVG(input, opts) {
|
||||
let svg = input;
|
||||
let decodedUri, isUriEncoded;
|
||||
try {
|
||||
decodedUri = decode(input);
|
||||
isUriEncoded = decodedUri !== input;
|
||||
} catch {
|
||||
// Swallow exception if we cannot decode the value
|
||||
isUriEncoded = false;
|
||||
}
|
||||
|
||||
if (isUriEncoded) {
|
||||
svg = /** @type {string} */ (decodedUri);
|
||||
}
|
||||
|
||||
if (opts.encode !== undefined) {
|
||||
isUriEncoded = opts.encode;
|
||||
}
|
||||
|
||||
// normalize all escaped quote characters from svg attributes
|
||||
// from <svg attr=\"value\"... /> to <svg attr="value"... />
|
||||
// see: https://github.com/cssnano/cssnano/issues/1194
|
||||
svg = svg.replace(escapedQuotes, '$1="$2"');
|
||||
|
||||
const result = optimize(svg, opts);
|
||||
|
||||
return {
|
||||
result: /** @type {import('svgo').Output}*/ (result).data,
|
||||
isUriEncoded,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('postcss').Declaration} decl
|
||||
* @param {Options} opts
|
||||
* @param {import('postcss').Result} postcssResult
|
||||
* @return {void}
|
||||
*/
|
||||
function minify(decl, opts, postcssResult) {
|
||||
const parsed = valueParser(decl.value);
|
||||
|
||||
const minified = parsed.walk((node) => {
|
||||
if (
|
||||
node.type !== 'function' ||
|
||||
node.value.toLowerCase() !== 'url' ||
|
||||
!node.nodes.length
|
||||
) {
|
||||
return;
|
||||
}
|
||||
let { value, quote } = /** @type {valueParser.StringNode} */ (
|
||||
node.nodes[0]
|
||||
);
|
||||
|
||||
let optimizedValue;
|
||||
|
||||
try {
|
||||
if (dataURIBase64.test(value)) {
|
||||
const url = new URL(value);
|
||||
const base64String = `${url.protocol}${url.pathname}`.replace(
|
||||
dataURI,
|
||||
''
|
||||
);
|
||||
const svg = Buffer.from(base64String, 'base64').toString('utf8');
|
||||
const { result } = minifySVG(svg, opts);
|
||||
const data = Buffer.from(result).toString('base64');
|
||||
optimizedValue = 'data:image/svg+xml;base64,' + data + url.hash;
|
||||
} else if (dataURI.test(value)) {
|
||||
const svg = value.replace(dataURI, '');
|
||||
const { result, isUriEncoded } = minifySVG(svg, opts);
|
||||
let data = isUriEncoded ? encode(result) : result;
|
||||
// Should always encode # otherwise we yield a broken SVG
|
||||
// in Firefox (works in Chrome however). See this issue:
|
||||
// https://github.com/cssnano/cssnano/issues/245
|
||||
data = data.replace(/#/g, '%23');
|
||||
optimizedValue = 'data:image/svg+xml;charset=utf-8,' + data;
|
||||
quote = isUriEncoded ? '"' : "'";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
decl.warn(postcssResult, `${error}`);
|
||||
return;
|
||||
}
|
||||
node.nodes[0] = Object.assign({}, node.nodes[0], {
|
||||
value: optimizedValue,
|
||||
quote: quote,
|
||||
type: 'string',
|
||||
before: '',
|
||||
after: '',
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
decl.value = minified.toString();
|
||||
}
|
||||
/** @typedef {{encode?: boolean} & import('svgo').Config} Options */
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<Options>}
|
||||
* @param {Options} opts
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
function pluginCreator(opts = {}) {
|
||||
return {
|
||||
postcssPlugin: PLUGIN,
|
||||
|
||||
OnceExit(css, { result }) {
|
||||
css.walkDecls((decl) => {
|
||||
if (!dataURI.test(decl.value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
minify(decl, opts, result);
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
pluginCreator.postcss = true;
|
||||
module.exports = pluginCreator;
|
18
backend/node_modules/postcss-svgo/src/lib/url.js
generated
vendored
Normal file
18
backend/node_modules/postcss-svgo/src/lib/url.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
/**
|
||||
* @param {string} data
|
||||
* @return {string}
|
||||
*/
|
||||
function encode(data) {
|
||||
return data
|
||||
.replace(/"/g, "'")
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/</g, '%3C')
|
||||
.replace(/>/g, '%3E')
|
||||
.replace(/&/g, '%26')
|
||||
.replace(/#/g, '%23')
|
||||
.replace(/\s+/g, ' ');
|
||||
}
|
||||
|
||||
const decode = decodeURIComponent;
|
||||
module.exports = { encode, decode };
|
16
backend/node_modules/postcss-svgo/types/index.d.ts
generated
vendored
Normal file
16
backend/node_modules/postcss-svgo/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export = pluginCreator;
|
||||
/** @typedef {{encode?: boolean} & import('svgo').Config} Options */
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<Options>}
|
||||
* @param {Options} opts
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
declare function pluginCreator(opts?: Options): import("postcss").Plugin;
|
||||
declare namespace pluginCreator {
|
||||
export { postcss, Options };
|
||||
}
|
||||
declare var postcss: true;
|
||||
type Options = {
|
||||
encode?: boolean;
|
||||
} & import("svgo").Config;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
backend/node_modules/postcss-svgo/types/index.d.ts.map
generated
vendored
Normal file
1
backend/node_modules/postcss-svgo/types/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAoHA,oEAAoE;AACpE;;;;GAIG;AACH,sCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAgBnC;;;;;eApBa;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAC,GAAG,OAAO,MAAM,EAAE,MAAM"}
|
7
backend/node_modules/postcss-svgo/types/lib/url.d.ts
generated
vendored
Normal file
7
backend/node_modules/postcss-svgo/types/lib/url.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @param {string} data
|
||||
* @return {string}
|
||||
*/
|
||||
export function encode(data: string): string;
|
||||
export const decode: typeof decodeURIComponent;
|
||||
//# sourceMappingURL=url.d.ts.map
|
1
backend/node_modules/postcss-svgo/types/lib/url.d.ts.map
generated
vendored
Normal file
1
backend/node_modules/postcss-svgo/types/lib/url.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/lib/url.js"],"names":[],"mappings":"AACA;;;GAGG;AACH,6BAHW,MAAM,GACL,MAAM,CAWjB;AAED,+CAAkC"}
|
Reference in New Issue
Block a user