@tsparticles/updater-life 3.0.0-alpha.0 → 3.0.0-beta.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/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # tsParticles Life Updater
4
4
 
5
- [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/tsparticles-updater-life/badge)](https://www.jsdelivr.com/package/npm/tsparticles-updater-life)
6
- [![npmjs](https://badge.fury.io/js/tsparticles-updater-life.svg)](https://www.npmjs.com/package/tsparticles-updater-life)
7
- [![npmjs](https://img.shields.io/npm/dt/tsparticles-updater-life)](https://www.npmjs.com/package/tsparticles-updater-life) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/updater-life/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/updater-life)
6
+ [![npmjs](https://badge.fury.io/js/@tsparticles/updater-life.svg)](https://www.npmjs.com/package/@tsparticles/updater-life)
7
+ [![npmjs](https://img.shields.io/npm/dt/@tsparticles/updater-life)](https://www.npmjs.com/package/@tsparticles/updater-life) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
8
8
 
9
9
  [tsParticles](https://github.com/matteobruni/tsparticles) updater plugin for life animations.
10
10
 
@@ -26,7 +26,7 @@ Once the scripts are loaded you can set up `tsParticles` and the updater plugin
26
26
 
27
27
  ```javascript
28
28
  (async () => {
29
- await loadLifeUpdater();
29
+ await loadLifeUpdater(tsParticles);
30
30
 
31
31
  await tsParticles.load({
32
32
  id: "tsparticles",
@@ -42,29 +42,33 @@ Once the scripts are loaded you can set up `tsParticles` and the updater plugin
42
42
  This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
43
43
 
44
44
  ```shell
45
- $ npm install tsparticles-updater-life
45
+ $ npm install @tsparticles/updater-life
46
46
  ```
47
47
 
48
48
  or
49
49
 
50
50
  ```shell
51
- $ yarn add tsparticles-updater-life
51
+ $ yarn add @tsparticles/updater-life
52
52
  ```
53
53
 
54
54
  Then you need to import it in the app, like this:
55
55
 
56
56
  ```javascript
57
- const { tsParticles } = require("tsparticles-engine");
58
- const { loadLifeUpdater } = require("tsparticles-updater-life");
57
+ const { tsParticles } = require("@tsparticles/engine");
58
+ const { loadLifeUpdater } = require("@tsparticles/updater-life");
59
59
 
60
- loadLifeUpdater(tsParticles);
60
+ (async () => {
61
+ await loadLifeUpdater(tsParticles);
62
+ })();
61
63
  ```
62
64
 
63
65
  or
64
66
 
65
67
  ```javascript
66
- import { tsParticles } from "tsparticles-engine";
67
- import { loadLifeUpdater } from "tsparticles-updater-life";
68
+ import { tsParticles } from "@tsparticles/engine";
69
+ import { loadLifeUpdater } from "@tsparticles/updater-life";
68
70
 
69
- loadLifeUpdater(tsParticles);
71
+ (async () => {
72
+ await loadLifeUpdater(tsParticles);
73
+ })();
70
74
  ```
@@ -1,4 +1,4 @@
1
- import { getRandom, getRangeValue, randomInRange, setRangeValue } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, randomInRange, setRangeValue, } from "@tsparticles/engine";
2
2
  import { Life } from "./Options/Classes/Life";
3
3
  export class LifeUpdater {
4
4
  constructor(container) {
@@ -42,7 +42,7 @@ export class LifeUpdater {
42
42
  options.life = new Life();
43
43
  }
44
44
  for (const source of sources) {
45
- options.life.load(source === null || source === void 0 ? void 0 : source.life);
45
+ options.life.load(source?.life);
46
46
  }
47
47
  }
48
48
  update(particle, delta) {
@@ -0,0 +1 @@
1
+ export {};
package/browser/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { LifeUpdater } from "./LifeUpdater";
2
- export async function loadLifeUpdater(engine) {
3
- await engine.addParticleUpdater("life", (container) => new LifeUpdater(container));
2
+ export async function loadLifeUpdater(engine, refresh = true) {
3
+ await engine.addParticleUpdater("life", (container) => new LifeUpdater(container), refresh);
4
4
  }
@@ -45,7 +45,7 @@ class LifeUpdater {
45
45
  options.life = new Life_1.Life();
46
46
  }
47
47
  for (const source of sources) {
48
- options.life.load(source === null || source === void 0 ? void 0 : source.life);
48
+ options.life.load(source?.life);
49
49
  }
50
50
  }
51
51
  update(particle, delta) {
package/cjs/Types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/index.js CHANGED
@@ -1,19 +1,8 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.loadLifeUpdater = void 0;
13
4
  const LifeUpdater_1 = require("./LifeUpdater");
14
- function loadLifeUpdater(engine) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- yield engine.addParticleUpdater("life", (container) => new LifeUpdater_1.LifeUpdater(container));
17
- });
5
+ async function loadLifeUpdater(engine, refresh = true) {
6
+ await engine.addParticleUpdater("life", (container) => new LifeUpdater_1.LifeUpdater(container), refresh);
18
7
  }
19
8
  exports.loadLifeUpdater = loadLifeUpdater;
@@ -1,4 +1,4 @@
1
- import { getRandom, getRangeValue, randomInRange, setRangeValue } from "@tsparticles/engine";
1
+ import { getRandom, getRangeValue, randomInRange, setRangeValue, } from "@tsparticles/engine";
2
2
  import { Life } from "./Options/Classes/Life";
3
3
  export class LifeUpdater {
4
4
  constructor(container) {
@@ -42,7 +42,7 @@ export class LifeUpdater {
42
42
  options.life = new Life();
43
43
  }
44
44
  for (const source of sources) {
45
- options.life.load(source === null || source === void 0 ? void 0 : source.life);
45
+ options.life.load(source?.life);
46
46
  }
47
47
  }
48
48
  update(particle, delta) {
package/esm/Types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { LifeUpdater } from "./LifeUpdater";
2
- export async function loadLifeUpdater(engine) {
3
- await engine.addParticleUpdater("life", (container) => new LifeUpdater(container));
2
+ export async function loadLifeUpdater(engine, refresh = true) {
3
+ await engine.addParticleUpdater("life", (container) => new LifeUpdater(container), refresh);
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-life",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-beta.0",
4
4
  "description": "tsParticles particles life updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -73,10 +73,11 @@
73
73
  "unpkg": "tsparticles.updater.life.min.js",
74
74
  "module": "esm/index.js",
75
75
  "types": "types/index.d.ts",
76
+ "sideEffects": false,
77
+ "dependencies": {
78
+ "@tsparticles/engine": "^3.0.0-beta.0"
79
+ },
76
80
  "publishConfig": {
77
81
  "access": "public"
78
- },
79
- "dependencies": {
80
- "@tsparticles/engine": "^3.0.0-alpha.0"
81
82
  }
82
- }
83
+ }