@tsparticles/shape-square 4.0.0-alpha.5 → 4.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/48.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_shape_square=this.webpackChunk_tsparticles_shape_square||[]).push([[48],{48(e,s,t){t.d(s,{SquareDrawer:()=>r});var a=t(303);class r{draw(e){!function(e){let{context:s,radius:t}=e,r=t*Math.SQRT1_2,u=r*a.double;s.rect(-r,-r,u,u)}(e)}getSidesCount(){return 4}}}}]);
@@ -1,9 +1,6 @@
1
1
  import { drawSquare } from "./Utils.js";
2
2
  const sides = 4;
3
3
  export class SquareDrawer {
4
- constructor() {
5
- this.validTypes = ["edge", "square"];
6
- }
7
4
  draw(data) {
8
5
  drawSquare(data);
9
6
  }
package/browser/Utils.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { double } from "@tsparticles/engine";
2
- const fixFactorSquared = 2, fixFactor = Math.sqrt(fixFactorSquared);
3
2
  export function drawSquare(data) {
4
- const { context, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * double;
3
+ const { context, radius } = data, fixedRadius = radius * Math.SQRT1_2, fixedDiameter = fixedRadius * double;
5
4
  context.rect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter);
6
5
  }
package/browser/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export async function loadSquareShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
3
- await engine.register(async (e) => {
4
- const { SquareDrawer } = await import("./SquareDrawer.js");
5
- e.addShape(new SquareDrawer());
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(e => {
4
+ e.addShape(["edge", "square"], async () => {
5
+ const { SquareDrawer } = await import("./SquareDrawer.js");
6
+ return new SquareDrawer();
7
+ });
6
8
  });
7
9
  }
@@ -1,9 +1,6 @@
1
1
  import { drawSquare } from "./Utils.js";
2
2
  const sides = 4;
3
3
  export class SquareDrawer {
4
- constructor() {
5
- this.validTypes = ["edge", "square"];
6
- }
7
4
  draw(data) {
8
5
  drawSquare(data);
9
6
  }
package/cjs/Utils.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { double } from "@tsparticles/engine";
2
- const fixFactorSquared = 2, fixFactor = Math.sqrt(fixFactorSquared);
3
2
  export function drawSquare(data) {
4
- const { context, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * double;
3
+ const { context, radius } = data, fixedRadius = radius * Math.SQRT1_2, fixedDiameter = fixedRadius * double;
5
4
  context.rect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter);
6
5
  }
package/cjs/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export async function loadSquareShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
3
- await engine.register(async (e) => {
4
- const { SquareDrawer } = await import("./SquareDrawer.js");
5
- e.addShape(new SquareDrawer());
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(e => {
4
+ e.addShape(["edge", "square"], async () => {
5
+ const { SquareDrawer } = await import("./SquareDrawer.js");
6
+ return new SquareDrawer();
7
+ });
6
8
  });
7
9
  }
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v4.0.0-alpha.5
7
+ * v4.0.0-beta.0
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \**************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SquareDrawer: () => (/* binding */ SquareDrawer)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\nconst sides = 4;\nclass SquareDrawer {\n constructor() {\n this.validTypes = [\"edge\", \"square\"];\n }\n draw(data) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.drawSquare)(data);\n }\n getSidesCount() {\n return sides;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-square/./dist/browser/SquareDrawer.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SquareDrawer: () => (/* binding */ SquareDrawer)\n/* harmony export */ });\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\nconst sides = 4;\nclass SquareDrawer {\n draw(data) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_0__.drawSquare)(data);\n }\n getSidesCount() {\n return sides;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-square/./dist/browser/SquareDrawer.js?\n}");
27
27
 
28
28
  /***/ },
29
29
 
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
33
33
  \*******************************/
34
34
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
35
 
36
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawSquare: () => (/* binding */ drawSquare)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst fixFactorSquared = 2,\n fixFactor = Math.sqrt(fixFactorSquared);\nfunction drawSquare(data) {\n const {\n context,\n radius\n } = data,\n fixedRadius = radius / fixFactor,\n fixedDiameter = fixedRadius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double;\n context.rect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-square/./dist/browser/Utils.js?\n}");
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawSquare: () => (/* binding */ drawSquare)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nfunction drawSquare(data) {\n const { context, radius } = data, fixedRadius = radius * Math.SQRT1_2, fixedDiameter = fixedRadius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double;\n context.rect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter);\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-square/./dist/browser/Utils.js?\n}");
37
37
 
38
38
  /***/ }
39
39
 
@@ -1,9 +1,6 @@
1
1
  import { drawSquare } from "./Utils.js";
2
2
  const sides = 4;
3
3
  export class SquareDrawer {
4
- constructor() {
5
- this.validTypes = ["edge", "square"];
6
- }
7
4
  draw(data) {
8
5
  drawSquare(data);
9
6
  }
package/esm/Utils.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { double } from "@tsparticles/engine";
2
- const fixFactorSquared = 2, fixFactor = Math.sqrt(fixFactorSquared);
3
2
  export function drawSquare(data) {
4
- const { context, radius } = data, fixedRadius = radius / fixFactor, fixedDiameter = fixedRadius * double;
3
+ const { context, radius } = data, fixedRadius = radius * Math.SQRT1_2, fixedDiameter = fixedRadius * double;
5
4
  context.rect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter);
6
5
  }
package/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export async function loadSquareShape(engine) {
2
- engine.checkVersion("4.0.0-alpha.5");
3
- await engine.register(async (e) => {
4
- const { SquareDrawer } = await import("./SquareDrawer.js");
5
- e.addShape(new SquareDrawer());
2
+ engine.checkVersion("4.0.0-beta.0");
3
+ await engine.register(e => {
4
+ e.addShape(["edge", "square"], async () => {
5
+ const { SquareDrawer } = await import("./SquareDrawer.js");
6
+ return new SquareDrawer();
7
+ });
6
8
  });
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-square",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "tsParticles square shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -59,7 +59,7 @@
59
59
  "./package.json": "./package.json"
60
60
  },
61
61
  "dependencies": {
62
- "@tsparticles/engine": "4.0.0-alpha.5"
62
+ "@tsparticles/engine": "4.0.0-beta.0"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public"