@tsparticles/plugin-themes 4.0.0-beta.0 → 4.0.0-beta.10
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/{306.min.js → 453.min.js} +1 -1
- package/{366.min.js → 579.min.js} +1 -1
- package/README.md +27 -0
- package/browser/index.js +3 -3
- package/cjs/index.js +3 -3
- package/dist_browser_ThemesPluginInstance_js.js +1 -1
- package/dist_browser_ThemesPlugin_js.js +1 -1
- package/esm/index.js +3 -3
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.plugin.themes.js +2 -2
- package/tsparticles.plugin.themes.min.js +2 -2
- package/umd/Options/Classes/Theme.js +0 -37
- package/umd/Options/Classes/ThemeDefault.js +0 -40
- package/umd/Options/Interfaces/ITheme.js +0 -12
- package/umd/Options/Interfaces/IThemeDefault.js +0 -12
- package/umd/ThemeMode.js +0 -19
- package/umd/ThemesPlugin.js +0 -110
- package/umd/ThemesPluginInstance.js +0 -74
- package/umd/index.js +0 -54
- package/umd/types.js +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_themes=this.webpackChunk_tsparticles_plugin_themes||[]).push([[
|
|
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)}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_themes=this.webpackChunk_tsparticles_plugin_themes||[]).push([[
|
|
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}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) plugin for handling themes feature.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -72,3 +78,24 @@ import { loadThemesPlugin } from "@tsparticles/plugin-themes";
|
|
|
72
78
|
await loadThemesPlugin(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- Primary options key: `themes`
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"themes": {}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Common pitfalls
|
|
93
|
+
|
|
94
|
+
- Calling `tsParticles.load(...)` before `loadThemesPlugin(...)`
|
|
95
|
+
- Verify required peer packages before enabling advanced options
|
|
96
|
+
- Change one option group at a time to isolate regressions quickly
|
|
97
|
+
|
|
98
|
+
## Related docs
|
|
99
|
+
|
|
100
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
101
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadThemesPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ThemesPlugin } = await import("./ThemesPlugin.js");
|
|
5
|
-
e.addPlugin(new ThemesPlugin());
|
|
5
|
+
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadThemesPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ThemesPlugin } = await import("./ThemesPlugin.js");
|
|
5
|
-
e.addPlugin(new ThemesPlugin());
|
|
5
|
+
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export async function loadThemesPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ThemesPlugin } = await import("./ThemesPlugin.js");
|
|
5
|
-
e.addPlugin(new ThemesPlugin());
|
|
5
|
+
e.pluginManager.addPlugin(new ThemesPlugin());
|
|
6
6
|
});
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-themes",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles themes plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -80,13 +80,12 @@
|
|
|
80
80
|
"browser": "./browser/index.js",
|
|
81
81
|
"import": "./esm/index.js",
|
|
82
82
|
"require": "./cjs/index.js",
|
|
83
|
-
"
|
|
84
|
-
"default": "./cjs/index.js"
|
|
83
|
+
"default": "./esm/index.js"
|
|
85
84
|
},
|
|
86
85
|
"./package.json": "./package.json"
|
|
87
86
|
},
|
|
88
|
-
"
|
|
89
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"@tsparticles/engine": "4.0.0-beta.10"
|
|
90
89
|
},
|
|
91
90
|
"publishConfig": {
|
|
92
91
|
"access": "public"
|