@tsparticles/shape-circle 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 Circle Shape
4
4
 
5
- [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/tsparticles-shape-circle/badge)](https://www.jsdelivr.com/package/npm/tsparticles-shape-circle)
6
- [![npmjs](https://badge.fury.io/js/tsparticles-shape-circle.svg)](https://www.npmjs.com/package/tsparticles-shape-circle)
7
- [![npmjs](https://img.shields.io/npm/dt/tsparticles-shape-circle)](https://www.npmjs.com/package/tsparticles-shape-circle) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/shape-circle/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/shape-circle)
6
+ [![npmjs](https://badge.fury.io/js/@tsparticles/shape-circle.svg)](https://www.npmjs.com/package/@tsparticles/shape-circle)
7
+ [![npmjs](https://img.shields.io/npm/dt/@tsparticles/shape-circle)](https://www.npmjs.com/package/@tsparticles/shape-circle) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
8
8
 
9
9
  [tsParticles](https://github.com/matteobruni/tsparticles) additional circle shape.
10
10
 
@@ -26,7 +26,7 @@ Once the scripts are loaded you can set up `tsParticles` and the shape like this
26
26
 
27
27
  ```javascript
28
28
  (async () => {
29
- await loadCircleShape();
29
+ await loadCircleShape(tsParticles);
30
30
 
31
31
  await tsParticles.load({
32
32
  id: "tsparticles",
@@ -43,29 +43,33 @@ Once the scripts are loaded you can set up `tsParticles` and the shape like this
43
43
  This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
44
44
 
45
45
  ```shell
46
- $ npm install tsparticles-shape-circle
46
+ $ npm install @tsparticles/shape-circle
47
47
  ```
48
48
 
49
49
  or
50
50
 
51
51
  ```shell
52
- $ yarn add tsparticles-shape-circle
52
+ $ yarn add @tsparticles/shape-circle
53
53
  ```
54
54
 
55
55
  Then you need to import it in the app, like this:
56
56
 
57
57
  ```javascript
58
- const { tsParticles } = require("tsparticles-engine");
59
- const { loadCircleShape } = require("tsparticles-shape-circle");
58
+ const { tsParticles } = require("@tsparticles/engine");
59
+ const { loadCircleShape } = require("@tsparticles/shape-circle");
60
60
 
61
- loadCircleShape(tsParticles);
61
+ (async () => {
62
+ await loadCircleShape(tsParticles);
63
+ })();
62
64
  ```
63
65
 
64
66
  or
65
67
 
66
68
  ```javascript
67
- import { tsParticles } from "tsparticles-engine";
68
- import { loadCircleShape } from "tsparticles-shape-circle";
69
+ import { tsParticles } from "@tsparticles/engine";
70
+ import { loadCircleShape } from "@tsparticles/shape-circle";
69
71
 
70
- loadCircleShape(tsParticles);
72
+ (async () => {
73
+ await loadCircleShape(tsParticles);
74
+ })();
71
75
  ```
@@ -1,3 +1,4 @@
1
+ import { isObject } from "@tsparticles/engine";
1
2
  export class CircleDrawer {
2
3
  draw(context, particle, radius) {
3
4
  if (!particle.circleRange) {
@@ -10,17 +11,15 @@ export class CircleDrawer {
10
11
  return 12;
11
12
  }
12
13
  particleInit(container, particle) {
13
- var _a;
14
- const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
14
+ const shapeData = particle.shapeData, angle = shapeData?.angle ?? {
15
15
  max: 360,
16
16
  min: 0,
17
17
  };
18
- particle.circleRange =
19
- typeof angle !== "object"
20
- ? {
21
- min: 0,
22
- max: (angle * Math.PI) / 180,
23
- }
24
- : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
18
+ particle.circleRange = !isObject(angle)
19
+ ? {
20
+ min: 0,
21
+ max: (angle * Math.PI) / 180,
22
+ }
23
+ : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
25
24
  }
26
25
  }
package/browser/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { CircleDrawer } from "./CircleDrawer";
2
- export async function loadCircleShape(engine) {
3
- await engine.addShape("circle", new CircleDrawer());
2
+ export async function loadCircleShape(engine, refresh = true) {
3
+ await engine.addShape("circle", new CircleDrawer(), refresh);
4
4
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CircleDrawer = void 0;
4
+ const engine_1 = require("@tsparticles/engine");
4
5
  class CircleDrawer {
5
6
  draw(context, particle, radius) {
6
7
  if (!particle.circleRange) {
@@ -13,18 +14,16 @@ class CircleDrawer {
13
14
  return 12;
14
15
  }
15
16
  particleInit(container, particle) {
16
- var _a;
17
- const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
17
+ const shapeData = particle.shapeData, angle = shapeData?.angle ?? {
18
18
  max: 360,
19
19
  min: 0,
20
20
  };
21
- particle.circleRange =
22
- typeof angle !== "object"
23
- ? {
24
- min: 0,
25
- max: (angle * Math.PI) / 180,
26
- }
27
- : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
21
+ particle.circleRange = !(0, engine_1.isObject)(angle)
22
+ ? {
23
+ min: 0,
24
+ max: (angle * Math.PI) / 180,
25
+ }
26
+ : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
28
27
  }
29
28
  }
30
29
  exports.CircleDrawer = CircleDrawer;
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.loadCircleShape = void 0;
13
4
  const CircleDrawer_1 = require("./CircleDrawer");
14
- function loadCircleShape(engine) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- yield engine.addShape("circle", new CircleDrawer_1.CircleDrawer());
17
- });
5
+ async function loadCircleShape(engine, refresh = true) {
6
+ await engine.addShape("circle", new CircleDrawer_1.CircleDrawer(), refresh);
18
7
  }
19
8
  exports.loadCircleShape = loadCircleShape;
@@ -1,3 +1,4 @@
1
+ import { isObject } from "@tsparticles/engine";
1
2
  export class CircleDrawer {
2
3
  draw(context, particle, radius) {
3
4
  if (!particle.circleRange) {
@@ -10,17 +11,15 @@ export class CircleDrawer {
10
11
  return 12;
11
12
  }
12
13
  particleInit(container, particle) {
13
- var _a;
14
- const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
14
+ const shapeData = particle.shapeData, angle = shapeData?.angle ?? {
15
15
  max: 360,
16
16
  min: 0,
17
17
  };
18
- particle.circleRange =
19
- typeof angle !== "object"
20
- ? {
21
- min: 0,
22
- max: (angle * Math.PI) / 180,
23
- }
24
- : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
18
+ particle.circleRange = !isObject(angle)
19
+ ? {
20
+ min: 0,
21
+ max: (angle * Math.PI) / 180,
22
+ }
23
+ : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
25
24
  }
26
25
  }
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { CircleDrawer } from "./CircleDrawer";
2
- export async function loadCircleShape(engine) {
3
- await engine.addShape("circle", new CircleDrawer());
2
+ export async function loadCircleShape(engine, refresh = true) {
3
+ await engine.addShape("circle", new CircleDrawer(), refresh);
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-circle",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-beta.0",
4
4
  "description": "tsParticles circle shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -45,10 +45,11 @@
45
45
  "unpkg": "tsparticles.shape.circle.min.js",
46
46
  "module": "esm/index.js",
47
47
  "types": "types/index.d.ts",
48
+ "sideEffects": false,
49
+ "dependencies": {
50
+ "@tsparticles/engine": "^3.0.0-beta.0"
51
+ },
48
52
  "publishConfig": {
49
53
  "access": "public"
50
- },
51
- "dependencies": {
52
- "@tsparticles/engine": "^3.0.0-alpha.0"
53
54
  }
54
- }
55
+ }