@tsparticles/shape-arrow 3.9.1 → 4.0.0-alpha.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/643.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 643.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_shape_arrow=this.webpackChunk_tsparticles_shape_arrow||[]).push([[643],{643(a,t,h){h.d(t,{ArrowDrawer:()=>l});var e=h(303);const o=e.half,i=e.half;class l{constructor(){this.validTypes=["arrow"]}draw(a){!function(a){const{context:t,particle:h,radius:l}=a,r=l*e.double,n=r*(h.heightFactor??o),c=r*(h.headWidthFactor??.2),s=n*(h.bodyHeightFactor??i);t.moveTo(-r*e.half,e.originPoint.y),t.lineTo(-r*e.half,-s*e.half),t.lineTo(r*e.half-c,-s*e.half),t.lineTo(r*e.half-c,-n*e.half),t.lineTo(r*e.half+c,e.originPoint.y),t.lineTo(r*e.half-c,n*e.half),t.lineTo(r*e.half-c,s*e.half),t.lineTo(-r*e.half,s*e.half),t.lineTo(-r*e.half,e.originPoint.y)}(a)}particleInit(a,t){const h=t.shapeData;t.heightFactor=(0,e.getRangeValue)(h?.heightFactor??.5),t.headWidthFactor=(0,e.getRangeValue)(h?.headWidthFactor??.2),t.bodyHeightFactor=(0,e.getRangeValue)(h?.bodyHeightFactor??.5)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Arrow Shape v4.0.0-alpha.0 by Matteo Bruni */
@@ -8,7 +8,7 @@ export class ArrowDrawer {
8
8
  draw(data) {
9
9
  drawArrow(data);
10
10
  }
11
- particleInit(container, particle) {
11
+ particleInit(_container, particle) {
12
12
  const shapeData = particle.shapeData;
13
13
  particle.heightFactor = getRangeValue(shapeData?.heightFactor ?? defaultHeightFactor);
14
14
  particle.headWidthFactor = getRangeValue(shapeData?.headWidthFactor ?? defaultHeadWidthFactor);
package/browser/Utils.js CHANGED
@@ -1,16 +1,14 @@
1
- const double = 2, defaultHeightFactor = 0.5, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = 0.5, half = 0.5, origin = {
2
- x: 0,
3
- y: 0,
4
- };
1
+ import { double, half, originPoint } from "@tsparticles/engine";
2
+ const defaultHeightFactor = half, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = half;
5
3
  export function drawArrow(data) {
6
4
  const { context, particle, radius } = data, width = radius * double, heightFactor = particle.heightFactor ?? defaultHeightFactor, headWidthFactor = particle.headWidthFactor ?? defaultHeadWidthFactor, bodyHeightFactor = particle.bodyHeightFactor ?? defaultBodyHeightFactor, height = width * heightFactor, headWidth = width * headWidthFactor, bodyHeight = height * bodyHeightFactor;
7
- context.moveTo(-width * half, origin.y);
5
+ context.moveTo(-width * half, originPoint.y);
8
6
  context.lineTo(-width * half, -bodyHeight * half);
9
7
  context.lineTo(width * half - headWidth, -bodyHeight * half);
10
8
  context.lineTo(width * half - headWidth, -height * half);
11
- context.lineTo(width * half + headWidth, origin.y);
9
+ context.lineTo(width * half + headWidth, originPoint.y);
12
10
  context.lineTo(width * half - headWidth, height * half);
13
11
  context.lineTo(width * half - headWidth, bodyHeight * half);
14
12
  context.lineTo(-width * half, bodyHeight * half);
15
- context.lineTo(-width * half, origin.y);
13
+ context.lineTo(-width * half, originPoint.y);
16
14
  }
package/browser/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { ArrowDrawer } from "./ArrowDrawer.js";
2
- export async function loadArrowShape(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addShape(new ArrowDrawer(), refresh);
1
+ export function loadArrowShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(async (e) => {
4
+ const { ArrowDrawer } = await import("./ArrowDrawer.js");
5
+ e.addShape(new ArrowDrawer());
6
+ });
5
7
  }
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArrowDrawer = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- const Utils_js_1 = require("./Utils.js");
1
+ import { getRangeValue } from "@tsparticles/engine";
2
+ import { drawArrow } from "./Utils.js";
6
3
  const defaultHeightFactor = 0.5, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = 0.5;
7
- class ArrowDrawer {
4
+ export class ArrowDrawer {
8
5
  constructor() {
9
6
  this.validTypes = ["arrow"];
10
7
  }
11
8
  draw(data) {
12
- (0, Utils_js_1.drawArrow)(data);
9
+ drawArrow(data);
13
10
  }
14
- particleInit(container, particle) {
11
+ particleInit(_container, particle) {
15
12
  const shapeData = particle.shapeData;
16
- particle.heightFactor = (0, engine_1.getRangeValue)(shapeData?.heightFactor ?? defaultHeightFactor);
17
- particle.headWidthFactor = (0, engine_1.getRangeValue)(shapeData?.headWidthFactor ?? defaultHeadWidthFactor);
18
- particle.bodyHeightFactor = (0, engine_1.getRangeValue)(shapeData?.bodyHeightFactor ?? defaultBodyHeightFactor);
13
+ particle.heightFactor = getRangeValue(shapeData?.heightFactor ?? defaultHeightFactor);
14
+ particle.headWidthFactor = getRangeValue(shapeData?.headWidthFactor ?? defaultHeadWidthFactor);
15
+ particle.bodyHeightFactor = getRangeValue(shapeData?.bodyHeightFactor ?? defaultBodyHeightFactor);
19
16
  }
20
17
  }
21
- exports.ArrowDrawer = ArrowDrawer;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/IArrowData.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/Utils.js CHANGED
@@ -1,19 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drawArrow = drawArrow;
4
- const double = 2, defaultHeightFactor = 0.5, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = 0.5, half = 0.5, origin = {
5
- x: 0,
6
- y: 0,
7
- };
8
- function drawArrow(data) {
1
+ import { double, half, originPoint } from "@tsparticles/engine";
2
+ const defaultHeightFactor = half, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = half;
3
+ export function drawArrow(data) {
9
4
  const { context, particle, radius } = data, width = radius * double, heightFactor = particle.heightFactor ?? defaultHeightFactor, headWidthFactor = particle.headWidthFactor ?? defaultHeadWidthFactor, bodyHeightFactor = particle.bodyHeightFactor ?? defaultBodyHeightFactor, height = width * heightFactor, headWidth = width * headWidthFactor, bodyHeight = height * bodyHeightFactor;
10
- context.moveTo(-width * half, origin.y);
5
+ context.moveTo(-width * half, originPoint.y);
11
6
  context.lineTo(-width * half, -bodyHeight * half);
12
7
  context.lineTo(width * half - headWidth, -bodyHeight * half);
13
8
  context.lineTo(width * half - headWidth, -height * half);
14
- context.lineTo(width * half + headWidth, origin.y);
9
+ context.lineTo(width * half + headWidth, originPoint.y);
15
10
  context.lineTo(width * half - headWidth, height * half);
16
11
  context.lineTo(width * half - headWidth, bodyHeight * half);
17
12
  context.lineTo(-width * half, bodyHeight * half);
18
- context.lineTo(-width * half, origin.y);
13
+ context.lineTo(-width * half, originPoint.y);
19
14
  }
package/cjs/index.js CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadArrowShape = loadArrowShape;
4
- const ArrowDrawer_js_1 = require("./ArrowDrawer.js");
5
- async function loadArrowShape(engine, refresh = true) {
6
- engine.checkVersion("3.9.1");
7
- await engine.addShape(new ArrowDrawer_js_1.ArrowDrawer(), refresh);
1
+ export function loadArrowShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(async (e) => {
4
+ const { ArrowDrawer } = await import("./ArrowDrawer.js");
5
+ e.addShape(new ArrowDrawer());
6
+ });
8
7
  }
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.0
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_shape_arrow"] = this["webpackChunk_tsparticles_shape_arrow"] || []).push([["dist_browser_ArrowDrawer_js"],{
19
+
20
+ /***/ "./dist/browser/ArrowDrawer.js"
21
+ /*!*************************************!*\
22
+ !*** ./dist/browser/ArrowDrawer.js ***!
23
+ \*************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ArrowDrawer: () => (/* binding */ ArrowDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nconst defaultHeightFactor = 0.5,\n defaultHeadWidthFactor = 0.2,\n defaultBodyHeightFactor = 0.5;\nclass ArrowDrawer {\n constructor() {\n this.validTypes = [\"arrow\"];\n }\n draw(data) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawArrow)(data);\n }\n particleInit(_container, particle) {\n const shapeData = particle.shapeData;\n particle.heightFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.heightFactor ?? defaultHeightFactor);\n particle.headWidthFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.headWidthFactor ?? defaultHeadWidthFactor);\n particle.bodyHeightFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.bodyHeightFactor ?? defaultBodyHeightFactor);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-arrow/./dist/browser/ArrowDrawer.js?\n}");
27
+
28
+ /***/ },
29
+
30
+ /***/ "./dist/browser/Utils.js"
31
+ /*!*******************************!*\
32
+ !*** ./dist/browser/Utils.js ***!
33
+ \*******************************/
34
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
+
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawArrow: () => (/* binding */ drawArrow)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultHeightFactor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half,\n defaultHeadWidthFactor = 0.2,\n defaultBodyHeightFactor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half;\nfunction drawArrow(data) {\n const {\n context,\n particle,\n radius\n } = data,\n width = radius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double,\n heightFactor = particle.heightFactor ?? defaultHeightFactor,\n headWidthFactor = particle.headWidthFactor ?? defaultHeadWidthFactor,\n bodyHeightFactor = particle.bodyHeightFactor ?? defaultBodyHeightFactor,\n height = width * heightFactor,\n headWidth = width * headWidthFactor,\n bodyHeight = height * bodyHeightFactor;\n context.moveTo(-width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y);\n context.lineTo(-width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, -bodyHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n context.lineTo(width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half - headWidth, -bodyHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n context.lineTo(width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half - headWidth, -height * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n context.lineTo(width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half + headWidth, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y);\n context.lineTo(width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half - headWidth, height * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n context.lineTo(width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half - headWidth, bodyHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n context.lineTo(-width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, bodyHeight * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half);\n context.lineTo(-width * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.originPoint.y);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-arrow/./dist/browser/Utils.js?\n}");
37
+
38
+ /***/ }
39
+
40
+ }]);
@@ -8,7 +8,7 @@ export class ArrowDrawer {
8
8
  draw(data) {
9
9
  drawArrow(data);
10
10
  }
11
- particleInit(container, particle) {
11
+ particleInit(_container, particle) {
12
12
  const shapeData = particle.shapeData;
13
13
  particle.heightFactor = getRangeValue(shapeData?.heightFactor ?? defaultHeightFactor);
14
14
  particle.headWidthFactor = getRangeValue(shapeData?.headWidthFactor ?? defaultHeadWidthFactor);
package/esm/Utils.js CHANGED
@@ -1,16 +1,14 @@
1
- const double = 2, defaultHeightFactor = 0.5, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = 0.5, half = 0.5, origin = {
2
- x: 0,
3
- y: 0,
4
- };
1
+ import { double, half, originPoint } from "@tsparticles/engine";
2
+ const defaultHeightFactor = half, defaultHeadWidthFactor = 0.2, defaultBodyHeightFactor = half;
5
3
  export function drawArrow(data) {
6
4
  const { context, particle, radius } = data, width = radius * double, heightFactor = particle.heightFactor ?? defaultHeightFactor, headWidthFactor = particle.headWidthFactor ?? defaultHeadWidthFactor, bodyHeightFactor = particle.bodyHeightFactor ?? defaultBodyHeightFactor, height = width * heightFactor, headWidth = width * headWidthFactor, bodyHeight = height * bodyHeightFactor;
7
- context.moveTo(-width * half, origin.y);
5
+ context.moveTo(-width * half, originPoint.y);
8
6
  context.lineTo(-width * half, -bodyHeight * half);
9
7
  context.lineTo(width * half - headWidth, -bodyHeight * half);
10
8
  context.lineTo(width * half - headWidth, -height * half);
11
- context.lineTo(width * half + headWidth, origin.y);
9
+ context.lineTo(width * half + headWidth, originPoint.y);
12
10
  context.lineTo(width * half - headWidth, height * half);
13
11
  context.lineTo(width * half - headWidth, bodyHeight * half);
14
12
  context.lineTo(-width * half, bodyHeight * half);
15
- context.lineTo(-width * half, origin.y);
13
+ context.lineTo(-width * half, originPoint.y);
16
14
  }
package/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { ArrowDrawer } from "./ArrowDrawer.js";
2
- export async function loadArrowShape(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addShape(new ArrowDrawer(), refresh);
1
+ export function loadArrowShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.0");
3
+ engine.register(async (e) => {
4
+ const { ArrowDrawer } = await import("./ArrowDrawer.js");
5
+ e.addShape(new ArrowDrawer());
6
+ });
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-arrow",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.0",
4
4
  "description": "tsParticles arrow shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,9 +100,10 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "3.9.1"
103
+ "@tsparticles/engine": "4.0.0-alpha.0"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"
107
- }
107
+ },
108
+ "type": "module"
108
109
  }