flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

66
BACK_BACK/node_modules/srcset/index.d.ts generated vendored Executable file
View file

@ -0,0 +1,66 @@
declare namespace srcset {
interface SrcSetDefinition {
url: string;
width?: number;
density?: number;
}
}
declare const srcset: {
/**
Parse the HTML `<img>` [srcset](http://mobile.smashingmagazine.com/2013/08/21/webkit-implements-srcset-and-why-its-a-good-thing/) attribute.
@param srcset - A srcset string.
@example
```
import srcset = require('srcset');
console.log(srcset.parse('banner-HD.jpg 2x, banner-phone.jpg 100w'));
// [
// {
// url: 'banner-HD.jpg',
// density: 2
// },
// {
// url: 'banner-phone.jpg',
// width: 100
// }
// ]
```
*/
parse: (srcset: string) => srcset.SrcSetDefinition[];
/**
Stringify `SrcSetDefinition`s.
@returns A srcset string.
@example
```
import srcset = require('srcset');
const stringified = srcset.stringify([
{
url: 'banner-HD.jpg',
density: 2
},
{
url: 'banner-phone.jpg',
width: 100
},
{
url: 'banner-phone-HD.jpg',
width: 100,
density: 2
}
]);
console.log(stringified);
// banner-HD.jpg 2x, banner-phone.jpg 100w, banner-phone-HD.jpg 100w 2x
```
*/
stringify: (srcSetDefinitions: srcset.SrcSetDefinition[]) => string;
};
export = srcset;

93
BACK_BACK/node_modules/srcset/index.js generated vendored Executable file
View file

@ -0,0 +1,93 @@
'use strict';
/**
This regex represents a loose rule of an image candidate string.
@see https://html.spec.whatwg.org/multipage/images.html#srcset-attribute
An image candidate string roughly consists of the following:
1. Zero or more whitespace characters.
2. A non-empty URL that does not start or end with `,`.
3. Zero or more whitespace characters.
4. An optional descriptor that starts with a whitespace character.
5. Zero or more whitespace characters.
6. Each image candidate string is separated by a `,`.
We intentionally implement a loose rule here so that we can perform more aggressive error handling and reporting in the below code.
*/
const imageCandidateRegex = /\s*([^,]\S*[^,](?:\s+[^,]+)?)\s*(?:,|$)/;
function deepUnique(array) {
return array.sort().filter((element, index) => {
return JSON.stringify(element) !== JSON.stringify(array[index - 1]);
});
}
exports.parse = string => {
return deepUnique(
string.split(imageCandidateRegex)
.filter((part, index) => index % 2 === 1)
.map(part => {
const [url, ...elements] = part.trim().split(/\s+/);
const result = {url};
const descriptors = elements.length > 0 ? elements : ['1x'];
for (const descriptor of descriptors) {
const postfix = descriptor[descriptor.length - 1];
const value = Number.parseFloat(descriptor.slice(0, -1));
if (Number.isNaN(value)) {
throw new TypeError(`${descriptor.slice(0, -1)} is not a valid number`);
}
if (postfix === 'w') {
if (value <= 0) {
throw new Error('Width descriptor must be greater than zero');
} else if (!Number.isInteger(value)) {
throw new TypeError('Width descriptor must be an integer');
}
result.width = value;
} else if (postfix === 'x') {
if (value <= 0) {
throw new Error('Pixel density descriptor must be greater than zero');
}
result.density = value;
} else {
throw new Error(`Invalid srcset descriptor: ${descriptor}`);
}
if (result.width && result.density) {
throw new Error('Image candidate string cannot have both width descriptor and pixel density descriptor');
}
}
return result;
})
);
};
exports.stringify = array => {
return [...new Set(
array.map(element => {
if (!element.url) {
throw new Error('URL is required');
}
const result = [element.url];
if (element.width) {
result.push(`${element.width}w`);
}
if (element.density) {
result.push(`${element.density}x`);
}
return result.join(' ');
})
)].join(', ');
};

9
BACK_BACK/node_modules/srcset/license generated vendored Executable file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

41
BACK_BACK/node_modules/srcset/package.json generated vendored Executable file
View file

@ -0,0 +1,41 @@
{
"name": "srcset",
"version": "3.0.1",
"description": "Parse and stringify the HTML `<img>` srcset attribute",
"license": "MIT",
"repository": "sindresorhus/srcset",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"html",
"attribute",
"image",
"img",
"src",
"parse",
"stringify",
"srcset",
"responsive",
"picture",
"element"
],
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.13.1",
"xo": "^0.32.1"
}
}

76
BACK_BACK/node_modules/srcset/readme.md generated vendored Executable file
View file

@ -0,0 +1,76 @@
# srcset
> Parse and stringify the HTML `<img>` [srcset](https://www.smashingmagazine.com/2013/08/webkit-implements-srcset-and-why-its-a-good-thing/) attribute.
Can be useful if you're creating a build-tool.
## Install
```
$ npm install srcset
```
## Usage
How an image with `srcset` might look like:
```html
<img alt="The Breakfast Combo"
src="banner.jpg"
srcset="banner-HD.jpg 2x, banner-phone.jpg 100w, banner-phone-HD.jpg 100w 2x">
```
Then have some fun with it:
```js
const srcset = require('srcset');
const parsed = srcset.parse('banner-HD.jpg 2x, banner-phone.jpg 100w');
console.log(parsed);
/*
[
{
url: 'banner-HD.jpg',
density: 2
},
{
url: 'banner-phone.jpg',
width: 100
}
]
*/
parsed.push({
url: 'banner-phone-HD.jpg',
width: 100,
density: 2
});
const stringified = srcset.stringify(parsed);
console.log(stringified);
/*
banner-HD.jpg 2x, banner-phone.jpg 100w, banner-phone-HD.jpg 100w 2x
*/
```
## API
### .parse()
Accepts a srcset string and returns an array of objects with the possible properties: `url` (always), `width`, `density`.
### .stringify()
Accepts an array of objects with the possible properties: `url` (required), `width`, `density` and returns a srcset string.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-srcset?utm_source=npm-srcset&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>