@tsparticles/plugin-hex-color 3.9.1 → 4.0.0-alpha.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.
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.9.1
7
+ * v4.0.0-alpha.0
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,25 +28,15 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/HexColorManager.js":
32
- /*!*****************************************!*\
33
- !*** ./dist/browser/HexColorManager.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 */ HexColorManager: () => (/* binding */ HexColorManager)\n/* harmony export */ });\nvar RgbIndexes;\n(function (RgbIndexes) {\n RgbIndexes[RgbIndexes[\"r\"] = 1] = \"r\";\n RgbIndexes[RgbIndexes[\"g\"] = 2] = \"g\";\n RgbIndexes[RgbIndexes[\"b\"] = 3] = \"b\";\n RgbIndexes[RgbIndexes[\"a\"] = 4] = \"a\";\n})(RgbIndexes || (RgbIndexes = {}));\nconst shorthandHexRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])([a-f\\d])?$/i,\n hexRegex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})?$/i,\n hexRadix = 16,\n defaultAlpha = 1,\n alphaFactor = 0xff;\nclass HexColorManager {\n constructor() {\n this.key = \"hex\";\n this.stringPrefix = \"#\";\n }\n handleColor(color) {\n return this._parseString(color.value);\n }\n handleRangeColor(color) {\n return this._parseString(color.value);\n }\n parseString(input) {\n return this._parseString(input);\n }\n _parseString(hexColor) {\n if (typeof hexColor !== \"string\") {\n return;\n }\n if (!hexColor?.startsWith(this.stringPrefix)) {\n return;\n }\n const hexFixed = hexColor.replace(shorthandHexRegex, (_, r, g, b, a) => {\n return r + r + g + g + b + b + (a !== undefined ? a + a : \"\");\n }),\n result = hexRegex.exec(hexFixed);\n return result ? {\n a: result[RgbIndexes.a] !== undefined ? parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,\n b: parseInt(result[RgbIndexes.b], hexRadix),\n g: parseInt(result[RgbIndexes.g], hexRadix),\n r: parseInt(result[RgbIndexes.r], hexRadix)\n } : undefined;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-hex-color/./dist/browser/HexColorManager.js?\n}");
38
-
39
- /***/ }),
40
-
41
- /***/ "./dist/browser/index.js":
31
+ /***/ "./dist/browser/index.js"
42
32
  /*!*******************************!*\
43
33
  !*** ./dist/browser/index.js ***!
44
34
  \*******************************/
45
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
36
 
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadHexColorPlugin: () => (/* binding */ loadHexColorPlugin)\n/* harmony export */ });\n/* harmony import */ var _HexColorManager_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HexColorManager.js */ \"./dist/browser/HexColorManager.js\");\n\nasync function loadHexColorPlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n await engine.addColorManager(new _HexColorManager_js__WEBPACK_IMPORTED_MODULE_0__.HexColorManager(), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-hex-color/./dist/browser/index.js?\n}");
37
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadHexColorPlugin: () => (/* binding */ loadHexColorPlugin)\n/* harmony export */ });\nfunction loadHexColorPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.0\");\n engine.register(async e => {\n const {\n HexColorManager\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_HexColorManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./HexColorManager.js */ \"./dist/browser/HexColorManager.js\"));\n e.addColorManager(new HexColorManager());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-hex-color/./dist/browser/index.js?\n}");
48
38
 
49
- /***/ })
39
+ /***/ }
50
40
 
51
41
  /******/ });
52
42
  /************************************************************************/
@@ -60,6 +50,12 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
60
50
  /******/ if (cachedModule !== undefined) {
61
51
  /******/ return cachedModule.exports;
62
52
  /******/ }
53
+ /******/ // Check if module exists (development only)
54
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
55
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
56
+ /******/ e.code = 'MODULE_NOT_FOUND';
57
+ /******/ throw e;
58
+ /******/ }
63
59
  /******/ // Create a new module (and put it into the cache)
64
60
  /******/ var module = __webpack_module_cache__[moduleId] = {
65
61
  /******/ // no module.id needed
@@ -74,6 +70,9 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
74
70
  /******/ return module.exports;
75
71
  /******/ }
76
72
  /******/
73
+ /******/ // expose the modules object (__webpack_modules__)
74
+ /******/ __webpack_require__.m = __webpack_modules__;
75
+ /******/
77
76
  /************************************************************************/
78
77
  /******/ /* webpack/runtime/define property getters */
79
78
  /******/ (() => {
@@ -87,11 +86,90 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
87
86
  /******/ };
88
87
  /******/ })();
89
88
  /******/
89
+ /******/ /* webpack/runtime/ensure chunk */
90
+ /******/ (() => {
91
+ /******/ __webpack_require__.f = {};
92
+ /******/ // This file contains only the entry chunk.
93
+ /******/ // The chunk loading function for additional chunks
94
+ /******/ __webpack_require__.e = (chunkId) => {
95
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
96
+ /******/ __webpack_require__.f[key](chunkId, promises);
97
+ /******/ return promises;
98
+ /******/ }, []));
99
+ /******/ };
100
+ /******/ })();
101
+ /******/
102
+ /******/ /* webpack/runtime/get javascript chunk filename */
103
+ /******/ (() => {
104
+ /******/ // This function allow to reference async chunks
105
+ /******/ __webpack_require__.u = (chunkId) => {
106
+ /******/ // return url for filenames based on template
107
+ /******/ return "" + chunkId + ".js";
108
+ /******/ };
109
+ /******/ })();
110
+ /******/
111
+ /******/ /* webpack/runtime/global */
112
+ /******/ (() => {
113
+ /******/ __webpack_require__.g = (function() {
114
+ /******/ if (typeof globalThis === 'object') return globalThis;
115
+ /******/ try {
116
+ /******/ return this || new Function('return this')();
117
+ /******/ } catch (e) {
118
+ /******/ if (typeof window === 'object') return window;
119
+ /******/ }
120
+ /******/ })();
121
+ /******/ })();
122
+ /******/
90
123
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
91
124
  /******/ (() => {
92
125
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
93
126
  /******/ })();
94
127
  /******/
128
+ /******/ /* webpack/runtime/load script */
129
+ /******/ (() => {
130
+ /******/ var inProgress = {};
131
+ /******/ var dataWebpackPrefix = "@tsparticles/plugin-hex-color:";
132
+ /******/ // loadScript function to load a script via script tag
133
+ /******/ __webpack_require__.l = (url, done, key, chunkId) => {
134
+ /******/ if(inProgress[url]) { inProgress[url].push(done); return; }
135
+ /******/ var script, needAttach;
136
+ /******/ if(key !== undefined) {
137
+ /******/ var scripts = document.getElementsByTagName("script");
138
+ /******/ for(var i = 0; i < scripts.length; i++) {
139
+ /******/ var s = scripts[i];
140
+ /******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
141
+ /******/ }
142
+ /******/ }
143
+ /******/ if(!script) {
144
+ /******/ needAttach = true;
145
+ /******/ script = document.createElement('script');
146
+ /******/
147
+ /******/ script.charset = 'utf-8';
148
+ /******/ if (__webpack_require__.nc) {
149
+ /******/ script.setAttribute("nonce", __webpack_require__.nc);
150
+ /******/ }
151
+ /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
152
+ /******/
153
+ /******/ script.src = url;
154
+ /******/ }
155
+ /******/ inProgress[url] = [done];
156
+ /******/ var onScriptComplete = (prev, event) => {
157
+ /******/ // avoid mem leaks in IE.
158
+ /******/ script.onerror = script.onload = null;
159
+ /******/ clearTimeout(timeout);
160
+ /******/ var doneFns = inProgress[url];
161
+ /******/ delete inProgress[url];
162
+ /******/ script.parentNode && script.parentNode.removeChild(script);
163
+ /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
164
+ /******/ if(prev) return prev(event);
165
+ /******/ }
166
+ /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
167
+ /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
168
+ /******/ script.onload = onScriptComplete.bind(null, script.onload);
169
+ /******/ needAttach && document.head.appendChild(script);
170
+ /******/ };
171
+ /******/ })();
172
+ /******/
95
173
  /******/ /* webpack/runtime/make namespace object */
96
174
  /******/ (() => {
97
175
  /******/ // define __esModule on exports
@@ -103,6 +181,119 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
103
181
  /******/ };
104
182
  /******/ })();
105
183
  /******/
184
+ /******/ /* webpack/runtime/publicPath */
185
+ /******/ (() => {
186
+ /******/ var scriptUrl;
187
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
188
+ /******/ var document = __webpack_require__.g.document;
189
+ /******/ if (!scriptUrl && document) {
190
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
191
+ /******/ scriptUrl = document.currentScript.src;
192
+ /******/ if (!scriptUrl) {
193
+ /******/ var scripts = document.getElementsByTagName("script");
194
+ /******/ if(scripts.length) {
195
+ /******/ var i = scripts.length - 1;
196
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
197
+ /******/ }
198
+ /******/ }
199
+ /******/ }
200
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
201
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
202
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
203
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
204
+ /******/ __webpack_require__.p = scriptUrl;
205
+ /******/ })();
206
+ /******/
207
+ /******/ /* webpack/runtime/jsonp chunk loading */
208
+ /******/ (() => {
209
+ /******/ // no baseURI
210
+ /******/
211
+ /******/ // object to store loaded and loading chunks
212
+ /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
213
+ /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
214
+ /******/ var installedChunks = {
215
+ /******/ "tsparticles.plugin.hexColor": 0
216
+ /******/ };
217
+ /******/
218
+ /******/ __webpack_require__.f.j = (chunkId, promises) => {
219
+ /******/ // JSONP chunk loading for javascript
220
+ /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
221
+ /******/ if(installedChunkData !== 0) { // 0 means "already installed".
222
+ /******/
223
+ /******/ // a Promise means "currently loading".
224
+ /******/ if(installedChunkData) {
225
+ /******/ promises.push(installedChunkData[2]);
226
+ /******/ } else {
227
+ /******/ if(true) { // all chunks have JS
228
+ /******/ // setup Promise in chunk cache
229
+ /******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
230
+ /******/ promises.push(installedChunkData[2] = promise);
231
+ /******/
232
+ /******/ // start chunk loading
233
+ /******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
234
+ /******/ // create error before stack unwound to get useful stacktrace later
235
+ /******/ var error = new Error();
236
+ /******/ var loadingEnded = (event) => {
237
+ /******/ if(__webpack_require__.o(installedChunks, chunkId)) {
238
+ /******/ installedChunkData = installedChunks[chunkId];
239
+ /******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
240
+ /******/ if(installedChunkData) {
241
+ /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
242
+ /******/ var realSrc = event && event.target && event.target.src;
243
+ /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
244
+ /******/ error.name = 'ChunkLoadError';
245
+ /******/ error.type = errorType;
246
+ /******/ error.request = realSrc;
247
+ /******/ installedChunkData[1](error);
248
+ /******/ }
249
+ /******/ }
250
+ /******/ };
251
+ /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
252
+ /******/ }
253
+ /******/ }
254
+ /******/ }
255
+ /******/ };
256
+ /******/
257
+ /******/ // no prefetching
258
+ /******/
259
+ /******/ // no preloaded
260
+ /******/
261
+ /******/ // no HMR
262
+ /******/
263
+ /******/ // no HMR manifest
264
+ /******/
265
+ /******/ // no on chunks loaded
266
+ /******/
267
+ /******/ // install a JSONP callback for chunk loading
268
+ /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
269
+ /******/ var [chunkIds, moreModules, runtime] = data;
270
+ /******/ // add "moreModules" to the modules object,
271
+ /******/ // then flag all "chunkIds" as loaded and fire callback
272
+ /******/ var moduleId, chunkId, i = 0;
273
+ /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
274
+ /******/ for(moduleId in moreModules) {
275
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
276
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
277
+ /******/ }
278
+ /******/ }
279
+ /******/ if(runtime) var result = runtime(__webpack_require__);
280
+ /******/ }
281
+ /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
282
+ /******/ for(;i < chunkIds.length; i++) {
283
+ /******/ chunkId = chunkIds[i];
284
+ /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
285
+ /******/ installedChunks[chunkId][0]();
286
+ /******/ }
287
+ /******/ installedChunks[chunkId] = 0;
288
+ /******/ }
289
+ /******/
290
+ /******/ }
291
+ /******/
292
+ /******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_hex_color"] = this["webpackChunk_tsparticles_plugin_hex_color"] || [];
293
+ /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
294
+ /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
295
+ /******/ })();
296
+ /******/
106
297
  /************************************************************************/
107
298
  /******/
108
299
  /******/ // startup
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.hexColor.min.js.LICENSE.txt */
2
- !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var t=r();for(var o in t)("object"==typeof exports?exports:e)[o]=t[o]}}(this,(()=>(()=>{var e,r={d:(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};r.r(t),r.d(t,{loadHexColorPlugin:()=>i}),function(e){e[e.r=1]="r",e[e.g=2]="g",e[e.b=3]="b",e[e.a=4]="a"}(e||(e={}));const o=/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;class a{constructor(){this.key="hex",this.stringPrefix="#"}handleColor(e){return this._parseString(e.value)}handleRangeColor(e){return this._parseString(e.value)}parseString(e){return this._parseString(e)}_parseString(r){if("string"!=typeof r)return;if(!r?.startsWith(this.stringPrefix))return;const t=r.replace(o,((e,r,t,o,n)=>r+r+t+t+o+o+(void 0!==n?n+n:""))),a=n.exec(t);return a?{a:void 0!==a[e.a]?parseInt(a[e.a],16)/255:1,b:parseInt(a[e.b],16),g:parseInt(a[e.g],16),r:parseInt(a[e.r],16)}:void 0}}async function i(e,r=!0){e.checkVersion("3.9.1"),await e.addColorManager(new a,r)}return t})()));
2
+ !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var t=r();for(var o in t)("object"==typeof exports?exports:e)[o]=t[o]}}(this,(()=>(()=>{var e,r,t={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.m=t,n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((r,t)=>(n.f[t](e,r),r)),[])),n.u=e=>e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="@tsparticles/plugin-hex-color:",n.l=(t,o,i,a)=>{if(e[t])e[t].push(o);else{var l,c;if(void 0!==i)for(var s=document.getElementsByTagName("script"),p=0;p<s.length;p++){var u=s[p];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==r+i){l=u;break}}l||(c=!0,(l=document.createElement("script")).charset="utf-8",n.nc&&l.setAttribute("nonce",n.nc),l.setAttribute("data-webpack",r+i),l.src=t),e[t]=[o];var d=(r,o)=>{l.onerror=l.onload=null,clearTimeout(f);var n=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var r=n.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={964:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var i=new Promise(((t,n)=>o=e[r]=[t,n]));t.push(o[2]=i);var a=n.p+n.u(r),l=new Error;n.l(a,(t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+i+": "+a+")",l.name="ChunkLoadError",l.type=i,l.request=a,o[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var o,i,[a,l,c]=t,s=0;if(a.some((r=>0!==e[r]))){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)c(n)}for(r&&r(t);s<a.length;s++)i=a[s],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0},t=this.webpackChunk_tsparticles_plugin_hex_color=this.webpackChunk_tsparticles_plugin_hex_color||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var i={};function a(e){e.checkVersion("4.0.0-alpha.0"),e.register((async e=>{const{HexColorManager:r}=await n.e(69).then(n.bind(n,69));e.addColorManager(new r)}))}return n.r(i),n.d(i,{loadHexColorPlugin:()=>a}),i})()));
@@ -1 +1 @@
1
- /*! tsParticles Hex Color Plugin v3.9.1 by Matteo Bruni */
1
+ /*! tsParticles Hex Color Plugin v4.0.0-alpha.0 by Matteo Bruni */
@@ -1,8 +1,8 @@
1
1
  import type { IColor, IColorManager, IRangeColor, IRgb, IRgba } from "@tsparticles/engine";
2
2
  export declare class HexColorManager implements IColorManager {
3
3
  readonly key: string;
4
- readonly stringPrefix: string;
5
4
  constructor();
5
+ accepts(input: string): boolean;
6
6
  handleColor(color: IColor): IRgb | undefined;
7
7
  handleRangeColor(color: IRangeColor): IRgb | undefined;
8
8
  parseString(input: string): IRgba | undefined;
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadHexColorPlugin(engine: Engine, refresh?: boolean): Promise<void>;
2
+ export declare function loadHexColorPlugin(engine: Engine): void;
@@ -21,7 +21,9 @@
21
21
  class HexColorManager {
22
22
  constructor() {
23
23
  this.key = "hex";
24
- this.stringPrefix = "#";
24
+ }
25
+ accepts(input) {
26
+ return input.startsWith("#");
25
27
  }
26
28
  handleColor(color) {
27
29
  return this._parseString(color.value);
@@ -33,10 +35,7 @@
33
35
  return this._parseString(input);
34
36
  }
35
37
  _parseString(hexColor) {
36
- if (typeof hexColor !== "string") {
37
- return;
38
- }
39
- if (!hexColor?.startsWith(this.stringPrefix)) {
38
+ if (typeof hexColor !== "string" || !this.accepts(hexColor)) {
40
39
  return;
41
40
  }
42
41
  const hexFixed = hexColor.replace(shorthandHexRegex, (_, r, g, b, a) => {
@@ -44,12 +43,10 @@
44
43
  }), result = hexRegex.exec(hexFixed);
45
44
  return result
46
45
  ? {
47
- a: result[RgbIndexes.a] !== undefined
48
- ? parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor
49
- : defaultAlpha,
50
- b: parseInt(result[RgbIndexes.b], hexRadix),
51
- g: parseInt(result[RgbIndexes.g], hexRadix),
52
- r: parseInt(result[RgbIndexes.r], hexRadix),
46
+ a: result[RgbIndexes.a] ? parseInt(result[RgbIndexes.a], hexRadix) / alphaFactor : defaultAlpha,
47
+ b: parseInt(result[RgbIndexes.b] ?? "0", hexRadix),
48
+ g: parseInt(result[RgbIndexes.g] ?? "0", hexRadix),
49
+ r: parseInt(result[RgbIndexes.r] ?? "0", hexRadix),
53
50
  }
54
51
  : undefined;
55
52
  }
package/umd/index.js CHANGED
@@ -1,18 +1,54 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14
+ }) : function(o, v) {
15
+ o["default"] = v;
16
+ });
17
+ var __importStar = (this && this.__importStar) || (function () {
18
+ var ownKeys = function(o) {
19
+ ownKeys = Object.getOwnPropertyNames || function (o) {
20
+ var ar = [];
21
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
22
+ return ar;
23
+ };
24
+ return ownKeys(o);
25
+ };
26
+ return function (mod) {
27
+ if (mod && mod.__esModule) return mod;
28
+ var result = {};
29
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30
+ __setModuleDefault(result, mod);
31
+ return result;
32
+ };
33
+ })();
1
34
  (function (factory) {
2
35
  if (typeof module === "object" && typeof module.exports === "object") {
3
36
  var v = factory(require, exports);
4
37
  if (v !== undefined) module.exports = v;
5
38
  }
6
39
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./HexColorManager.js"], factory);
40
+ define(["require", "exports"], factory);
8
41
  }
9
42
  })(function (require, exports) {
10
43
  "use strict";
44
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
11
45
  Object.defineProperty(exports, "__esModule", { value: true });
12
46
  exports.loadHexColorPlugin = loadHexColorPlugin;
13
- const HexColorManager_js_1 = require("./HexColorManager.js");
14
- async function loadHexColorPlugin(engine, refresh = true) {
15
- engine.checkVersion("3.9.1");
16
- await engine.addColorManager(new HexColorManager_js_1.HexColorManager(), refresh);
47
+ function loadHexColorPlugin(engine) {
48
+ engine.checkVersion("4.0.0-alpha.0");
49
+ engine.register(async (e) => {
50
+ const { HexColorManager } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./HexColorManager.js"))) : new Promise((resolve_1, reject_1) => { require(["./HexColorManager.js"], resolve_1, reject_1); }).then(__importStar));
51
+ e.addColorManager(new HexColorManager());
52
+ });
17
53
  }
18
54
  });