@tsparticles/plugin-hsl-color 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/browser/HslColorManager.js +44 -0
- package/browser/index.js +6 -0
- package/browser/package.json +1 -0
- package/cjs/HslColorManager.js +48 -0
- package/cjs/index.js +9 -0
- package/cjs/package.json +1 -0
- package/esm/HslColorManager.js +44 -0
- package/esm/index.js +6 -0
- package/esm/package.json +1 -0
- package/package.json +108 -0
- package/report.html +39 -0
- package/tsparticles.plugin.hslColor.js +138 -0
- package/tsparticles.plugin.hslColor.min.js +2 -0
- package/tsparticles.plugin.hslColor.min.js.LICENSE.txt +1 -0
- package/types/HslColorManager.d.ts +9 -0
- package/types/index.d.ts +2 -0
- package/umd/HslColorManager.js +58 -0
- package/umd/index.js +19 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Author : Matteo Bruni
|
|
3
|
+
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
+
* Demo / Generator : https://particles.js.org/
|
|
5
|
+
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
+
* How to use? : Check the GitHub README
|
|
7
|
+
* v3.7.0
|
|
8
|
+
*/
|
|
9
|
+
/*
|
|
10
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
11
|
+
* This devtool is neither made for production nor for readable output files.
|
|
12
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
13
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
14
|
+
* or disable the default devtool with "devtool: false".
|
|
15
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
16
|
+
*/
|
|
17
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
+
module.exports = factory(require("@tsparticles/engine"));
|
|
20
|
+
else if(typeof define === 'function' && define.amd)
|
|
21
|
+
define(["@tsparticles/engine"], factory);
|
|
22
|
+
else {
|
|
23
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
24
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
|
+
}
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
27
|
+
return /******/ (() => { // webpackBootstrap
|
|
28
|
+
/******/ "use strict";
|
|
29
|
+
/******/ var __webpack_modules__ = ({
|
|
30
|
+
|
|
31
|
+
/***/ "./dist/browser/HslColorManager.js":
|
|
32
|
+
/*!*****************************************!*\
|
|
33
|
+
!*** ./dist/browser/HslColorManager.js ***!
|
|
34
|
+
\*****************************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HslColorManager: () => (/* binding */ HslColorManager)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nvar HslIndexes;\n(function (HslIndexes) {\n HslIndexes[HslIndexes[\"h\"] = 1] = \"h\";\n HslIndexes[HslIndexes[\"s\"] = 2] = \"s\";\n HslIndexes[HslIndexes[\"l\"] = 3] = \"l\";\n HslIndexes[HslIndexes[\"a\"] = 5] = \"a\";\n})(HslIndexes || (HslIndexes = {}));\nclass HslColorManager {\n constructor() {\n this.key = \"hsl\";\n this.stringPrefix = \"hsl\";\n }\n handleColor(color) {\n const colorValue = color.value,\n hslColor = colorValue.hsl ?? color.value;\n if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.hslToRgb)(hslColor);\n }\n }\n handleRangeColor(color) {\n const colorValue = color.value,\n hslColor = colorValue.hsl ?? color.value;\n if (hslColor.h !== undefined && hslColor.l !== undefined) {\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.hslToRgb)({\n h: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(hslColor.h),\n l: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(hslColor.l),\n s: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(hslColor.s)\n });\n }\n }\n parseString(input) {\n if (!input.startsWith(\"hsl\")) {\n return;\n }\n const regex = /hsla?\\(\\s*(\\d+)\\s*[\\s,]\\s*(\\d+)%\\s*[\\s,]\\s*(\\d+)%\\s*([\\s,]\\s*(0|1|0?\\.\\d+|(\\d{1,3})%)\\s*)?\\)/i,\n result = regex.exec(input),\n minLength = 4,\n defaultAlpha = 1,\n radix = 10;\n return result ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.hslaToRgba)({\n a: result.length > minLength ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.parseAlpha)(result[HslIndexes.a]) : defaultAlpha,\n h: parseInt(result[HslIndexes.h], radix),\n l: parseInt(result[HslIndexes.l], radix),\n s: parseInt(result[HslIndexes.s], radix)\n }) : undefined;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-hsl-color/./dist/browser/HslColorManager.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/index.js":
|
|
42
|
+
/*!*******************************!*\
|
|
43
|
+
!*** ./dist/browser/index.js ***!
|
|
44
|
+
\*******************************/
|
|
45
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
|
+
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadHslColorPlugin: () => (/* binding */ loadHslColorPlugin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _HslColorManager_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HslColorManager.js */ \"./dist/browser/HslColorManager.js\");\n\n\nasync function loadHslColorPlugin(engine, refresh = true) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.assertValidVersion)(engine, \"3.7.0\");\n await engine.addColorManager(new _HslColorManager_js__WEBPACK_IMPORTED_MODULE_1__.HslColorManager(), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-hsl-color/./dist/browser/index.js?");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
51
|
+
/***/ "@tsparticles/engine":
|
|
52
|
+
/*!*********************************************************************************************************************************!*\
|
|
53
|
+
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
54
|
+
\*********************************************************************************************************************************/
|
|
55
|
+
/***/ ((module) => {
|
|
56
|
+
|
|
57
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
58
|
+
|
|
59
|
+
/***/ })
|
|
60
|
+
|
|
61
|
+
/******/ });
|
|
62
|
+
/************************************************************************/
|
|
63
|
+
/******/ // The module cache
|
|
64
|
+
/******/ var __webpack_module_cache__ = {};
|
|
65
|
+
/******/
|
|
66
|
+
/******/ // The require function
|
|
67
|
+
/******/ function __webpack_require__(moduleId) {
|
|
68
|
+
/******/ // Check if module is in cache
|
|
69
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
70
|
+
/******/ if (cachedModule !== undefined) {
|
|
71
|
+
/******/ return cachedModule.exports;
|
|
72
|
+
/******/ }
|
|
73
|
+
/******/ // Create a new module (and put it into the cache)
|
|
74
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
75
|
+
/******/ // no module.id needed
|
|
76
|
+
/******/ // no module.loaded needed
|
|
77
|
+
/******/ exports: {}
|
|
78
|
+
/******/ };
|
|
79
|
+
/******/
|
|
80
|
+
/******/ // Execute the module function
|
|
81
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
82
|
+
/******/
|
|
83
|
+
/******/ // Return the exports of the module
|
|
84
|
+
/******/ return module.exports;
|
|
85
|
+
/******/ }
|
|
86
|
+
/******/
|
|
87
|
+
/************************************************************************/
|
|
88
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
89
|
+
/******/ (() => {
|
|
90
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
91
|
+
/******/ __webpack_require__.n = (module) => {
|
|
92
|
+
/******/ var getter = module && module.__esModule ?
|
|
93
|
+
/******/ () => (module['default']) :
|
|
94
|
+
/******/ () => (module);
|
|
95
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
96
|
+
/******/ return getter;
|
|
97
|
+
/******/ };
|
|
98
|
+
/******/ })();
|
|
99
|
+
/******/
|
|
100
|
+
/******/ /* webpack/runtime/define property getters */
|
|
101
|
+
/******/ (() => {
|
|
102
|
+
/******/ // define getter functions for harmony exports
|
|
103
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
104
|
+
/******/ for(var key in definition) {
|
|
105
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
106
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
107
|
+
/******/ }
|
|
108
|
+
/******/ }
|
|
109
|
+
/******/ };
|
|
110
|
+
/******/ })();
|
|
111
|
+
/******/
|
|
112
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
113
|
+
/******/ (() => {
|
|
114
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
115
|
+
/******/ })();
|
|
116
|
+
/******/
|
|
117
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
118
|
+
/******/ (() => {
|
|
119
|
+
/******/ // define __esModule on exports
|
|
120
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
121
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
122
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
123
|
+
/******/ }
|
|
124
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
125
|
+
/******/ };
|
|
126
|
+
/******/ })();
|
|
127
|
+
/******/
|
|
128
|
+
/************************************************************************/
|
|
129
|
+
/******/
|
|
130
|
+
/******/ // startup
|
|
131
|
+
/******/ // Load entry module and return exports
|
|
132
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
133
|
+
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
134
|
+
/******/
|
|
135
|
+
/******/ return __webpack_exports__;
|
|
136
|
+
/******/ })()
|
|
137
|
+
;
|
|
138
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see tsparticles.plugin.hslColor.min.js.LICENSE.txt */
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},r={};function o(e){var s=r[e];if(void 0!==s)return s.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{loadHslColorPlugin:()=>i});var n,a=o(303);!function(e){e[e.h=1]="h",e[e.s=2]="s",e[e.l=3]="l",e[e.a=5]="a"}(n||(n={}));class l{constructor(){this.key="hsl",this.stringPrefix="hsl"}handleColor(e){const t=e.value.hsl??e.value;if(void 0!==t.h&&void 0!==t.s&&void 0!==t.l)return(0,a.hslToRgb)(t)}handleRangeColor(e){const t=e.value.hsl??e.value;if(void 0!==t.h&&void 0!==t.l)return(0,a.hslToRgb)({h:(0,a.getRangeValue)(t.h),l:(0,a.getRangeValue)(t.l),s:(0,a.getRangeValue)(t.s)})}parseString(e){if(!e.startsWith("hsl"))return;const t=/hsla?\(\s*(\d+)\s*[\s,]\s*(\d+)%\s*[\s,]\s*(\d+)%\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i.exec(e);return t?(0,a.hslaToRgba)({a:t.length>4?(0,a.parseAlpha)(t[n.a]):1,h:parseInt(t[n.h],10),l:parseInt(t[n.l],10),s:parseInt(t[n.s],10)}):void 0}}async function i(e,t=!0){(0,a.assertValidVersion)(e,"3.7.0"),await e.addColorManager(new l,t)}return s})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles HSL Color Plugin v3.7.0 by Matteo Bruni */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IColor, type IColorManager, type IRangeColor, type IRgb, type IRgba } from "@tsparticles/engine";
|
|
2
|
+
export declare class HslColorManager implements IColorManager {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly stringPrefix: string;
|
|
5
|
+
constructor();
|
|
6
|
+
handleColor(color: IColor): IRgb | undefined;
|
|
7
|
+
handleRangeColor(color: IRangeColor): IRgb | undefined;
|
|
8
|
+
parseString(input: string): IRgba | undefined;
|
|
9
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HslColorManager = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
var HslIndexes;
|
|
15
|
+
(function (HslIndexes) {
|
|
16
|
+
HslIndexes[HslIndexes["h"] = 1] = "h";
|
|
17
|
+
HslIndexes[HslIndexes["s"] = 2] = "s";
|
|
18
|
+
HslIndexes[HslIndexes["l"] = 3] = "l";
|
|
19
|
+
HslIndexes[HslIndexes["a"] = 5] = "a";
|
|
20
|
+
})(HslIndexes || (HslIndexes = {}));
|
|
21
|
+
class HslColorManager {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.key = "hsl";
|
|
24
|
+
this.stringPrefix = "hsl";
|
|
25
|
+
}
|
|
26
|
+
handleColor(color) {
|
|
27
|
+
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
28
|
+
if (hslColor.h !== undefined && hslColor.s !== undefined && hslColor.l !== undefined) {
|
|
29
|
+
return (0, engine_1.hslToRgb)(hslColor);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
handleRangeColor(color) {
|
|
33
|
+
const colorValue = color.value, hslColor = colorValue.hsl ?? color.value;
|
|
34
|
+
if (hslColor.h !== undefined && hslColor.l !== undefined) {
|
|
35
|
+
return (0, engine_1.hslToRgb)({
|
|
36
|
+
h: (0, engine_1.getRangeValue)(hslColor.h),
|
|
37
|
+
l: (0, engine_1.getRangeValue)(hslColor.l),
|
|
38
|
+
s: (0, engine_1.getRangeValue)(hslColor.s),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
parseString(input) {
|
|
43
|
+
if (!input.startsWith("hsl")) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const regex = /hsla?\(\s*(\d+)\s*[\s,]\s*(\d+)%\s*[\s,]\s*(\d+)%\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i, result = regex.exec(input), minLength = 4, defaultAlpha = 1, radix = 10;
|
|
47
|
+
return result
|
|
48
|
+
? (0, engine_1.hslaToRgba)({
|
|
49
|
+
a: result.length > minLength ? (0, engine_1.parseAlpha)(result[HslIndexes.a]) : defaultAlpha,
|
|
50
|
+
h: parseInt(result[HslIndexes.h], radix),
|
|
51
|
+
l: parseInt(result[HslIndexes.l], radix),
|
|
52
|
+
s: parseInt(result[HslIndexes.s], radix),
|
|
53
|
+
})
|
|
54
|
+
: undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.HslColorManager = HslColorManager;
|
|
58
|
+
});
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./HslColorManager.js"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadHslColorPlugin = loadHslColorPlugin;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const HslColorManager_js_1 = require("./HslColorManager.js");
|
|
15
|
+
async function loadHslColorPlugin(engine, refresh = true) {
|
|
16
|
+
(0, engine_1.assertValidVersion)(engine, "3.7.0");
|
|
17
|
+
await engine.addColorManager(new HslColorManager_js_1.HslColorManager(), refresh);
|
|
18
|
+
}
|
|
19
|
+
});
|