@tsparticles/plugin-themes 4.1.3 → 4.2.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/Options/Classes/Theme.js +4 -10
- package/browser/Options/Classes/ThemeDefault.js +7 -18
- package/browser/ThemesPluginInstance.js +2 -2
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/Options/Classes/Theme.js +4 -10
- package/cjs/Options/Classes/ThemeDefault.js +7 -18
- package/cjs/ThemesPluginInstance.js +2 -2
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/Options/Classes/Theme.js +4 -10
- package/esm/Options/Classes/ThemeDefault.js +7 -18
- package/esm/ThemesPluginInstance.js +2 -2
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.plugin.themes.js +13 -30
- package/tsparticles.plugin.themes.min.js +1 -1
- package/types/Options/Classes/Theme.d.ts +0 -1
- package/types/Options/Classes/ThemeDefault.d.ts +0 -1
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { deepExtend, isNull, } from "@tsparticles/engine";
|
|
1
|
+
import { deepExtend, isNull, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
import { ThemeDefault } from "./ThemeDefault.js";
|
|
3
3
|
export class Theme {
|
|
4
|
-
default;
|
|
5
|
-
name;
|
|
4
|
+
default = new ThemeDefault();
|
|
5
|
+
name = "";
|
|
6
6
|
options;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.name = "";
|
|
9
|
-
this.default = new ThemeDefault();
|
|
10
|
-
}
|
|
11
7
|
load(data) {
|
|
12
8
|
if (isNull(data)) {
|
|
13
9
|
return;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
this.name = data.name;
|
|
17
|
-
}
|
|
11
|
+
loadProperty(this, "name", data.name);
|
|
18
12
|
this.default.load(data.default);
|
|
19
13
|
if (data.options !== undefined) {
|
|
20
14
|
this.options = deepExtend({}, data.options);
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
import { ThemeMode } from "../../ThemeMode.js";
|
|
3
3
|
export class ThemeDefault {
|
|
4
|
-
auto;
|
|
5
|
-
mode;
|
|
6
|
-
value;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.auto = false;
|
|
9
|
-
this.mode = ThemeMode.any;
|
|
10
|
-
this.value = false;
|
|
11
|
-
}
|
|
4
|
+
auto = false;
|
|
5
|
+
mode = ThemeMode.any;
|
|
6
|
+
value = false;
|
|
12
7
|
load(data) {
|
|
13
8
|
if (isNull(data)) {
|
|
14
9
|
return;
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (data.mode !== undefined) {
|
|
20
|
-
this.mode = data.mode;
|
|
21
|
-
}
|
|
22
|
-
if (data.value !== undefined) {
|
|
23
|
-
this.value = data.value;
|
|
24
|
-
}
|
|
11
|
+
loadProperty(this, "auto", data.auto);
|
|
12
|
+
loadProperty(this, "mode", data.mode);
|
|
13
|
+
loadProperty(this, "value", data.value);
|
|
25
14
|
}
|
|
26
15
|
}
|
|
@@ -51,10 +51,10 @@ export class ThemesPluginInstance {
|
|
|
51
51
|
container.actualOptions.setTheme?.(container.currentTheme);
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
#handleThemeChange
|
|
54
|
+
#handleThemeChange(e) {
|
|
55
55
|
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);
|
|
56
56
|
if (theme?.default.auto) {
|
|
57
57
|
void container.loadTheme?.(themeName);
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
}
|
package/browser/index.js
CHANGED
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadThemesPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ThemesPlugin } = await import("./ThemesPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { deepExtend, isNull, } from "@tsparticles/engine";
|
|
1
|
+
import { deepExtend, isNull, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
import { ThemeDefault } from "./ThemeDefault.js";
|
|
3
3
|
export class Theme {
|
|
4
|
-
default;
|
|
5
|
-
name;
|
|
4
|
+
default = new ThemeDefault();
|
|
5
|
+
name = "";
|
|
6
6
|
options;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.name = "";
|
|
9
|
-
this.default = new ThemeDefault();
|
|
10
|
-
}
|
|
11
7
|
load(data) {
|
|
12
8
|
if (isNull(data)) {
|
|
13
9
|
return;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
this.name = data.name;
|
|
17
|
-
}
|
|
11
|
+
loadProperty(this, "name", data.name);
|
|
18
12
|
this.default.load(data.default);
|
|
19
13
|
if (data.options !== undefined) {
|
|
20
14
|
this.options = deepExtend({}, data.options);
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
import { ThemeMode } from "../../ThemeMode.js";
|
|
3
3
|
export class ThemeDefault {
|
|
4
|
-
auto;
|
|
5
|
-
mode;
|
|
6
|
-
value;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.auto = false;
|
|
9
|
-
this.mode = ThemeMode.any;
|
|
10
|
-
this.value = false;
|
|
11
|
-
}
|
|
4
|
+
auto = false;
|
|
5
|
+
mode = ThemeMode.any;
|
|
6
|
+
value = false;
|
|
12
7
|
load(data) {
|
|
13
8
|
if (isNull(data)) {
|
|
14
9
|
return;
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (data.mode !== undefined) {
|
|
20
|
-
this.mode = data.mode;
|
|
21
|
-
}
|
|
22
|
-
if (data.value !== undefined) {
|
|
23
|
-
this.value = data.value;
|
|
24
|
-
}
|
|
11
|
+
loadProperty(this, "auto", data.auto);
|
|
12
|
+
loadProperty(this, "mode", data.mode);
|
|
13
|
+
loadProperty(this, "value", data.value);
|
|
25
14
|
}
|
|
26
15
|
}
|
|
@@ -51,10 +51,10 @@ export class ThemesPluginInstance {
|
|
|
51
51
|
container.actualOptions.setTheme?.(container.currentTheme);
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
#handleThemeChange
|
|
54
|
+
#handleThemeChange(e) {
|
|
55
55
|
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);
|
|
56
56
|
if (theme?.default.auto) {
|
|
57
57
|
void container.loadTheme?.(themeName);
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
}
|
package/cjs/index.js
CHANGED
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadThemesPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ThemesPlugin } = await import("./ThemesPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import { deepExtend, isNull, } from "@tsparticles/engine";
|
|
1
|
+
import { deepExtend, isNull, loadProperty, } from "@tsparticles/engine";
|
|
2
2
|
import { ThemeDefault } from "./ThemeDefault.js";
|
|
3
3
|
export class Theme {
|
|
4
|
-
default;
|
|
5
|
-
name;
|
|
4
|
+
default = new ThemeDefault();
|
|
5
|
+
name = "";
|
|
6
6
|
options;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.name = "";
|
|
9
|
-
this.default = new ThemeDefault();
|
|
10
|
-
}
|
|
11
7
|
load(data) {
|
|
12
8
|
if (isNull(data)) {
|
|
13
9
|
return;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
this.name = data.name;
|
|
17
|
-
}
|
|
11
|
+
loadProperty(this, "name", data.name);
|
|
18
12
|
this.default.load(data.default);
|
|
19
13
|
if (data.options !== undefined) {
|
|
20
14
|
this.options = deepExtend({}, data.options);
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import { isNull } from "@tsparticles/engine";
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
import { ThemeMode } from "../../ThemeMode.js";
|
|
3
3
|
export class ThemeDefault {
|
|
4
|
-
auto;
|
|
5
|
-
mode;
|
|
6
|
-
value;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.auto = false;
|
|
9
|
-
this.mode = ThemeMode.any;
|
|
10
|
-
this.value = false;
|
|
11
|
-
}
|
|
4
|
+
auto = false;
|
|
5
|
+
mode = ThemeMode.any;
|
|
6
|
+
value = false;
|
|
12
7
|
load(data) {
|
|
13
8
|
if (isNull(data)) {
|
|
14
9
|
return;
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (data.mode !== undefined) {
|
|
20
|
-
this.mode = data.mode;
|
|
21
|
-
}
|
|
22
|
-
if (data.value !== undefined) {
|
|
23
|
-
this.value = data.value;
|
|
24
|
-
}
|
|
11
|
+
loadProperty(this, "auto", data.auto);
|
|
12
|
+
loadProperty(this, "mode", data.mode);
|
|
13
|
+
loadProperty(this, "value", data.value);
|
|
25
14
|
}
|
|
26
15
|
}
|
|
@@ -51,10 +51,10 @@ export class ThemesPluginInstance {
|
|
|
51
51
|
container.actualOptions.setTheme?.(container.currentTheme);
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
#handleThemeChange
|
|
54
|
+
#handleThemeChange(e) {
|
|
55
55
|
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);
|
|
56
56
|
if (theme?.default.auto) {
|
|
57
57
|
void container.loadTheme?.(themeName);
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
}
|
package/esm/index.js
CHANGED
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadThemesPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ThemesPlugin } = await import("./ThemesPlugin.js");
|
|
5
5
|
e.pluginManager.addPlugin(new ThemesPlugin());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-themes",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "tsParticles themes plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"./package.json": "./package.json"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@tsparticles/engine": "4.
|
|
95
|
+
"@tsparticles/engine": "4.2.0"
|
|
96
96
|
},
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.plugin.themes.js","children":[{"name":"dist/browser","children":[{"uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.plugin.themes.js","children":[{"name":"dist/browser","children":[{"uid":"81489fd6-1","name":"ThemeMode.js"},{"name":"Options/Classes","children":[{"uid":"81489fd6-3","name":"ThemeDefault.js"},{"uid":"81489fd6-5","name":"Theme.js"}]},{"uid":"81489fd6-7","name":"ThemesPlugin.js"},{"uid":"81489fd6-9","name":"index.js"},{"uid":"81489fd6-11","name":"browser.js"},{"uid":"81489fd6-13","name":"ThemesPluginInstance.js"}]}]}],"isRoot":true},"nodeParts":{"81489fd6-1":{"renderedLength":193,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-0"},"81489fd6-3":{"renderedLength":389,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-2"},"81489fd6-5":{"renderedLength":436,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-4"},"81489fd6-7":{"renderedLength":2596,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-6"},"81489fd6-9":{"renderedLength":211,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-8"},"81489fd6-11":{"renderedLength":175,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-10"},"81489fd6-13":{"renderedLength":2230,"gzipLength":0,"brotliLength":0,"metaUid":"81489fd6-12"}},"nodeMetas":{"81489fd6-0":{"id":"/dist/browser/ThemeMode.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-1"},"imported":[],"importedBy":[{"uid":"81489fd6-6"},{"uid":"81489fd6-2"}]},"81489fd6-2":{"id":"/dist/browser/Options/Classes/ThemeDefault.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-3"},"imported":[{"uid":"81489fd6-14"},{"uid":"81489fd6-0"}],"importedBy":[{"uid":"81489fd6-4"}]},"81489fd6-4":{"id":"/dist/browser/Options/Classes/Theme.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-5"},"imported":[{"uid":"81489fd6-14"},{"uid":"81489fd6-2"}],"importedBy":[{"uid":"81489fd6-6"}]},"81489fd6-6":{"id":"/dist/browser/ThemesPlugin.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-7"},"imported":[{"uid":"81489fd6-14"},{"uid":"81489fd6-4"},{"uid":"81489fd6-0"},{"uid":"81489fd6-12","dynamic":true}],"importedBy":[{"uid":"81489fd6-8"}]},"81489fd6-8":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-9"},"imported":[{"uid":"81489fd6-6"}],"importedBy":[{"uid":"81489fd6-10"}]},"81489fd6-10":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-11"},"imported":[{"uid":"81489fd6-8"}],"importedBy":[],"isEntry":true},"81489fd6-12":{"id":"/dist/browser/ThemesPluginInstance.js","moduleParts":{"tsparticles.plugin.themes.js":"81489fd6-13"},"imported":[{"uid":"81489fd6-14"}],"importedBy":[{"uid":"81489fd6-6"}]},"81489fd6-14":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"81489fd6-6"},{"uid":"81489fd6-4"},{"uid":"81489fd6-12"},{"uid":"81489fd6-2"}],"isExternal":true}},"env":{"rollup":"4.62.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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.
|
|
2
|
+
/* Plugin v4.2.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
|
|
@@ -14,45 +14,28 @@
|
|
|
14
14
|
})(ThemeMode || (ThemeMode = {}));
|
|
15
15
|
|
|
16
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
|
-
}
|
|
17
|
+
auto = false;
|
|
18
|
+
mode = ThemeMode.any;
|
|
19
|
+
value = false;
|
|
25
20
|
load(data) {
|
|
26
21
|
if (engine.isNull(data)) {
|
|
27
22
|
return;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (data.mode !== undefined) {
|
|
33
|
-
this.mode = data.mode;
|
|
34
|
-
}
|
|
35
|
-
if (data.value !== undefined) {
|
|
36
|
-
this.value = data.value;
|
|
37
|
-
}
|
|
24
|
+
engine.loadProperty(this, "auto", data.auto);
|
|
25
|
+
engine.loadProperty(this, "mode", data.mode);
|
|
26
|
+
engine.loadProperty(this, "value", data.value);
|
|
38
27
|
}
|
|
39
28
|
}
|
|
40
29
|
|
|
41
30
|
class Theme {
|
|
42
|
-
default;
|
|
43
|
-
name;
|
|
31
|
+
default = new ThemeDefault();
|
|
32
|
+
name = "";
|
|
44
33
|
options;
|
|
45
|
-
constructor() {
|
|
46
|
-
this.name = "";
|
|
47
|
-
this.default = new ThemeDefault();
|
|
48
|
-
}
|
|
49
34
|
load(data) {
|
|
50
35
|
if (engine.isNull(data)) {
|
|
51
36
|
return;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
|
-
this.name = data.name;
|
|
55
|
-
}
|
|
38
|
+
engine.loadProperty(this, "name", data.name);
|
|
56
39
|
this.default.load(data.default);
|
|
57
40
|
if (data.options !== undefined) {
|
|
58
41
|
this.options = engine.deepExtend({}, data.options);
|
|
@@ -121,7 +104,7 @@
|
|
|
121
104
|
}
|
|
122
105
|
|
|
123
106
|
async function loadThemesPlugin(engine) {
|
|
124
|
-
engine.checkVersion("4.
|
|
107
|
+
engine.checkVersion("4.2.0");
|
|
125
108
|
await engine.pluginManager.register(e => {
|
|
126
109
|
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
127
110
|
});
|
|
@@ -183,12 +166,12 @@
|
|
|
183
166
|
container.actualOptions.setTheme?.(container.currentTheme);
|
|
184
167
|
return false;
|
|
185
168
|
}
|
|
186
|
-
#handleThemeChange
|
|
169
|
+
#handleThemeChange(e) {
|
|
187
170
|
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
171
|
if (theme?.default.auto) {
|
|
189
172
|
void container.loadTheme?.(themeName);
|
|
190
173
|
}
|
|
191
|
-
}
|
|
174
|
+
}
|
|
192
175
|
}
|
|
193
176
|
|
|
194
177
|
var ThemesPluginInstance$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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=!1;mode=s.any;value=!1;load(e){t.isNull(e)||(t.loadProperty(this,"auto",e.auto),t.loadProperty(this,"mode",e.mode),t.loadProperty(this,"value",e.value))}}class a{default=new n;name="";options;load(e){t.isNull(e)||(t.loadProperty(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.2.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{#e;constructor(e){this.#e=e}init(){const e=this.#e;e.themeMatchMedia=t.safeMatchMedia("(prefers-color-scheme: dark)");return e.themeHandlers={themeChange:e=>{this.#t(e)},oldThemeChange:e=>{this.#t(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.#e;t.manageMediaMatch?.(e)}async start(){return this.manageListeners(!0),Promise.resolve()}stop(){this.manageListeners(!1)}updateActualOptions(){const e=this.#e;return e.actualOptions.setTheme?.(e.currentTheme),!1}#t(e){const t=e,s=this.#e,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;
|