@tsparticles/updater-life 3.0.0-alpha.1 → 3.0.0-beta.1

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,5 +1,5 @@
1
- import { getRandom, getRangeValue, randomInRange, setRangeValue } from "@tsparticles/engine";
2
- import { Life } from "./Options/Classes/Life";
1
+ import { getRandom, getRangeValue, randomInRange, setRangeValue, } from "@tsparticles/engine";
2
+ import { Life } from "./Options/Classes/Life.js";
3
3
  export class LifeUpdater {
4
4
  constructor(container) {
5
5
  this.container = 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) {
@@ -1,5 +1,5 @@
1
- import { LifeDelay } from "./LifeDelay";
2
- import { LifeDuration } from "./LifeDuration";
1
+ import { LifeDelay } from "./LifeDelay.js";
2
+ import { LifeDuration } from "./LifeDuration.js";
3
3
  export class Life {
4
4
  constructor() {
5
5
  this.count = 0;
@@ -0,0 +1 @@
1
+ export {};
package/browser/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LifeUpdater } from "./LifeUpdater";
2
- export async function loadLifeUpdater(engine) {
3
- await engine.addParticleUpdater("life", (container) => new LifeUpdater(container));
1
+ import { LifeUpdater } from "./LifeUpdater.js";
2
+ export async function loadLifeUpdater(engine, refresh = true) {
3
+ await engine.addParticleUpdater("life", (container) => new LifeUpdater(container), refresh);
4
4
  }
@@ -0,0 +1 @@
1
+ { "type": "module" }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LifeUpdater = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const Life_1 = require("./Options/Classes/Life");
5
+ const Life_js_1 = require("./Options/Classes/Life.js");
6
6
  class LifeUpdater {
7
7
  constructor(container) {
8
8
  this.container = container;
@@ -42,10 +42,10 @@ class LifeUpdater {
42
42
  }
43
43
  loadOptions(options, ...sources) {
44
44
  if (!options.life) {
45
- options.life = new Life_1.Life();
45
+ options.life = new Life_js_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) {
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Life = void 0;
4
- const LifeDelay_1 = require("./LifeDelay");
5
- const LifeDuration_1 = require("./LifeDuration");
4
+ const LifeDelay_js_1 = require("./LifeDelay.js");
5
+ const LifeDuration_js_1 = require("./LifeDuration.js");
6
6
  class Life {
7
7
  constructor() {
8
8
  this.count = 0;
9
- this.delay = new LifeDelay_1.LifeDelay();
10
- this.duration = new LifeDuration_1.LifeDuration();
9
+ this.delay = new LifeDelay_js_1.LifeDelay();
10
+ this.duration = new LifeDuration_js_1.LifeDuration();
11
11
  }
12
12
  load(data) {
13
13
  if (!data) {
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
- 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
- });
4
+ const LifeUpdater_js_1 = require("./LifeUpdater.js");
5
+ async function loadLifeUpdater(engine, refresh = true) {
6
+ await engine.addParticleUpdater("life", (container) => new LifeUpdater_js_1.LifeUpdater(container), refresh);
18
7
  }
19
8
  exports.loadLifeUpdater = loadLifeUpdater;
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }
@@ -1,5 +1,5 @@
1
- import { getRandom, getRangeValue, randomInRange, setRangeValue } from "@tsparticles/engine";
2
- import { Life } from "./Options/Classes/Life";
1
+ import { getRandom, getRangeValue, randomInRange, setRangeValue, } from "@tsparticles/engine";
2
+ import { Life } from "./Options/Classes/Life.js";
3
3
  export class LifeUpdater {
4
4
  constructor(container) {
5
5
  this.container = 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) {
@@ -1,5 +1,5 @@
1
- import { LifeDelay } from "./LifeDelay";
2
- import { LifeDuration } from "./LifeDuration";
1
+ import { LifeDelay } from "./LifeDelay.js";
2
+ import { LifeDuration } from "./LifeDuration.js";
3
3
  export class Life {
4
4
  constructor() {
5
5
  this.count = 0;
package/esm/Types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LifeUpdater } from "./LifeUpdater";
2
- export async function loadLifeUpdater(engine) {
3
- await engine.addParticleUpdater("life", (container) => new LifeUpdater(container));
1
+ import { LifeUpdater } from "./LifeUpdater.js";
2
+ export async function loadLifeUpdater(engine, refresh = true) {
3
+ await engine.addParticleUpdater("life", (container) => new LifeUpdater(container), refresh);
4
4
  }
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/updater-life",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "tsParticles particles life updater",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -68,15 +68,28 @@
68
68
  "bugs": {
69
69
  "url": "https://github.com/matteobruni/tsparticles/issues"
70
70
  },
71
- "main": "cjs/index.js",
71
+ "sideEffects": false,
72
72
  "jsdelivr": "tsparticles.updater.life.min.js",
73
73
  "unpkg": "tsparticles.updater.life.min.js",
74
+ "browser": "browser/index.js",
75
+ "main": "cjs/index.js",
74
76
  "module": "esm/index.js",
75
77
  "types": "types/index.d.ts",
76
- "publishConfig": {
77
- "access": "public"
78
+ "exports": {
79
+ ".": {
80
+ "types": "./types/index.d.ts",
81
+ "browser": "./browser/index.js",
82
+ "import": "./esm/index.js",
83
+ "require": "./cjs/index.js",
84
+ "umd": "./umd/index.js",
85
+ "default": "./cjs/index.js"
86
+ },
87
+ "./package.json": "./package.json"
78
88
  },
79
89
  "dependencies": {
80
- "@tsparticles/engine": "^3.0.0-alpha.1"
90
+ "@tsparticles/engine": "^3.0.0-beta.1"
91
+ },
92
+ "publishConfig": {
93
+ "access": "public"
81
94
  }
82
- }
95
+ }