@tsparticles/plugin-themes 4.0.0-beta.8 → 4.0.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/browser/browser.js +5 -0
- package/browser/index.js +3 -3
- package/browser/index.lazy.js +7 -0
- package/cjs/browser.js +5 -0
- package/cjs/index.js +3 -3
- package/cjs/index.lazy.js +7 -0
- package/esm/browser.js +5 -0
- package/esm/index.js +3 -3
- package/esm/index.lazy.js +7 -0
- package/package.json +9 -2
- package/report.html +4949 -94
- package/tsparticles.plugin.themes.js +196 -310
- package/tsparticles.plugin.themes.min.js +1 -2
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +2 -0
- package/453.min.js +0 -1
- package/579.min.js +0 -1
- package/dist_browser_ThemesPluginInstance_js.js +0 -30
- package/dist_browser_ThemesPlugin_js.js +0 -60
|
@@ -1,317 +1,203 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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__ = ({
|
|
1
|
+
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
+
/* Plugin v4.0.0 */
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.plugins = global.__tsParticlesInternals.plugins || {}, global.__tsParticlesInternals.plugins.themes = global.__tsParticlesInternals.plugins.themes || {}), global.__tsParticlesInternals.engine));
|
|
7
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
30
8
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
var ThemeMode;
|
|
10
|
+
(function (ThemeMode) {
|
|
11
|
+
ThemeMode["any"] = "any";
|
|
12
|
+
ThemeMode["dark"] = "dark";
|
|
13
|
+
ThemeMode["light"] = "light";
|
|
14
|
+
})(ThemeMode || (ThemeMode = {}));
|
|
36
15
|
|
|
37
|
-
|
|
16
|
+
class ThemeDefault {
|
|
17
|
+
auto;
|
|
18
|
+
mode;
|
|
19
|
+
value;
|
|
20
|
+
constructor() {
|
|
21
|
+
this.auto = false;
|
|
22
|
+
this.mode = ThemeMode.any;
|
|
23
|
+
this.value = false;
|
|
24
|
+
}
|
|
25
|
+
load(data) {
|
|
26
|
+
if (engine.isNull(data)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (data.auto !== undefined) {
|
|
30
|
+
this.auto = data.auto;
|
|
31
|
+
}
|
|
32
|
+
if (data.mode !== undefined) {
|
|
33
|
+
this.mode = data.mode;
|
|
34
|
+
}
|
|
35
|
+
if (data.value !== undefined) {
|
|
36
|
+
this.value = data.value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
class Theme {
|
|
42
|
+
default;
|
|
43
|
+
name;
|
|
44
|
+
options;
|
|
45
|
+
constructor() {
|
|
46
|
+
this.name = "";
|
|
47
|
+
this.default = new ThemeDefault();
|
|
48
|
+
}
|
|
49
|
+
load(data) {
|
|
50
|
+
if (engine.isNull(data)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (data.name !== undefined) {
|
|
54
|
+
this.name = data.name;
|
|
55
|
+
}
|
|
56
|
+
this.default.load(data.default);
|
|
57
|
+
if (data.options !== undefined) {
|
|
58
|
+
this.options = engine.deepExtend({}, data.options);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
40
62
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
63
|
+
class ThemesPlugin {
|
|
64
|
+
id = "theme";
|
|
65
|
+
async getPlugin(container) {
|
|
66
|
+
const { ThemesPluginInstance } = await Promise.resolve().then(function () { return ThemesPluginInstance$1; });
|
|
67
|
+
return new ThemesPluginInstance(container);
|
|
68
|
+
}
|
|
69
|
+
loadOptions(_container, options, source) {
|
|
70
|
+
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const findDefaultTheme = (mode) => {
|
|
74
|
+
if (!options.themes) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
return (options.themes.find(theme => theme.default.value && theme.default.mode === mode) ??
|
|
78
|
+
options.themes.find(theme => theme.default.value && theme.default.mode === ThemeMode.any));
|
|
79
|
+
}, setTheme = (name) => {
|
|
80
|
+
if (!options.themes) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (name) {
|
|
84
|
+
const chosenTheme = options.themes.find(theme => theme.name === name);
|
|
85
|
+
if (chosenTheme) {
|
|
86
|
+
options.load(chosenTheme.options);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const mediaMatch = engine.safeMatchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch?.matches, defaultTheme = findDefaultTheme(clientDarkMode ? ThemeMode.dark : ThemeMode.light);
|
|
91
|
+
if (defaultTheme) {
|
|
92
|
+
options.load(defaultTheme.options);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
options.findDefaultTheme = findDefaultTheme;
|
|
97
|
+
options.setTheme = setTheme;
|
|
98
|
+
options.themes ??= [];
|
|
99
|
+
if (source?.themes !== undefined) {
|
|
100
|
+
for (const theme of source.themes) {
|
|
101
|
+
if (!theme) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const existingTheme = options.themes.find(t => t.name === theme.name);
|
|
105
|
+
if (existingTheme) {
|
|
106
|
+
existingTheme.load(theme);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const optTheme = new Theme();
|
|
110
|
+
optTheme.load(theme);
|
|
111
|
+
options.themes.push(optTheme);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
options.defaultThemes.dark = findDefaultTheme(ThemeMode.dark)?.name;
|
|
116
|
+
options.defaultThemes.light = findDefaultTheme(ThemeMode.light)?.name;
|
|
117
|
+
}
|
|
118
|
+
needsPlugin(options) {
|
|
119
|
+
return !!options?.themes?.length;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
46
122
|
|
|
47
|
-
|
|
123
|
+
async function loadThemesPlugin(engine) {
|
|
124
|
+
engine.checkVersion("4.0.0");
|
|
125
|
+
await engine.pluginManager.register(e => {
|
|
126
|
+
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
127
|
+
});
|
|
128
|
+
}
|
|
48
129
|
|
|
49
|
-
|
|
130
|
+
const globalObject = globalThis;
|
|
131
|
+
globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
|
|
132
|
+
globalObject.loadThemesPlugin = loadThemesPlugin;
|
|
50
133
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/******/ /* webpack/runtime/global */
|
|
122
|
-
/******/ (() => {
|
|
123
|
-
/******/ __webpack_require__.g = (function() {
|
|
124
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
125
|
-
/******/ try {
|
|
126
|
-
/******/ return this || new Function('return this')();
|
|
127
|
-
/******/ } catch (e) {
|
|
128
|
-
/******/ if (typeof window === 'object') return window;
|
|
129
|
-
/******/ }
|
|
130
|
-
/******/ })();
|
|
131
|
-
/******/ })();
|
|
132
|
-
/******/
|
|
133
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
134
|
-
/******/ (() => {
|
|
135
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
136
|
-
/******/ })();
|
|
137
|
-
/******/
|
|
138
|
-
/******/ /* webpack/runtime/load script */
|
|
139
|
-
/******/ (() => {
|
|
140
|
-
/******/ var inProgress = {};
|
|
141
|
-
/******/ var dataWebpackPrefix = "@tsparticles/plugin-themes:";
|
|
142
|
-
/******/ // loadScript function to load a script via script tag
|
|
143
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
144
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
145
|
-
/******/ var script, needAttach;
|
|
146
|
-
/******/ if(key !== undefined) {
|
|
147
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
148
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
149
|
-
/******/ var s = scripts[i];
|
|
150
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
151
|
-
/******/ }
|
|
152
|
-
/******/ }
|
|
153
|
-
/******/ if(!script) {
|
|
154
|
-
/******/ needAttach = true;
|
|
155
|
-
/******/ script = document.createElement('script');
|
|
156
|
-
/******/
|
|
157
|
-
/******/ script.charset = 'utf-8';
|
|
158
|
-
/******/ if (__webpack_require__.nc) {
|
|
159
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
160
|
-
/******/ }
|
|
161
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
162
|
-
/******/
|
|
163
|
-
/******/ script.src = url;
|
|
164
|
-
/******/ }
|
|
165
|
-
/******/ inProgress[url] = [done];
|
|
166
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
167
|
-
/******/ // avoid mem leaks in IE.
|
|
168
|
-
/******/ script.onerror = script.onload = null;
|
|
169
|
-
/******/ clearTimeout(timeout);
|
|
170
|
-
/******/ var doneFns = inProgress[url];
|
|
171
|
-
/******/ delete inProgress[url];
|
|
172
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
173
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
174
|
-
/******/ if(prev) return prev(event);
|
|
175
|
-
/******/ }
|
|
176
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
177
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
178
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
179
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
180
|
-
/******/ };
|
|
181
|
-
/******/ })();
|
|
182
|
-
/******/
|
|
183
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
184
|
-
/******/ (() => {
|
|
185
|
-
/******/ // define __esModule on exports
|
|
186
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
187
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
188
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
189
|
-
/******/ }
|
|
190
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
191
|
-
/******/ };
|
|
192
|
-
/******/ })();
|
|
193
|
-
/******/
|
|
194
|
-
/******/ /* webpack/runtime/publicPath */
|
|
195
|
-
/******/ (() => {
|
|
196
|
-
/******/ var scriptUrl;
|
|
197
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
198
|
-
/******/ var document = __webpack_require__.g.document;
|
|
199
|
-
/******/ if (!scriptUrl && document) {
|
|
200
|
-
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
201
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
202
|
-
/******/ if (!scriptUrl) {
|
|
203
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
204
|
-
/******/ if(scripts.length) {
|
|
205
|
-
/******/ var i = scripts.length - 1;
|
|
206
|
-
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
207
|
-
/******/ }
|
|
208
|
-
/******/ }
|
|
209
|
-
/******/ }
|
|
210
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
211
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
212
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
213
|
-
/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
214
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
215
|
-
/******/ })();
|
|
216
|
-
/******/
|
|
217
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
218
|
-
/******/ (() => {
|
|
219
|
-
/******/ // no baseURI
|
|
220
|
-
/******/
|
|
221
|
-
/******/ // object to store loaded and loading chunks
|
|
222
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
223
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
224
|
-
/******/ var installedChunks = {
|
|
225
|
-
/******/ "tsparticles.plugin.themes": 0
|
|
226
|
-
/******/ };
|
|
227
|
-
/******/
|
|
228
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
229
|
-
/******/ // JSONP chunk loading for javascript
|
|
230
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
231
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
232
|
-
/******/
|
|
233
|
-
/******/ // a Promise means "currently loading".
|
|
234
|
-
/******/ if(installedChunkData) {
|
|
235
|
-
/******/ promises.push(installedChunkData[2]);
|
|
236
|
-
/******/ } else {
|
|
237
|
-
/******/ if(true) { // all chunks have JS
|
|
238
|
-
/******/ // setup Promise in chunk cache
|
|
239
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
240
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
241
|
-
/******/
|
|
242
|
-
/******/ // start chunk loading
|
|
243
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
244
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
245
|
-
/******/ var error = new Error();
|
|
246
|
-
/******/ var loadingEnded = (event) => {
|
|
247
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
248
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
249
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
250
|
-
/******/ if(installedChunkData) {
|
|
251
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
252
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
253
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
254
|
-
/******/ error.name = 'ChunkLoadError';
|
|
255
|
-
/******/ error.type = errorType;
|
|
256
|
-
/******/ error.request = realSrc;
|
|
257
|
-
/******/ installedChunkData[1](error);
|
|
258
|
-
/******/ }
|
|
259
|
-
/******/ }
|
|
260
|
-
/******/ };
|
|
261
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
262
|
-
/******/ }
|
|
263
|
-
/******/ }
|
|
264
|
-
/******/ }
|
|
265
|
-
/******/ };
|
|
266
|
-
/******/
|
|
267
|
-
/******/ // no prefetching
|
|
268
|
-
/******/
|
|
269
|
-
/******/ // no preloaded
|
|
270
|
-
/******/
|
|
271
|
-
/******/ // no HMR
|
|
272
|
-
/******/
|
|
273
|
-
/******/ // no HMR manifest
|
|
274
|
-
/******/
|
|
275
|
-
/******/ // no on chunks loaded
|
|
276
|
-
/******/
|
|
277
|
-
/******/ // install a JSONP callback for chunk loading
|
|
278
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
279
|
-
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
280
|
-
/******/ // add "moreModules" to the modules object,
|
|
281
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
282
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
283
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
284
|
-
/******/ for(moduleId in moreModules) {
|
|
285
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
286
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
287
|
-
/******/ }
|
|
288
|
-
/******/ }
|
|
289
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
290
|
-
/******/ }
|
|
291
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
292
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
293
|
-
/******/ chunkId = chunkIds[i];
|
|
294
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
295
|
-
/******/ installedChunks[chunkId][0]();
|
|
296
|
-
/******/ }
|
|
297
|
-
/******/ installedChunks[chunkId] = 0;
|
|
298
|
-
/******/ }
|
|
299
|
-
/******/
|
|
300
|
-
/******/ }
|
|
301
|
-
/******/
|
|
302
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_plugin_themes"] = this["webpackChunk_tsparticles_plugin_themes"] || [];
|
|
303
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
304
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
305
|
-
/******/ })();
|
|
306
|
-
/******/
|
|
307
|
-
/************************************************************************/
|
|
308
|
-
/******/
|
|
309
|
-
/******/ // startup
|
|
310
|
-
/******/ // Load entry module and return exports
|
|
311
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
312
|
-
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
|
|
313
|
-
/******/
|
|
314
|
-
/******/ return __webpack_exports__;
|
|
315
|
-
/******/ })()
|
|
316
|
-
;
|
|
317
|
-
});
|
|
134
|
+
class ThemesPluginInstance {
|
|
135
|
+
_container;
|
|
136
|
+
constructor(container) {
|
|
137
|
+
this._container = container;
|
|
138
|
+
}
|
|
139
|
+
init() {
|
|
140
|
+
const container = this._container;
|
|
141
|
+
container.themeMatchMedia = engine.safeMatchMedia("(prefers-color-scheme: dark)");
|
|
142
|
+
const loadTheme = async (name) => {
|
|
143
|
+
if (container.destroyed) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
container.currentTheme = name;
|
|
147
|
+
await container.refresh();
|
|
148
|
+
};
|
|
149
|
+
container.themeHandlers = {
|
|
150
|
+
themeChange: (e) => {
|
|
151
|
+
this._handleThemeChange(e);
|
|
152
|
+
},
|
|
153
|
+
oldThemeChange: (e) => {
|
|
154
|
+
this._handleThemeChange(e);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
container.manageMediaMatch = (add) => {
|
|
158
|
+
const handlers = container.themeHandlers;
|
|
159
|
+
if (!handlers) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!container.themeMatchMedia) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
engine.manageListener(container.themeMatchMedia, "change", handlers.themeChange, add);
|
|
166
|
+
};
|
|
167
|
+
container.loadTheme = loadTheme;
|
|
168
|
+
return Promise.resolve();
|
|
169
|
+
}
|
|
170
|
+
manageListeners(add) {
|
|
171
|
+
const container = this._container;
|
|
172
|
+
container.manageMediaMatch?.(add);
|
|
173
|
+
}
|
|
174
|
+
async start() {
|
|
175
|
+
this.manageListeners(true);
|
|
176
|
+
return Promise.resolve();
|
|
177
|
+
}
|
|
178
|
+
stop() {
|
|
179
|
+
this.manageListeners(false);
|
|
180
|
+
}
|
|
181
|
+
updateActualOptions() {
|
|
182
|
+
const container = this._container;
|
|
183
|
+
container.actualOptions.setTheme?.(container.currentTheme);
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
_handleThemeChange = (e) => {
|
|
187
|
+
const mediaEvent = e, container = this._container, options = container.options, defaultThemes = options.defaultThemes, themeName = mediaEvent.matches ? defaultThemes.dark : defaultThemes.light, theme = options.themes?.find(theme => theme.name === themeName);
|
|
188
|
+
if (theme?.default.auto) {
|
|
189
|
+
void container.loadTheme?.(themeName);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
var ThemesPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
195
|
+
__proto__: null,
|
|
196
|
+
ThemesPluginInstance: ThemesPluginInstance
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
exports.loadThemesPlugin = loadThemesPlugin;
|
|
200
|
+
|
|
201
|
+
}));
|
|
202
|
+
Object.assign(globalThis.window || globalThis, { loadThemesPlugin: (globalThis.__tsParticlesInternals.plugins.themes || {}).loadThemesPlugin });
|
|
203
|
+
delete (globalThis.window || globalThis).tsparticlesInternalExports;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
!function(e
|
|
2
|
-
(`+i+": "+n+")",s.name="ChunkLoadError",s.type=i,s.request=n,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,i,[n,s,l]=r,p=0;if(n.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);l&&l(a)}for(e&&e(r);p<n.length;p++)i=n[p],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},(o=this.webpackChunk_tsparticles_plugin_themes=this.webpackChunk_tsparticles_plugin_themes||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.8"),await e.pluginManager.register(async e=>{let{ThemesPlugin:t}=await a.e(579).then(a.bind(a,579));e.pluginManager.addPlugin(new t)})}return a.r(d),a.d(d,{loadThemesPlugin:()=>f}),d})());
|
|
1
|
+
!function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.themes=e.__tsParticlesInternals.plugins.themes||{}),e.__tsParticlesInternals.engine)}(this,function(e,t){"use strict";var s;!function(e){e.any="any",e.dark="dark",e.light="light"}(s||(s={}));class n{auto;mode;value;constructor(){this.auto=!1,this.mode=s.any,this.value=!1}load(e){t.isNull(e)||(void 0!==e.auto&&(this.auto=e.auto),void 0!==e.mode&&(this.mode=e.mode),void 0!==e.value&&(this.value=e.value))}}class a{default;name;options;constructor(){this.name="",this.default=new n}load(e){t.isNull(e)||(void 0!==e.name&&(this.name=e.name),this.default.load(e.default),void 0!==e.options&&(this.options=t.deepExtend({},e.options)))}}class l{id="theme";async getPlugin(e){const{ThemesPluginInstance:t}=await Promise.resolve().then(function(){return c});return new t(e)}loadOptions(e,n,l){if(!this.needsPlugin(n)&&!this.needsPlugin(l))return;const r=e=>{if(n.themes)return n.themes.find(t=>t.default.value&&t.default.mode===e)??n.themes.find(e=>e.default.value&&e.default.mode===s.any)};if(n.findDefaultTheme=r,n.setTheme=e=>{if(n.themes)if(e){const t=n.themes.find(t=>t.name===e);t&&n.load(t.options)}else{const e=t.safeMatchMedia("(prefers-color-scheme: dark)"),a=e?.matches,l=r(a?s.dark:s.light);l&&n.load(l.options)}},n.themes??=[],void 0!==l?.themes)for(const e of l.themes){if(!e)continue;const t=n.themes.find(t=>t.name===e.name);if(t)t.load(e);else{const t=new a;t.load(e),n.themes.push(t)}}n.defaultThemes.dark=r(s.dark)?.name,n.defaultThemes.light=r(s.light)?.name}needsPlugin(e){return!!e?.themes?.length}}async function r(e){e.checkVersion("4.0.0"),await e.pluginManager.register(e=>{e.pluginManager.addPlugin(new l)})}const i=globalThis;i.__tsParticlesInternals=i.__tsParticlesInternals??{},i.loadThemesPlugin=r;var c=Object.freeze({__proto__:null,ThemesPluginInstance:class{_container;constructor(e){this._container=e}init(){const e=this._container;e.themeMatchMedia=t.safeMatchMedia("(prefers-color-scheme: dark)");return e.themeHandlers={themeChange:e=>{this._handleThemeChange(e)},oldThemeChange:e=>{this._handleThemeChange(e)}},e.manageMediaMatch=s=>{const n=e.themeHandlers;n&&e.themeMatchMedia&&t.manageListener(e.themeMatchMedia,"change",n.themeChange,s)},e.loadTheme=async t=>{e.destroyed||(e.currentTheme=t,await e.refresh())},Promise.resolve()}manageListeners(e){const t=this._container;t.manageMediaMatch?.(e)}async start(){return this.manageListeners(!0),Promise.resolve()}stop(){this.manageListeners(!1)}updateActualOptions(){const e=this._container;return e.actualOptions.setTheme?.(e.currentTheme),!1}_handleThemeChange=e=>{const t=e,s=this._container,n=s.options,a=n.defaultThemes,l=t.matches?a.dark:a.light,r=n.themes?.find(e=>e.name===l);r?.default.auto&&s.loadTheme?.(l)}}});e.loadThemesPlugin=r}),Object.assign(globalThis.window||globalThis,{loadThemesPlugin:(globalThis.__tsParticlesInternals.plugins.themes||{}).loadThemesPlugin}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
package/453.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_themes=this.webpackChunk_tsparticles_plugin_themes||[]).push([[453],{453(e,t,a){a.d(t,{ThemesPluginInstance:()=>n});var h=a(303);class n{_container;constructor(e){this._container=e}init(){let e=this._container;e.themeMatchMedia=(0,h.safeMatchMedia)("(prefers-color-scheme: dark)");let t=async t=>{e.destroyed||(e.currentTheme=t,await e.refresh())};return e.themeHandlers={themeChange:e=>{this._handleThemeChange(e)},oldThemeChange:e=>{this._handleThemeChange(e)}},e.manageMediaMatch=t=>{let a=e.themeHandlers;!a||e.themeMatchMedia&&(0,h.manageListener)(e.themeMatchMedia,"change",a.themeChange,t)},e.loadTheme=t,Promise.resolve()}manageListeners(e){let t=this._container;t.manageMediaMatch?.(e)}async start(){return this.manageListeners(!0),Promise.resolve()}stop(){this.manageListeners(!1)}updateActualOptions(){let e=this._container;return e.actualOptions.setTheme?.(e.currentTheme),!1}_handleThemeChange=e=>{let t=this._container,a=t.options,h=a.defaultThemes,n=e.matches?h.dark:h.light,s=a.themes?.find(e=>e.name===n);s?.default.auto&&t.loadTheme?.(n)}}}}]);
|
package/579.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_themes=this.webpackChunk_tsparticles_plugin_themes||[]).push([[579],{579(e,t,s){s.d(t,{ThemesPlugin:()=>h});var a,i,l=s(303);(a=i||(i={})).any="any",a.dark="dark",a.light="light";class n{auto;mode;value;constructor(){this.auto=!1,this.mode=i.any,this.value=!1}load(e){(0,l.isNull)(e)||(void 0!==e.auto&&(this.auto=e.auto),void 0!==e.mode&&(this.mode=e.mode),void 0!==e.value&&(this.value=e.value))}}class d{default;name;options;constructor(){this.name="",this.default=new n}load(e){(0,l.isNull)(e)||(void 0!==e.name&&(this.name=e.name),this.default.load(e.default),void 0!==e.options&&(this.options=(0,l.deepExtend)({},e.options)))}}class h{id="theme";async getPlugin(e){let{ThemesPluginInstance:t}=await s.e(453).then(s.bind(s,453));return new t(e)}loadOptions(e,t,s){if(!this.needsPlugin(t)&&!this.needsPlugin(s))return;let a=e=>{if(t.themes)return t.themes.find(t=>t.default.value&&t.default.mode===e)??t.themes.find(e=>e.default.value&&e.default.mode===i.any)};if(t.findDefaultTheme=a,t.setTheme=e=>{if(t.themes)if(e){let s=t.themes.find(t=>t.name===e);s&&t.load(s.options)}else{let e=(0,l.safeMatchMedia)("(prefers-color-scheme: dark)"),s=a(e?.matches?i.dark:i.light);s&&t.load(s.options)}},t.themes??=[],s?.themes!==void 0)for(let e of s.themes){if(!e)continue;let s=t.themes.find(t=>t.name===e.name);if(s)s.load(e);else{let s=new d;s.load(e),t.themes.push(s)}}t.defaultThemes.dark=a(i.dark)?.name,t.defaultThemes.light=a(i.light)?.name}needsPlugin(e){return!!e?.themes?.length}}}}]);
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
* v4.0.0-beta.8
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_plugin_themes"] = this["webpackChunk_tsparticles_plugin_themes"] || []).push([["dist_browser_ThemesPluginInstance_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/ThemesPluginInstance.js"
|
|
21
|
-
/*!**********************************************!*\
|
|
22
|
-
!*** ./dist/browser/ThemesPluginInstance.js ***!
|
|
23
|
-
\**********************************************/
|
|
24
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
-
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ThemesPluginInstance: () => (/* binding */ ThemesPluginInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass ThemesPluginInstance {\n _container;\n constructor(container){\n this._container = container;\n }\n init() {\n const container = this._container;\n container.themeMatchMedia = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.safeMatchMedia)(\"(prefers-color-scheme: dark)\");\n const loadTheme = async (name)=>{\n if (container.destroyed) {\n return;\n }\n container.currentTheme = name;\n await container.refresh();\n };\n container.themeHandlers = {\n themeChange: (e)=>{\n this._handleThemeChange(e);\n },\n oldThemeChange: (e)=>{\n this._handleThemeChange(e);\n }\n };\n container.manageMediaMatch = (add)=>{\n const handlers = container.themeHandlers;\n if (!handlers) {\n return;\n }\n if (!container.themeMatchMedia) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.manageListener)(container.themeMatchMedia, \"change\", handlers.themeChange, add);\n };\n container.loadTheme = loadTheme;\n return Promise.resolve();\n }\n manageListeners(add) {\n const container = this._container;\n container.manageMediaMatch?.(add);\n }\n async start() {\n this.manageListeners(true);\n return Promise.resolve();\n }\n stop() {\n this.manageListeners(false);\n }\n updateActualOptions() {\n const container = this._container;\n container.actualOptions.setTheme?.(container.currentTheme);\n return false;\n }\n _handleThemeChange = (e)=>{\n const mediaEvent = e, container = this._container, options = container.options, defaultThemes = options.defaultThemes, themeName = mediaEvent.matches ? defaultThemes.dark : defaultThemes.light, theme = options.themes?.find((theme)=>theme.name === themeName);\n if (theme?.default.auto) {\n void container.loadTheme?.(themeName);\n }\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-themes/./dist/browser/ThemesPluginInstance.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ }
|
|
29
|
-
|
|
30
|
-
}]);
|