@tsparticles/particles 4.0.0-beta.12 → 4.0.0-beta.16

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.
@@ -6,7 +6,7 @@ import { loadParticlesCollisionsInteraction } from "@tsparticles/interaction-par
6
6
  import { loadParticlesLinksInteraction } from "@tsparticles/interaction-particles-links";
7
7
  let initPromise = null;
8
8
  async function doInitPlugins(engine) {
9
- engine.checkVersion("4.0.0-beta.12");
9
+ engine.checkVersion("4.0.0-beta.16");
10
10
  await engine.pluginManager.register(async (e) => {
11
11
  const loadParticlesInteractivity = async (e) => {
12
12
  await loadInteractivityPlugin(e);
@@ -43,11 +43,11 @@ export async function particles(idOrOptions, sourceOptions) {
43
43
  }
44
44
  particles.create = async (canvas, options) => {
45
45
  await initPlugins(tsParticles);
46
- const id = canvas.id || "particles";
47
- return getParticlesInstance(tsParticles, id, options ?? {}, canvas);
46
+ const id = canvas?.id ?? "particles";
47
+ return getParticlesInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
48
48
  };
49
49
  particles.init = async () => {
50
50
  await initPlugins(tsParticles);
51
51
  };
52
- particles.version = "4.0.0-beta.12";
52
+ particles.version = "4.0.0-beta.16";
53
53
  globalThis.particles = particles;
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
2
  import { getParticlesInstance } from "./utils.js";
3
3
  let initPromise = null;
4
4
  async function doInitPlugins(engine) {
5
- engine.checkVersion("4.0.0-beta.12");
5
+ engine.checkVersion("4.0.0-beta.16");
6
6
  await engine.pluginManager.register(async (e) => {
7
7
  const [{ loadBasic }, { loadInteractivityPlugin }, { loadParticlesCollisionsInteraction }, { loadParticlesLinksInteraction },] = await Promise.all([
8
8
  import("@tsparticles/basic/lazy"),
@@ -44,11 +44,11 @@ export async function particles(idOrOptions, sourceOptions) {
44
44
  }
45
45
  particles.create = async (canvas, options) => {
46
46
  await initPlugins(tsParticles);
47
- const id = canvas.id || "particles";
48
- return getParticlesInstance(tsParticles, id, options ?? {}, canvas);
47
+ const id = canvas?.id ?? "particles";
48
+ return getParticlesInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
49
49
  };
50
50
  particles.init = async () => {
51
51
  await initPlugins(tsParticles);
52
52
  };
53
- particles.version = "4.0.0-beta.12";
53
+ particles.version = "4.0.0-beta.16";
54
54
  globalThis.particles = particles;
package/browser/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  const instances = new Map(), defaultCount = 80, defaultLinksWidth = 100, defaultSpeed = 3, defaultOpacity = 1, defaultRadius = 3;
2
- function getDefaultOptions(options) {
2
+ function getDefaultOptions(options, canvas) {
3
3
  return {
4
+ fullScreen: {
5
+ enable: !canvas,
6
+ },
4
7
  particles: {
5
8
  number: {
6
9
  value: options.count ?? defaultCount,
@@ -41,7 +44,7 @@ export async function getParticlesInstance(engine, id, sourceOptions, canvas) {
41
44
  return existing;
42
45
  }
43
46
  const create = async () => {
44
- const particlesOptions = getDefaultOptions(sourceOptions), container = await engine.load({ id, element: canvas, options: particlesOptions });
47
+ const particlesOptions = getDefaultOptions(sourceOptions, canvas), container = await engine.load({ id, element: canvas, options: particlesOptions });
45
48
  if (!container) {
46
49
  instances.delete(id);
47
50
  return;
package/cjs/particles.js CHANGED
@@ -6,7 +6,7 @@ import { loadParticlesCollisionsInteraction } from "@tsparticles/interaction-par
6
6
  import { loadParticlesLinksInteraction } from "@tsparticles/interaction-particles-links";
7
7
  let initPromise = null;
8
8
  async function doInitPlugins(engine) {
9
- engine.checkVersion("4.0.0-beta.12");
9
+ engine.checkVersion("4.0.0-beta.16");
10
10
  await engine.pluginManager.register(async (e) => {
11
11
  const loadParticlesInteractivity = async (e) => {
12
12
  await loadInteractivityPlugin(e);
@@ -43,11 +43,11 @@ export async function particles(idOrOptions, sourceOptions) {
43
43
  }
44
44
  particles.create = async (canvas, options) => {
45
45
  await initPlugins(tsParticles);
46
- const id = canvas.id || "particles";
47
- return getParticlesInstance(tsParticles, id, options ?? {}, canvas);
46
+ const id = canvas?.id ?? "particles";
47
+ return getParticlesInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
48
48
  };
49
49
  particles.init = async () => {
50
50
  await initPlugins(tsParticles);
51
51
  };
52
- particles.version = "4.0.0-beta.12";
52
+ particles.version = "4.0.0-beta.16";
53
53
  globalThis.particles = particles;
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
2
  import { getParticlesInstance } from "./utils.js";
3
3
  let initPromise = null;
4
4
  async function doInitPlugins(engine) {
5
- engine.checkVersion("4.0.0-beta.12");
5
+ engine.checkVersion("4.0.0-beta.16");
6
6
  await engine.pluginManager.register(async (e) => {
7
7
  const [{ loadBasic }, { loadInteractivityPlugin }, { loadParticlesCollisionsInteraction }, { loadParticlesLinksInteraction },] = await Promise.all([
8
8
  import("@tsparticles/basic/lazy"),
@@ -44,11 +44,11 @@ export async function particles(idOrOptions, sourceOptions) {
44
44
  }
45
45
  particles.create = async (canvas, options) => {
46
46
  await initPlugins(tsParticles);
47
- const id = canvas.id || "particles";
48
- return getParticlesInstance(tsParticles, id, options ?? {}, canvas);
47
+ const id = canvas?.id ?? "particles";
48
+ return getParticlesInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
49
49
  };
50
50
  particles.init = async () => {
51
51
  await initPlugins(tsParticles);
52
52
  };
53
- particles.version = "4.0.0-beta.12";
53
+ particles.version = "4.0.0-beta.16";
54
54
  globalThis.particles = particles;
package/cjs/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  const instances = new Map(), defaultCount = 80, defaultLinksWidth = 100, defaultSpeed = 3, defaultOpacity = 1, defaultRadius = 3;
2
- function getDefaultOptions(options) {
2
+ function getDefaultOptions(options, canvas) {
3
3
  return {
4
+ fullScreen: {
5
+ enable: !canvas,
6
+ },
4
7
  particles: {
5
8
  number: {
6
9
  value: options.count ?? defaultCount,
@@ -41,7 +44,7 @@ export async function getParticlesInstance(engine, id, sourceOptions, canvas) {
41
44
  return existing;
42
45
  }
43
46
  const create = async () => {
44
- const particlesOptions = getDefaultOptions(sourceOptions), container = await engine.load({ id, element: canvas, options: particlesOptions });
47
+ const particlesOptions = getDefaultOptions(sourceOptions, canvas), container = await engine.load({ id, element: canvas, options: particlesOptions });
45
48
  if (!container) {
46
49
  instances.delete(id);
47
50
  return;
package/esm/particles.js CHANGED
@@ -6,7 +6,7 @@ import { loadParticlesCollisionsInteraction } from "@tsparticles/interaction-par
6
6
  import { loadParticlesLinksInteraction } from "@tsparticles/interaction-particles-links";
7
7
  let initPromise = null;
8
8
  async function doInitPlugins(engine) {
9
- engine.checkVersion("4.0.0-beta.12");
9
+ engine.checkVersion("4.0.0-beta.16");
10
10
  await engine.pluginManager.register(async (e) => {
11
11
  const loadParticlesInteractivity = async (e) => {
12
12
  await loadInteractivityPlugin(e);
@@ -43,11 +43,11 @@ export async function particles(idOrOptions, sourceOptions) {
43
43
  }
44
44
  particles.create = async (canvas, options) => {
45
45
  await initPlugins(tsParticles);
46
- const id = canvas.id || "particles";
47
- return getParticlesInstance(tsParticles, id, options ?? {}, canvas);
46
+ const id = canvas?.id ?? "particles";
47
+ return getParticlesInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
48
48
  };
49
49
  particles.init = async () => {
50
50
  await initPlugins(tsParticles);
51
51
  };
52
- particles.version = "4.0.0-beta.12";
52
+ particles.version = "4.0.0-beta.16";
53
53
  globalThis.particles = particles;
@@ -2,7 +2,7 @@ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
2
  import { getParticlesInstance } from "./utils.js";
3
3
  let initPromise = null;
4
4
  async function doInitPlugins(engine) {
5
- engine.checkVersion("4.0.0-beta.12");
5
+ engine.checkVersion("4.0.0-beta.16");
6
6
  await engine.pluginManager.register(async (e) => {
7
7
  const [{ loadBasic }, { loadInteractivityPlugin }, { loadParticlesCollisionsInteraction }, { loadParticlesLinksInteraction },] = await Promise.all([
8
8
  import("@tsparticles/basic/lazy"),
@@ -44,11 +44,11 @@ export async function particles(idOrOptions, sourceOptions) {
44
44
  }
45
45
  particles.create = async (canvas, options) => {
46
46
  await initPlugins(tsParticles);
47
- const id = canvas.id || "particles";
48
- return getParticlesInstance(tsParticles, id, options ?? {}, canvas);
47
+ const id = canvas?.id ?? "particles";
48
+ return getParticlesInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
49
49
  };
50
50
  particles.init = async () => {
51
51
  await initPlugins(tsParticles);
52
52
  };
53
- particles.version = "4.0.0-beta.12";
53
+ particles.version = "4.0.0-beta.16";
54
54
  globalThis.particles = particles;
package/esm/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  const instances = new Map(), defaultCount = 80, defaultLinksWidth = 100, defaultSpeed = 3, defaultOpacity = 1, defaultRadius = 3;
2
- function getDefaultOptions(options) {
2
+ function getDefaultOptions(options, canvas) {
3
3
  return {
4
+ fullScreen: {
5
+ enable: !canvas,
6
+ },
4
7
  particles: {
5
8
  number: {
6
9
  value: options.count ?? defaultCount,
@@ -41,7 +44,7 @@ export async function getParticlesInstance(engine, id, sourceOptions, canvas) {
41
44
  return existing;
42
45
  }
43
46
  const create = async () => {
44
- const particlesOptions = getDefaultOptions(sourceOptions), container = await engine.load({ id, element: canvas, options: particlesOptions });
47
+ const particlesOptions = getDefaultOptions(sourceOptions, canvas), container = await engine.load({ id, element: canvas, options: particlesOptions });
45
48
  if (!container) {
46
49
  instances.delete(id);
47
50
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/particles",
3
- "version": "4.0.0-beta.12",
3
+ "version": "4.0.0-beta.16",
4
4
  "description": "Easily create highly customizable particle animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -40,14 +40,14 @@
40
40
  "./package.json": "./package.json"
41
41
  },
42
42
  "dependencies": {
43
- "@tsparticles/basic": "4.0.0-beta.12",
44
- "@tsparticles/engine": "4.0.0-beta.12",
45
- "@tsparticles/interaction-particles-collisions": "4.0.0-beta.12",
46
- "@tsparticles/interaction-particles-links": "4.0.0-beta.12",
47
- "@tsparticles/plugin-interactivity": "4.0.0-beta.12"
43
+ "@tsparticles/basic": "4.0.0-beta.16",
44
+ "@tsparticles/engine": "4.0.0-beta.16",
45
+ "@tsparticles/interaction-particles-collisions": "4.0.0-beta.16",
46
+ "@tsparticles/interaction-particles-links": "4.0.0-beta.16",
47
+ "@tsparticles/plugin-interactivity": "4.0.0-beta.16"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
52
  "type": "module"
53
- }
53
+ }