tsparticles 1.39.3 → 1.40.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/Core/Container.d.ts +3 -1
- package/Core/Container.js +27 -12
- package/Core/Loader.d.ts +12 -9
- package/Core/Loader.js +35 -19
- package/Core/Particle.d.ts +3 -1
- package/Core/Particle.js +17 -2
- package/Core/Particles.d.ts +3 -1
- package/Core/Particles.js +20 -5
- package/Core/Utils/InteractionManager.d.ts +3 -1
- package/Core/Utils/InteractionManager.js +17 -3
- package/Core/Utils/Plugins.d.ts +29 -15
- package/Core/Utils/Plugins.js +58 -46
- package/Options/Classes/Options.d.ts +2 -1
- package/Options/Classes/Options.js +13 -6
- package/Plugins/Emitters/EmitterInstance.d.ts +6 -3
- package/Plugins/Emitters/EmitterInstance.js +46 -16
- package/Plugins/Emitters/Emitters.d.ts +3 -1
- package/Plugins/Emitters/Emitters.js +17 -2
- package/Plugins/Emitters/{EmittersMain.d.ts → EmittersEngine.d.ts} +3 -1
- package/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
- package/Plugins/Emitters/IEmitterShape.d.ts +2 -2
- package/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
- package/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
- package/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +1 -0
- package/Plugins/Emitters/ShapeManager.d.ts +6 -3
- package/Plugins/Emitters/ShapeManager.js +16 -4
- package/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
- package/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
- package/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
- package/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
- package/Plugins/Emitters/index.d.ts +3 -3
- package/Plugins/Emitters/index.js +25 -6
- package/README.md +1 -1
- package/browser/Core/Container.d.ts +4 -1
- package/browser/Core/Container.js +29 -13
- package/browser/Core/Loader.d.ts +12 -9
- package/browser/Core/Loader.js +35 -19
- package/browser/Core/Particle.d.ts +3 -1
- package/browser/Core/Particle.js +18 -3
- package/browser/Core/Particles.d.ts +3 -1
- package/browser/Core/Particles.js +21 -6
- package/browser/Core/Utils/InteractionManager.d.ts +3 -1
- package/browser/Core/Utils/InteractionManager.js +17 -3
- package/browser/Core/Utils/Plugins.d.ts +29 -15
- package/browser/Core/Utils/Plugins.js +58 -46
- package/browser/Options/Classes/Options.d.ts +2 -1
- package/browser/Options/Classes/Options.js +13 -6
- package/browser/Plugins/Emitters/EmitterInstance.d.ts +6 -3
- package/browser/Plugins/Emitters/EmitterInstance.js +46 -16
- package/browser/Plugins/Emitters/Emitters.d.ts +3 -1
- package/browser/Plugins/Emitters/Emitters.js +17 -2
- package/{esm/Plugins/Emitters/EmittersMain.d.ts → browser/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
- package/browser/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
- package/browser/Plugins/Emitters/IEmitterShape.d.ts +2 -2
- package/browser/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
- package/browser/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
- package/browser/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +4 -0
- package/browser/Plugins/Emitters/ShapeManager.d.ts +6 -3
- package/browser/Plugins/Emitters/ShapeManager.js +16 -4
- package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
- package/browser/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
- package/browser/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
- package/browser/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
- package/browser/Plugins/Emitters/index.d.ts +3 -3
- package/browser/Plugins/Emitters/index.js +25 -6
- package/browser/engine.d.ts +5 -1
- package/browser/engine.js +22 -17
- package/engine.d.ts +3 -0
- package/engine.js +20 -16
- package/esm/Core/Container.d.ts +3 -1
- package/esm/Core/Container.js +28 -13
- package/esm/Core/Loader.d.ts +12 -9
- package/esm/Core/Loader.js +35 -19
- package/esm/Core/Particle.d.ts +3 -1
- package/esm/Core/Particle.js +18 -3
- package/esm/Core/Particles.d.ts +3 -1
- package/esm/Core/Particles.js +21 -6
- package/esm/Core/Utils/InteractionManager.d.ts +3 -1
- package/esm/Core/Utils/InteractionManager.js +17 -3
- package/esm/Core/Utils/Plugins.d.ts +29 -15
- package/esm/Core/Utils/Plugins.js +58 -46
- package/esm/Options/Classes/Options.d.ts +2 -1
- package/esm/Options/Classes/Options.js +13 -6
- package/esm/Plugins/Emitters/EmitterInstance.d.ts +6 -3
- package/esm/Plugins/Emitters/EmitterInstance.js +46 -16
- package/esm/Plugins/Emitters/Emitters.d.ts +3 -1
- package/esm/Plugins/Emitters/Emitters.js +17 -2
- package/{browser/Plugins/Emitters/EmittersMain.d.ts → esm/Plugins/Emitters/EmittersEngine.d.ts} +3 -1
- package/esm/Plugins/Emitters/{EmittersMain.js → EmittersEngine.js} +0 -0
- package/esm/Plugins/Emitters/IEmitterShape.d.ts +2 -2
- package/esm/Plugins/Emitters/Options/Classes/Emitter.d.ts +1 -0
- package/esm/Plugins/Emitters/Options/Classes/Emitter.js +1 -0
- package/esm/Plugins/Emitters/Options/Interfaces/IEmitter.d.ts +1 -0
- package/esm/Plugins/Emitters/ShapeManager.d.ts +6 -3
- package/esm/Plugins/Emitters/ShapeManager.js +16 -4
- package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.d.ts +2 -2
- package/esm/Plugins/Emitters/Shapes/Circle/CircleShape.js +2 -2
- package/esm/Plugins/Emitters/Shapes/Square/SquareShape.d.ts +2 -2
- package/esm/Plugins/Emitters/Shapes/Square/SquareShape.js +4 -4
- package/esm/Plugins/Emitters/index.d.ts +3 -3
- package/esm/Plugins/Emitters/index.js +25 -6
- package/esm/engine.d.ts +3 -0
- package/esm/engine.js +20 -16
- package/package.json +1 -1
- package/report.html +2 -2
- package/report.slim.html +2 -2
- package/tsparticles.engine.js +221 -114
- package/tsparticles.engine.min.js +2 -2
- package/tsparticles.interaction.external.attract.js +199 -96
- package/tsparticles.interaction.external.attract.min.js +2 -2
- package/tsparticles.interaction.external.bounce.js +199 -96
- package/tsparticles.interaction.external.bounce.min.js +2 -2
- package/tsparticles.interaction.external.bubble.js +199 -96
- package/tsparticles.interaction.external.bubble.min.js +2 -2
- package/tsparticles.interaction.external.connect.js +199 -96
- package/tsparticles.interaction.external.connect.min.js +2 -2
- package/tsparticles.interaction.external.grab.js +199 -96
- package/tsparticles.interaction.external.grab.min.js +2 -2
- package/tsparticles.interaction.external.repulse.js +199 -96
- package/tsparticles.interaction.external.repulse.min.js +2 -2
- package/tsparticles.interaction.external.trail.js +199 -96
- package/tsparticles.interaction.external.trail.min.js +2 -2
- package/tsparticles.interaction.particles.attract.js +199 -96
- package/tsparticles.interaction.particles.attract.min.js +2 -2
- package/tsparticles.interaction.particles.collisions.js +199 -96
- package/tsparticles.interaction.particles.collisions.min.js +2 -2
- package/tsparticles.interaction.particles.links.js +199 -96
- package/tsparticles.interaction.particles.links.min.js +2 -2
- package/tsparticles.js +341 -152
- package/tsparticles.min.js +2 -2
- package/tsparticles.pathseg.min.js +1 -1
- package/tsparticles.plugins.absorbers.js +199 -96
- package/tsparticles.plugins.absorbers.min.js +2 -2
- package/tsparticles.plugins.emitters.js +324 -139
- package/tsparticles.plugins.emitters.min.js +2 -2
- package/tsparticles.plugins.polygonMask.js +199 -96
- package/tsparticles.plugins.polygonMask.min.js +2 -2
- package/tsparticles.shape.circle.min.js +1 -1
- package/tsparticles.shape.image.js +202 -99
- package/tsparticles.shape.image.min.js +2 -2
- package/tsparticles.shape.line.min.js +1 -1
- package/tsparticles.shape.polygon.min.js +1 -1
- package/tsparticles.shape.square.min.js +1 -1
- package/tsparticles.shape.star.min.js +1 -1
- package/tsparticles.shape.text.js +199 -96
- package/tsparticles.shape.text.min.js +2 -2
- package/tsparticles.slim.js +221 -114
- package/tsparticles.slim.min.js +2 -2
- package/tsparticles.updater.angle.js +199 -96
- package/tsparticles.updater.angle.min.js +2 -2
- package/tsparticles.updater.color.js +199 -96
- package/tsparticles.updater.color.min.js +2 -2
- package/tsparticles.updater.life.js +199 -96
- package/tsparticles.updater.life.min.js +2 -2
- package/tsparticles.updater.opacity.js +199 -96
- package/tsparticles.updater.opacity.min.js +2 -2
- package/tsparticles.updater.outModes.js +199 -96
- package/tsparticles.updater.outModes.min.js +2 -2
- package/tsparticles.updater.roll.js +199 -96
- package/tsparticles.updater.roll.min.js +2 -2
- package/tsparticles.updater.size.js +199 -96
- package/tsparticles.updater.size.min.js +2 -2
- package/tsparticles.updater.strokeColor.js +199 -96
- package/tsparticles.updater.strokeColor.min.js +2 -2
- package/tsparticles.updater.tilt.js +199 -96
- package/tsparticles.updater.tilt.min.js +2 -2
- package/tsparticles.updater.wobble.js +199 -96
- package/tsparticles.updater.wobble.min.js +2 -2
package/tsparticles.engine.js
CHANGED
|
@@ -1924,15 +1924,30 @@
|
|
|
1924
1924
|
}
|
|
1925
1925
|
}
|
|
1926
1926
|
}
|
|
1927
|
+
var __classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
1928
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
1929
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
1930
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1931
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
1932
|
+
value;
|
|
1933
|
+
};
|
|
1934
|
+
var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
1935
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
1936
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1937
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1938
|
+
};
|
|
1939
|
+
var _InteractionManager_engine;
|
|
1927
1940
|
class InteractionManager {
|
|
1928
|
-
constructor(container) {
|
|
1941
|
+
constructor(engine, container) {
|
|
1929
1942
|
this.container = container;
|
|
1943
|
+
_InteractionManager_engine.set(this, void 0);
|
|
1944
|
+
__classPrivateFieldSet(this, _InteractionManager_engine, engine, "f");
|
|
1930
1945
|
this.externalInteractors = [];
|
|
1931
1946
|
this.particleInteractors = [];
|
|
1932
1947
|
this.init();
|
|
1933
1948
|
}
|
|
1934
1949
|
init() {
|
|
1935
|
-
const interactors =
|
|
1950
|
+
const interactors = __classPrivateFieldGet(this, _InteractionManager_engine, "f").plugins.getInteractors(this.container, true);
|
|
1936
1951
|
this.externalInteractors = [];
|
|
1937
1952
|
this.particleInteractors = [];
|
|
1938
1953
|
for (const interactor of interactors) {
|
|
@@ -1965,6 +1980,7 @@
|
|
|
1965
1980
|
}
|
|
1966
1981
|
}
|
|
1967
1982
|
}
|
|
1983
|
+
_InteractionManager_engine = new WeakMap;
|
|
1968
1984
|
class ParticlesInteractorBase {
|
|
1969
1985
|
constructor(container) {
|
|
1970
1986
|
this.container = container;
|
|
@@ -2144,26 +2160,38 @@
|
|
|
2144
2160
|
return proximityFactor / slowFactor;
|
|
2145
2161
|
}
|
|
2146
2162
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2163
|
+
var Plugins_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
2164
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2165
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2166
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2167
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
2168
|
+
value;
|
|
2169
|
+
};
|
|
2170
|
+
var _Plugins_engine;
|
|
2155
2171
|
class Plugins {
|
|
2156
|
-
|
|
2157
|
-
|
|
2172
|
+
constructor(engine) {
|
|
2173
|
+
_Plugins_engine.set(this, void 0);
|
|
2174
|
+
Plugins_classPrivateFieldSet(this, _Plugins_engine, engine, "f");
|
|
2175
|
+
this.plugins = [];
|
|
2176
|
+
this.interactorsInitializers = new Map;
|
|
2177
|
+
this.updatersInitializers = new Map;
|
|
2178
|
+
this.interactors = new Map;
|
|
2179
|
+
this.updaters = new Map;
|
|
2180
|
+
this.presets = new Map;
|
|
2181
|
+
this.drawers = new Map;
|
|
2182
|
+
this.pathGenerators = new Map;
|
|
2183
|
+
}
|
|
2184
|
+
getPlugin(plugin) {
|
|
2185
|
+
return this.plugins.find((t => t.id === plugin));
|
|
2158
2186
|
}
|
|
2159
|
-
|
|
2160
|
-
if (!
|
|
2161
|
-
plugins.push(plugin);
|
|
2187
|
+
addPlugin(plugin) {
|
|
2188
|
+
if (!this.getPlugin(plugin.id)) {
|
|
2189
|
+
this.plugins.push(plugin);
|
|
2162
2190
|
}
|
|
2163
2191
|
}
|
|
2164
|
-
|
|
2192
|
+
getAvailablePlugins(container) {
|
|
2165
2193
|
const res = new Map;
|
|
2166
|
-
for (const plugin of plugins) {
|
|
2194
|
+
for (const plugin of this.plugins) {
|
|
2167
2195
|
if (!plugin.needsPlugin(container.actualOptions)) {
|
|
2168
2196
|
continue;
|
|
2169
2197
|
}
|
|
@@ -2171,61 +2199,62 @@
|
|
|
2171
2199
|
}
|
|
2172
2200
|
return res;
|
|
2173
2201
|
}
|
|
2174
|
-
|
|
2175
|
-
for (const plugin of plugins) {
|
|
2202
|
+
loadOptions(options, sourceOptions) {
|
|
2203
|
+
for (const plugin of this.plugins) {
|
|
2176
2204
|
plugin.loadOptions(options, sourceOptions);
|
|
2177
2205
|
}
|
|
2178
2206
|
}
|
|
2179
|
-
|
|
2180
|
-
return presets.get(preset);
|
|
2207
|
+
getPreset(preset) {
|
|
2208
|
+
return this.presets.get(preset);
|
|
2181
2209
|
}
|
|
2182
|
-
|
|
2183
|
-
if (override || !
|
|
2184
|
-
presets.set(presetKey, options);
|
|
2210
|
+
addPreset(presetKey, options, override = false) {
|
|
2211
|
+
if (override || !this.getPreset(presetKey)) {
|
|
2212
|
+
this.presets.set(presetKey, options);
|
|
2185
2213
|
}
|
|
2186
2214
|
}
|
|
2187
|
-
|
|
2188
|
-
if (!
|
|
2189
|
-
drawers.set(type, drawer);
|
|
2215
|
+
addShapeDrawer(type, drawer) {
|
|
2216
|
+
if (!this.getShapeDrawer(type)) {
|
|
2217
|
+
this.drawers.set(type, drawer);
|
|
2190
2218
|
}
|
|
2191
2219
|
}
|
|
2192
|
-
|
|
2193
|
-
return drawers.get(type);
|
|
2220
|
+
getShapeDrawer(type) {
|
|
2221
|
+
return this.drawers.get(type);
|
|
2194
2222
|
}
|
|
2195
|
-
|
|
2196
|
-
return drawers.keys();
|
|
2223
|
+
getSupportedShapes() {
|
|
2224
|
+
return this.drawers.keys();
|
|
2197
2225
|
}
|
|
2198
|
-
|
|
2199
|
-
return pathGenerators.get(type);
|
|
2226
|
+
getPathGenerator(type) {
|
|
2227
|
+
return this.pathGenerators.get(type);
|
|
2200
2228
|
}
|
|
2201
|
-
|
|
2202
|
-
if (!
|
|
2203
|
-
pathGenerators.set(type, pathGenerator);
|
|
2229
|
+
addPathGenerator(type, pathGenerator) {
|
|
2230
|
+
if (!this.getPathGenerator(type)) {
|
|
2231
|
+
this.pathGenerators.set(type, pathGenerator);
|
|
2204
2232
|
}
|
|
2205
2233
|
}
|
|
2206
|
-
|
|
2207
|
-
let res = interactors.get(container);
|
|
2234
|
+
getInteractors(container, force = false) {
|
|
2235
|
+
let res = this.interactors.get(container);
|
|
2208
2236
|
if (!res || force) {
|
|
2209
|
-
res = [ ...interactorsInitializers.values() ].map((t => t(container)));
|
|
2210
|
-
interactors.set(container, res);
|
|
2237
|
+
res = [ ...this.interactorsInitializers.values() ].map((t => t(container)));
|
|
2238
|
+
this.interactors.set(container, res);
|
|
2211
2239
|
}
|
|
2212
2240
|
return res;
|
|
2213
2241
|
}
|
|
2214
|
-
|
|
2215
|
-
interactorsInitializers.set(name, initInteractor);
|
|
2242
|
+
addInteractor(name, initInteractor) {
|
|
2243
|
+
this.interactorsInitializers.set(name, initInteractor);
|
|
2216
2244
|
}
|
|
2217
|
-
|
|
2218
|
-
let res = updaters.get(container);
|
|
2245
|
+
getUpdaters(container, force = false) {
|
|
2246
|
+
let res = this.updaters.get(container);
|
|
2219
2247
|
if (!res || force) {
|
|
2220
|
-
res = [ ...updatersInitializers.values() ].map((t => t(container)));
|
|
2221
|
-
updaters.set(container, res);
|
|
2248
|
+
res = [ ...this.updatersInitializers.values() ].map((t => t(container)));
|
|
2249
|
+
this.updaters.set(container, res);
|
|
2222
2250
|
}
|
|
2223
2251
|
return res;
|
|
2224
2252
|
}
|
|
2225
|
-
|
|
2226
|
-
updatersInitializers.set(name, initUpdater);
|
|
2253
|
+
addParticleUpdater(name, initUpdater) {
|
|
2254
|
+
this.updatersInitializers.set(name, initUpdater);
|
|
2227
2255
|
}
|
|
2228
2256
|
}
|
|
2257
|
+
_Plugins_engine = new WeakMap;
|
|
2229
2258
|
class Point {
|
|
2230
2259
|
constructor(position, particle) {
|
|
2231
2260
|
this.position = position;
|
|
@@ -5207,15 +5236,24 @@
|
|
|
5207
5236
|
}
|
|
5208
5237
|
}
|
|
5209
5238
|
}
|
|
5210
|
-
var
|
|
5239
|
+
var Options_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
5240
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
5241
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5242
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5243
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
5244
|
+
value;
|
|
5245
|
+
};
|
|
5246
|
+
var Options_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
5211
5247
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5212
5248
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5213
5249
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5214
5250
|
};
|
|
5215
|
-
var _Options_instances, _Options_findDefaultTheme;
|
|
5251
|
+
var _Options_instances, _Options_engine, _Options_findDefaultTheme;
|
|
5216
5252
|
class Options {
|
|
5217
|
-
constructor() {
|
|
5253
|
+
constructor(engine) {
|
|
5218
5254
|
_Options_instances.add(this);
|
|
5255
|
+
_Options_engine.set(this, void 0);
|
|
5256
|
+
Options_classPrivateFieldSet(this, _Options_engine, engine, "f");
|
|
5219
5257
|
this.autoPlay = true;
|
|
5220
5258
|
this.background = new Background;
|
|
5221
5259
|
this.backgroundMask = new BackgroundMask;
|
|
@@ -5308,7 +5346,7 @@
|
|
|
5308
5346
|
this.motion.load(data.motion);
|
|
5309
5347
|
this.particles.load(data.particles);
|
|
5310
5348
|
this.style = deepExtend(this.style, data.style);
|
|
5311
|
-
|
|
5349
|
+
Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.loadOptions(this, data);
|
|
5312
5350
|
if (data.responsive !== undefined) {
|
|
5313
5351
|
for (const responsive of data.responsive) {
|
|
5314
5352
|
const optResponsive = new Responsive;
|
|
@@ -5324,8 +5362,8 @@
|
|
|
5324
5362
|
this.themes.push(optTheme);
|
|
5325
5363
|
}
|
|
5326
5364
|
}
|
|
5327
|
-
this.defaultDarkTheme = (_d =
|
|
5328
|
-
this.defaultLightTheme = (_e =
|
|
5365
|
+
this.defaultDarkTheme = (_d = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "dark")) === null || _d === void 0 ? void 0 : _d.name;
|
|
5366
|
+
this.defaultLightTheme = (_e = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, "light")) === null || _e === void 0 ? void 0 : _e.name;
|
|
5329
5367
|
}
|
|
5330
5368
|
setTheme(name) {
|
|
5331
5369
|
if (name) {
|
|
@@ -5334,7 +5372,7 @@
|
|
|
5334
5372
|
this.load(chosenTheme.options);
|
|
5335
5373
|
}
|
|
5336
5374
|
} else {
|
|
5337
|
-
const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch && mediaMatch.matches, defaultTheme =
|
|
5375
|
+
const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)"), clientDarkMode = mediaMatch && mediaMatch.matches, defaultTheme = Options_classPrivateFieldGet(this, _Options_instances, "m", _Options_findDefaultTheme).call(this, clientDarkMode ? "dark" : "light");
|
|
5338
5376
|
if (defaultTheme) {
|
|
5339
5377
|
this.load(defaultTheme.options);
|
|
5340
5378
|
}
|
|
@@ -5347,13 +5385,26 @@
|
|
|
5347
5385
|
return responsiveOptions === null || responsiveOptions === void 0 ? void 0 : responsiveOptions.maxWidth;
|
|
5348
5386
|
}
|
|
5349
5387
|
importPreset(preset) {
|
|
5350
|
-
this.load(
|
|
5388
|
+
this.load(Options_classPrivateFieldGet(this, _Options_engine, "f").plugins.getPreset(preset));
|
|
5351
5389
|
}
|
|
5352
5390
|
}
|
|
5353
|
-
_Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
|
|
5391
|
+
_Options_engine = new WeakMap, _Options_instances = new WeakSet, _Options_findDefaultTheme = function _Options_findDefaultTheme(mode) {
|
|
5354
5392
|
var _a;
|
|
5355
5393
|
return (_a = this.themes.find((theme => theme.default.value && theme.default.mode === mode))) !== null && _a !== void 0 ? _a : this.themes.find((theme => theme.default.value && theme.default.mode === "any"));
|
|
5356
5394
|
};
|
|
5395
|
+
var Particle_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
5396
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
5397
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5398
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5399
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
5400
|
+
value;
|
|
5401
|
+
};
|
|
5402
|
+
var Particle_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
5403
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5404
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5405
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5406
|
+
};
|
|
5407
|
+
var _Particle_engine;
|
|
5357
5408
|
const fixOutMode = data => {
|
|
5358
5409
|
if (isInArray(data.outMode, data.checkModes) || isInArray(data.outMode, data.checkModes)) {
|
|
5359
5410
|
if (data.coord > data.maxCoord - data.radius * 2) {
|
|
@@ -5364,11 +5415,13 @@
|
|
|
5364
5415
|
}
|
|
5365
5416
|
};
|
|
5366
5417
|
class Particle {
|
|
5367
|
-
constructor(id, container, position, overrideOptions, group) {
|
|
5418
|
+
constructor(engine, id, container, position, overrideOptions, group) {
|
|
5368
5419
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5369
5420
|
this.id = id;
|
|
5370
5421
|
this.container = container;
|
|
5371
5422
|
this.group = group;
|
|
5423
|
+
_Particle_engine.set(this, void 0);
|
|
5424
|
+
Particle_classPrivateFieldSet(this, _Particle_engine, engine, "f");
|
|
5372
5425
|
this.fill = true;
|
|
5373
5426
|
this.close = true;
|
|
5374
5427
|
this.lastPathTime = 0;
|
|
@@ -5462,7 +5515,7 @@
|
|
|
5462
5515
|
this.sides = 24;
|
|
5463
5516
|
let drawer = container.drawers.get(this.shape);
|
|
5464
5517
|
if (!drawer) {
|
|
5465
|
-
drawer =
|
|
5518
|
+
drawer = Particle_classPrivateFieldGet(this, _Particle_engine, "f").plugins.getShapeDrawer(this.shape);
|
|
5466
5519
|
if (drawer) {
|
|
5467
5520
|
container.drawers.set(this.shape, drawer);
|
|
5468
5521
|
}
|
|
@@ -5702,9 +5755,25 @@
|
|
|
5702
5755
|
return life;
|
|
5703
5756
|
}
|
|
5704
5757
|
}
|
|
5758
|
+
_Particle_engine = new WeakMap;
|
|
5759
|
+
var Particles_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
5760
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
5761
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5762
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5763
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
5764
|
+
value;
|
|
5765
|
+
};
|
|
5766
|
+
var Particles_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
5767
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5768
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5769
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5770
|
+
};
|
|
5771
|
+
var _Particles_engine;
|
|
5705
5772
|
class Particles {
|
|
5706
|
-
constructor(container) {
|
|
5773
|
+
constructor(engine, container) {
|
|
5707
5774
|
this.container = container;
|
|
5775
|
+
_Particles_engine.set(this, void 0);
|
|
5776
|
+
Particles_classPrivateFieldSet(this, _Particles_engine, engine, "f");
|
|
5708
5777
|
this.nextId = 0;
|
|
5709
5778
|
this.array = [];
|
|
5710
5779
|
this.zArray = [];
|
|
@@ -5716,11 +5785,11 @@
|
|
|
5716
5785
|
links: new Map,
|
|
5717
5786
|
triangles: new Map
|
|
5718
5787
|
};
|
|
5719
|
-
this.interactionManager = new InteractionManager(container);
|
|
5788
|
+
this.interactionManager = new InteractionManager(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), container);
|
|
5720
5789
|
const canvasSize = this.container.canvas.size;
|
|
5721
5790
|
this.linksColors = new Map;
|
|
5722
5791
|
this.quadTree = new QuadTree(new Rectangle(-canvasSize.width / 4, -canvasSize.height / 4, canvasSize.width * 3 / 2, canvasSize.height * 3 / 2), 4);
|
|
5723
|
-
this.updaters =
|
|
5792
|
+
this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
|
|
5724
5793
|
}
|
|
5725
5794
|
get count() {
|
|
5726
5795
|
return this.array.length;
|
|
@@ -5734,7 +5803,7 @@
|
|
|
5734
5803
|
this.freqs.links = new Map;
|
|
5735
5804
|
this.freqs.triangles = new Map;
|
|
5736
5805
|
let handled = false;
|
|
5737
|
-
this.updaters =
|
|
5806
|
+
this.updaters = Particles_classPrivateFieldGet(this, _Particles_engine, "f").plugins.getUpdaters(container, true);
|
|
5738
5807
|
this.interactionManager.init();
|
|
5739
5808
|
for (const [, plugin] of container.plugins) {
|
|
5740
5809
|
if (plugin.particlesInitialization !== undefined) {
|
|
@@ -5981,7 +6050,7 @@
|
|
|
5981
6050
|
}
|
|
5982
6051
|
pushParticle(position, overrideOptions, group, initializer) {
|
|
5983
6052
|
try {
|
|
5984
|
-
const particle = new Particle(this.nextId, this.container, position, overrideOptions, group);
|
|
6053
|
+
const particle = new Particle(Particles_classPrivateFieldGet(this, _Particles_engine, "f"), this.nextId, this.container, position, overrideOptions, group);
|
|
5985
6054
|
let canAdd = true;
|
|
5986
6055
|
if (initializer) {
|
|
5987
6056
|
canAdd = initializer(particle);
|
|
@@ -5999,6 +6068,7 @@
|
|
|
5999
6068
|
}
|
|
6000
6069
|
}
|
|
6001
6070
|
}
|
|
6071
|
+
_Particles_engine = new WeakMap;
|
|
6002
6072
|
class Retina {
|
|
6003
6073
|
constructor(container) {
|
|
6004
6074
|
this.container = container;
|
|
@@ -6086,9 +6156,24 @@
|
|
|
6086
6156
|
}
|
|
6087
6157
|
}
|
|
6088
6158
|
}
|
|
6159
|
+
var Container_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
6160
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6161
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
6162
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6163
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
6164
|
+
value;
|
|
6165
|
+
};
|
|
6166
|
+
var Container_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
6167
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
6168
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6169
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6170
|
+
};
|
|
6171
|
+
var _Container_engine;
|
|
6089
6172
|
class Container {
|
|
6090
|
-
constructor(id, sourceOptions, ...presets) {
|
|
6173
|
+
constructor(engine, id, sourceOptions, ...presets) {
|
|
6091
6174
|
this.id = id;
|
|
6175
|
+
_Container_engine.set(this, void 0);
|
|
6176
|
+
Container_classPrivateFieldSet(this, _Container_engine, engine, "f");
|
|
6092
6177
|
this.fpsLimit = 120;
|
|
6093
6178
|
this.duration = 0;
|
|
6094
6179
|
this.lifeTime = 0;
|
|
@@ -6103,7 +6188,7 @@
|
|
|
6103
6188
|
this._initialSourceOptions = sourceOptions;
|
|
6104
6189
|
this.retina = new Retina(this);
|
|
6105
6190
|
this.canvas = new Canvas(this);
|
|
6106
|
-
this.particles = new Particles(this);
|
|
6191
|
+
this.particles = new Particles(Container_classPrivateFieldGet(this, _Container_engine, "f"), this);
|
|
6107
6192
|
this.drawer = new FrameManager(this);
|
|
6108
6193
|
this.presets = presets;
|
|
6109
6194
|
this.pathGenerator = {
|
|
@@ -6132,8 +6217,8 @@
|
|
|
6132
6217
|
this.plugins = new Map;
|
|
6133
6218
|
this.drawers = new Map;
|
|
6134
6219
|
this.density = 1;
|
|
6135
|
-
this._options = new Options;
|
|
6136
|
-
this.actualOptions = new Options;
|
|
6220
|
+
this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
|
|
6221
|
+
this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
|
|
6137
6222
|
this.eventListeners = new EventListeners(this);
|
|
6138
6223
|
if (typeof IntersectionObserver !== "undefined" && IntersectionObserver) {
|
|
6139
6224
|
this.intersectionObserver = new IntersectionObserver((entries => this.intersectionManager(entries)));
|
|
@@ -6248,7 +6333,7 @@
|
|
|
6248
6333
|
return this.start();
|
|
6249
6334
|
}
|
|
6250
6335
|
reset() {
|
|
6251
|
-
this._options = new Options;
|
|
6336
|
+
this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
|
|
6252
6337
|
return this.refresh();
|
|
6253
6338
|
}
|
|
6254
6339
|
stop() {
|
|
@@ -6389,20 +6474,20 @@
|
|
|
6389
6474
|
return false;
|
|
6390
6475
|
}
|
|
6391
6476
|
async init() {
|
|
6392
|
-
this._options = new Options;
|
|
6477
|
+
this._options = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
|
|
6393
6478
|
for (const preset of this.presets) {
|
|
6394
|
-
this._options.load(
|
|
6479
|
+
this._options.load(Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPreset(preset));
|
|
6395
6480
|
}
|
|
6396
|
-
const shapes =
|
|
6481
|
+
const shapes = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getSupportedShapes();
|
|
6397
6482
|
for (const type of shapes) {
|
|
6398
|
-
const drawer =
|
|
6483
|
+
const drawer = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getShapeDrawer(type);
|
|
6399
6484
|
if (drawer) {
|
|
6400
6485
|
this.drawers.set(type, drawer);
|
|
6401
6486
|
}
|
|
6402
6487
|
}
|
|
6403
6488
|
this._options.load(this._initialSourceOptions);
|
|
6404
6489
|
this._options.load(this._sourceOptions);
|
|
6405
|
-
this.actualOptions = new Options;
|
|
6490
|
+
this.actualOptions = new Options(Container_classPrivateFieldGet(this, _Container_engine, "f"));
|
|
6406
6491
|
this.actualOptions.load(this._options);
|
|
6407
6492
|
this.retina.init();
|
|
6408
6493
|
this.canvas.init();
|
|
@@ -6413,7 +6498,7 @@
|
|
|
6413
6498
|
this.duration = getRangeValue(this.actualOptions.duration);
|
|
6414
6499
|
this.lifeTime = 0;
|
|
6415
6500
|
this.fpsLimit = this.actualOptions.fpsLimit > 0 ? this.actualOptions.fpsLimit : 120;
|
|
6416
|
-
const availablePlugins =
|
|
6501
|
+
const availablePlugins = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getAvailablePlugins(this);
|
|
6417
6502
|
for (const [id, plugin] of availablePlugins) {
|
|
6418
6503
|
this.plugins.set(id, plugin);
|
|
6419
6504
|
}
|
|
@@ -6431,7 +6516,7 @@
|
|
|
6431
6516
|
}
|
|
6432
6517
|
const pathOptions = this.actualOptions.particles.move.path;
|
|
6433
6518
|
if (pathOptions.generator) {
|
|
6434
|
-
const customGenerator =
|
|
6519
|
+
const customGenerator = Container_classPrivateFieldGet(this, _Container_engine, "f").plugins.getPathGenerator(pathOptions.generator);
|
|
6435
6520
|
if (customGenerator) {
|
|
6436
6521
|
if (customGenerator.init) {
|
|
6437
6522
|
this.pathGenerator.init = customGenerator.init;
|
|
@@ -6468,24 +6553,41 @@
|
|
|
6468
6553
|
}
|
|
6469
6554
|
}
|
|
6470
6555
|
}
|
|
6471
|
-
|
|
6556
|
+
_Container_engine = new WeakMap;
|
|
6557
|
+
var Loader_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
6558
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6559
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
6560
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6561
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
|
|
6562
|
+
value;
|
|
6563
|
+
};
|
|
6564
|
+
var Loader_classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
6565
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
6566
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6567
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6568
|
+
};
|
|
6569
|
+
var _Loader_engine;
|
|
6472
6570
|
function fetchError(statusCode) {
|
|
6473
6571
|
console.error(`Error tsParticles - fetch status: ${statusCode}`);
|
|
6474
6572
|
console.error("Error tsParticles - File config not found");
|
|
6475
6573
|
}
|
|
6476
6574
|
class Loader {
|
|
6477
|
-
|
|
6478
|
-
|
|
6575
|
+
constructor(engine) {
|
|
6576
|
+
_Loader_engine.set(this, void 0);
|
|
6577
|
+
Loader_classPrivateFieldSet(this, _Loader_engine, engine, "f");
|
|
6479
6578
|
}
|
|
6480
|
-
|
|
6481
|
-
|
|
6579
|
+
dom() {
|
|
6580
|
+
return Loader_classPrivateFieldGet(this, _Loader_engine, "f").domArray;
|
|
6581
|
+
}
|
|
6582
|
+
domItem(index) {
|
|
6583
|
+
const dom = this.dom();
|
|
6482
6584
|
const item = dom[index];
|
|
6483
6585
|
if (item && !item.destroyed) {
|
|
6484
6586
|
return item;
|
|
6485
6587
|
}
|
|
6486
6588
|
dom.splice(index, 1);
|
|
6487
6589
|
}
|
|
6488
|
-
|
|
6590
|
+
async loadOptions(params) {
|
|
6489
6591
|
var _a, _b, _c;
|
|
6490
6592
|
const tagId = (_a = params.tagId) !== null && _a !== void 0 ? _a : `tsparticles${Math.floor(Math.random() * 1e4)}`;
|
|
6491
6593
|
const {options: options, index: index} = params;
|
|
@@ -6496,10 +6598,10 @@
|
|
|
6496
6598
|
(_c = document.querySelector("body")) === null || _c === void 0 ? void 0 : _c.append(domContainer);
|
|
6497
6599
|
}
|
|
6498
6600
|
const currentOptions = options instanceof Array ? itemFromArray(options, index) : options;
|
|
6499
|
-
const dom =
|
|
6601
|
+
const dom = this.dom();
|
|
6500
6602
|
const oldIndex = dom.findIndex((v => v.id === tagId));
|
|
6501
6603
|
if (oldIndex >= 0) {
|
|
6502
|
-
const old =
|
|
6604
|
+
const old = this.domItem(oldIndex);
|
|
6503
6605
|
if (old && !old.destroyed) {
|
|
6504
6606
|
old.destroy();
|
|
6505
6607
|
dom.splice(oldIndex, 1);
|
|
@@ -6522,7 +6624,7 @@
|
|
|
6522
6624
|
domContainer.appendChild(canvasEl);
|
|
6523
6625
|
}
|
|
6524
6626
|
}
|
|
6525
|
-
const newItem = new Container(tagId, currentOptions);
|
|
6627
|
+
const newItem = new Container(Loader_classPrivateFieldGet(this, _Loader_engine, "f"), tagId, currentOptions);
|
|
6526
6628
|
if (oldIndex >= 0) {
|
|
6527
6629
|
dom.splice(oldIndex, 0, newItem);
|
|
6528
6630
|
} else {
|
|
@@ -6532,7 +6634,7 @@
|
|
|
6532
6634
|
await newItem.start();
|
|
6533
6635
|
return newItem;
|
|
6534
6636
|
}
|
|
6535
|
-
|
|
6637
|
+
async loadRemoteOptions(params) {
|
|
6536
6638
|
const {url: jsonUrl, index: index} = params;
|
|
6537
6639
|
const url = jsonUrl instanceof Array ? itemFromArray(jsonUrl, index) : jsonUrl;
|
|
6538
6640
|
if (!url) {
|
|
@@ -6544,14 +6646,14 @@
|
|
|
6544
6646
|
return;
|
|
6545
6647
|
}
|
|
6546
6648
|
const data = await response.json();
|
|
6547
|
-
return
|
|
6649
|
+
return this.loadOptions({
|
|
6548
6650
|
tagId: params.tagId,
|
|
6549
6651
|
element: params.element,
|
|
6550
6652
|
index: index,
|
|
6551
6653
|
options: data
|
|
6552
6654
|
});
|
|
6553
6655
|
}
|
|
6554
|
-
|
|
6656
|
+
load(tagId, options, index) {
|
|
6555
6657
|
const params = {
|
|
6556
6658
|
index: index
|
|
6557
6659
|
};
|
|
@@ -6567,7 +6669,7 @@
|
|
|
6567
6669
|
}
|
|
6568
6670
|
return this.loadOptions(params);
|
|
6569
6671
|
}
|
|
6570
|
-
|
|
6672
|
+
async set(id, domContainer, options, index) {
|
|
6571
6673
|
const params = {
|
|
6572
6674
|
index: index
|
|
6573
6675
|
};
|
|
@@ -6588,7 +6690,7 @@
|
|
|
6588
6690
|
}
|
|
6589
6691
|
return this.loadOptions(params);
|
|
6590
6692
|
}
|
|
6591
|
-
|
|
6693
|
+
async loadJSON(tagId, jsonUrl, index) {
|
|
6592
6694
|
let url, id;
|
|
6593
6695
|
if (typeof jsonUrl === "number" || jsonUrl === undefined) {
|
|
6594
6696
|
url = tagId;
|
|
@@ -6596,13 +6698,13 @@
|
|
|
6596
6698
|
id = tagId;
|
|
6597
6699
|
url = jsonUrl;
|
|
6598
6700
|
}
|
|
6599
|
-
return
|
|
6701
|
+
return this.loadRemoteOptions({
|
|
6600
6702
|
tagId: id,
|
|
6601
6703
|
url: url,
|
|
6602
6704
|
index: index
|
|
6603
6705
|
});
|
|
6604
6706
|
}
|
|
6605
|
-
|
|
6707
|
+
async setJSON(id, domContainer, jsonUrl, index) {
|
|
6606
6708
|
let url, newId, newIndex, element;
|
|
6607
6709
|
if (id instanceof HTMLElement) {
|
|
6608
6710
|
element = id;
|
|
@@ -6614,15 +6716,15 @@
|
|
|
6614
6716
|
url = jsonUrl;
|
|
6615
6717
|
newIndex = index;
|
|
6616
6718
|
}
|
|
6617
|
-
return
|
|
6719
|
+
return this.loadRemoteOptions({
|
|
6618
6720
|
tagId: newId,
|
|
6619
6721
|
url: url,
|
|
6620
6722
|
index: newIndex,
|
|
6621
6723
|
element: element
|
|
6622
6724
|
});
|
|
6623
6725
|
}
|
|
6624
|
-
|
|
6625
|
-
const dom =
|
|
6726
|
+
setOnClickHandler(callback) {
|
|
6727
|
+
const dom = this.dom();
|
|
6626
6728
|
if (dom.length === 0) {
|
|
6627
6729
|
throw new Error("Can only set click handlers after calling tsParticles.load() or tsParticles.loadJSON()");
|
|
6628
6730
|
}
|
|
@@ -6631,7 +6733,8 @@
|
|
|
6631
6733
|
}
|
|
6632
6734
|
}
|
|
6633
6735
|
}
|
|
6634
|
-
|
|
6736
|
+
_Loader_engine = new WeakMap;
|
|
6737
|
+
var engine_classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
6635
6738
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6636
6739
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
6637
6740
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -6643,40 +6746,44 @@
|
|
|
6643
6746
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6644
6747
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6645
6748
|
};
|
|
6646
|
-
var _Engine_initialized;
|
|
6749
|
+
var _Engine_initialized, _Engine_loader;
|
|
6647
6750
|
class Engine {
|
|
6648
6751
|
constructor() {
|
|
6649
6752
|
_Engine_initialized.set(this, void 0);
|
|
6650
|
-
|
|
6753
|
+
_Engine_loader.set(this, void 0);
|
|
6754
|
+
engine_classPrivateFieldSet(this, _Engine_initialized, false, "f");
|
|
6755
|
+
this.domArray = [];
|
|
6756
|
+
engine_classPrivateFieldSet(this, _Engine_loader, new Loader(this), "f");
|
|
6757
|
+
this.plugins = new Plugins(this);
|
|
6651
6758
|
}
|
|
6652
6759
|
init() {
|
|
6653
6760
|
if (!engine_classPrivateFieldGet(this, _Engine_initialized, "f")) {
|
|
6654
|
-
|
|
6761
|
+
engine_classPrivateFieldSet(this, _Engine_initialized, true, "f");
|
|
6655
6762
|
}
|
|
6656
6763
|
}
|
|
6657
6764
|
async loadFromArray(tagId, options, index) {
|
|
6658
|
-
return
|
|
6765
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").load(tagId, options, index);
|
|
6659
6766
|
}
|
|
6660
6767
|
async load(tagId, options) {
|
|
6661
|
-
return
|
|
6768
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").load(tagId, options);
|
|
6662
6769
|
}
|
|
6663
6770
|
async set(id, element, options) {
|
|
6664
|
-
return
|
|
6771
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").set(id, element, options);
|
|
6665
6772
|
}
|
|
6666
6773
|
async loadJSON(tagId, pathConfigJson, index) {
|
|
6667
|
-
return
|
|
6774
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").loadJSON(tagId, pathConfigJson, index);
|
|
6668
6775
|
}
|
|
6669
6776
|
async setJSON(id, element, pathConfigJson, index) {
|
|
6670
|
-
return
|
|
6777
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").setJSON(id, element, pathConfigJson, index);
|
|
6671
6778
|
}
|
|
6672
6779
|
setOnClickHandler(callback) {
|
|
6673
|
-
|
|
6780
|
+
engine_classPrivateFieldGet(this, _Engine_loader, "f").setOnClickHandler(callback);
|
|
6674
6781
|
}
|
|
6675
6782
|
dom() {
|
|
6676
|
-
return
|
|
6783
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").dom();
|
|
6677
6784
|
}
|
|
6678
6785
|
domItem(index) {
|
|
6679
|
-
return
|
|
6786
|
+
return engine_classPrivateFieldGet(this, _Engine_loader, "f").domItem(index);
|
|
6680
6787
|
}
|
|
6681
6788
|
async refresh() {
|
|
6682
6789
|
for (const instance of this.dom()) {
|
|
@@ -6695,31 +6802,31 @@
|
|
|
6695
6802
|
} else {
|
|
6696
6803
|
customDrawer = drawer;
|
|
6697
6804
|
}
|
|
6698
|
-
|
|
6805
|
+
this.plugins.addShapeDrawer(shape, customDrawer);
|
|
6699
6806
|
await this.refresh();
|
|
6700
6807
|
}
|
|
6701
6808
|
async addPreset(preset, options, override = false) {
|
|
6702
|
-
|
|
6809
|
+
this.plugins.addPreset(preset, options, override);
|
|
6703
6810
|
await this.refresh();
|
|
6704
6811
|
}
|
|
6705
6812
|
async addPlugin(plugin) {
|
|
6706
|
-
|
|
6813
|
+
this.plugins.addPlugin(plugin);
|
|
6707
6814
|
await this.refresh();
|
|
6708
6815
|
}
|
|
6709
6816
|
async addPathGenerator(name, generator) {
|
|
6710
|
-
|
|
6817
|
+
this.plugins.addPathGenerator(name, generator);
|
|
6711
6818
|
await this.refresh();
|
|
6712
6819
|
}
|
|
6713
6820
|
async addInteractor(name, interactorInitializer) {
|
|
6714
|
-
|
|
6821
|
+
this.plugins.addInteractor(name, interactorInitializer);
|
|
6715
6822
|
await this.refresh();
|
|
6716
6823
|
}
|
|
6717
6824
|
async addParticleUpdater(name, updaterInitializer) {
|
|
6718
|
-
|
|
6825
|
+
this.plugins.addParticleUpdater(name, updaterInitializer);
|
|
6719
6826
|
await this.refresh();
|
|
6720
6827
|
}
|
|
6721
6828
|
}
|
|
6722
|
-
_Engine_initialized = new WeakMap;
|
|
6829
|
+
_Engine_initialized = new WeakMap, _Engine_loader = new WeakMap;
|
|
6723
6830
|
const initPjs = engine => {
|
|
6724
6831
|
const particlesJS = (tagId, options) => engine.load(tagId, options);
|
|
6725
6832
|
particlesJS.load = (tagId, pathConfigJson, callback) => {
|