@tsparticles/shape-rounded-rect 3.9.1 → 4.0.0-alpha.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/404.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 404.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_shape_rounded_rect=this.webpackChunk_tsparticles_shape_rounded_rect||[]).push([[404],{404(e,t,r){r.d(t,{RoundedRectDrawer:()=>o});var a=r(303);const i=Math.sqrt(2);class o{constructor(){this.validTypes=["rounded-rect"]}draw(e){const{context:t,particle:r,radius:a}=e,o=a/i,c=2*o,d=r.borderRadius??5;"roundRect"in t?t.roundRect(-o,-o,c,c,d):function(e,t,r,a){const i={x:-t,y:-t,height:r,width:r},o=a,c=a,d=a,n=a,{x:s,y:u,width:h,height:l}=i,p=s+h,T=u+l;e.moveTo(s+o,u),e.lineTo(p-c,u),e.quadraticCurveTo(p,u,p,u+c),e.lineTo(p,u+l-n),e.quadraticCurveTo(p,T,p-n,T),e.lineTo(s+d,T),e.quadraticCurveTo(s,T,s,T-d),e.lineTo(s,u+o),e.quadraticCurveTo(s,u,s+o,u)}(t,o,c,d)}particleInit(e,t){const r=t.shapeData;t.borderRadius=(0,a.getRangeValue)(r?.radius??5)*e.retina.pixelRatio}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Rounded Rect Shape v4.0.0-alpha.1 by Matteo Bruni */
package/browser/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { RoundedRectDrawer } from "./RoundedRectDrawer.js";
2
- export async function loadRoundedRectShape(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addShape(new RoundedRectDrawer(), refresh);
1
+ export function loadRoundedRectShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
5
+ e.addShape(new RoundedRectDrawer());
6
+ });
5
7
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/RadiusInfo.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/RectInfo.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoundedRectDrawer = 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 { drawRoundedRect } from "./Utils.js";
6
3
  const fixFactorSquare = 2, fixFactor = Math.sqrt(fixFactorSquare), double = 2, defaultRadius = 5;
7
- class RoundedRectDrawer {
4
+ export class RoundedRectDrawer {
8
5
  constructor() {
9
6
  this.validTypes = ["rounded-rect"];
10
7
  }
@@ -14,12 +11,11 @@ class RoundedRectDrawer {
14
11
  context.roundRect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter, borderRadius);
15
12
  }
16
13
  else {
17
- (0, Utils_js_1.drawRoundedRect)(context, fixedRadius, fixedDiameter, borderRadius);
14
+ drawRoundedRect(context, fixedRadius, fixedDiameter, borderRadius);
18
15
  }
19
16
  }
20
17
  particleInit(container, particle) {
21
18
  const shapeData = particle.shapeData;
22
- particle.borderRadius = (0, engine_1.getRangeValue)(shapeData?.radius ?? defaultRadius) * container.retina.pixelRatio;
19
+ particle.borderRadius = getRangeValue(shapeData?.radius ?? defaultRadius) * container.retina.pixelRatio;
23
20
  }
24
21
  }
25
- exports.RoundedRectDrawer = RoundedRectDrawer;
package/cjs/Utils.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drawRoundedRect = drawRoundedRect;
4
- function drawRoundedRect(ctx, fixedRadius, fixedDiameter, borderRadius) {
1
+ export function drawRoundedRect(ctx, fixedRadius, fixedDiameter, borderRadius) {
5
2
  const info = {
6
3
  x: -fixedRadius,
7
4
  y: -fixedRadius,
package/cjs/index.js CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadRoundedRectShape = loadRoundedRectShape;
4
- const RoundedRectDrawer_js_1 = require("./RoundedRectDrawer.js");
5
- async function loadRoundedRectShape(engine, refresh = true) {
6
- engine.checkVersion("3.9.1");
7
- await engine.addShape(new RoundedRectDrawer_js_1.RoundedRectDrawer(), refresh);
1
+ export function loadRoundedRectShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
5
+ e.addShape(new RoundedRectDrawer());
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.1
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_rounded_rect"] = this["webpackChunk_tsparticles_shape_rounded_rect"] || []).push([["dist_browser_RoundedRectDrawer_js"],{
19
+
20
+ /***/ "./dist/browser/RoundedRectDrawer.js"
21
+ /*!*******************************************!*\
22
+ !*** ./dist/browser/RoundedRectDrawer.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 */ RoundedRectDrawer: () => (/* binding */ RoundedRectDrawer)\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 fixFactorSquare = 2,\n fixFactor = Math.sqrt(fixFactorSquare),\n double = 2,\n defaultRadius = 5;\nclass RoundedRectDrawer {\n constructor() {\n this.validTypes = [\"rounded-rect\"];\n }\n draw(data) {\n const {\n context,\n particle,\n radius\n } = data,\n fixedRadius = radius / fixFactor,\n fixedDiameter = fixedRadius * double,\n borderRadius = particle.borderRadius ?? defaultRadius;\n if (\"roundRect\" in context) {\n context.roundRect(-fixedRadius, -fixedRadius, fixedDiameter, fixedDiameter, borderRadius);\n } else {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawRoundedRect)(context, fixedRadius, fixedDiameter, borderRadius);\n }\n }\n particleInit(container, particle) {\n const shapeData = particle.shapeData;\n particle.borderRadius = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.radius ?? defaultRadius) * container.retina.pixelRatio;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-rect/./dist/browser/RoundedRectDrawer.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 */ drawRoundedRect: () => (/* binding */ drawRoundedRect)\n/* harmony export */ });\nfunction drawRoundedRect(ctx, fixedRadius, fixedDiameter, borderRadius) {\n const info = {\n x: -fixedRadius,\n y: -fixedRadius,\n height: fixedDiameter,\n width: fixedDiameter\n },\n radius = {\n topLeft: borderRadius,\n topRight: borderRadius,\n bottomLeft: borderRadius,\n bottomRight: borderRadius\n },\n {\n x,\n y,\n width,\n height\n } = info,\n r = x + width,\n b = y + height;\n ctx.moveTo(x + radius.topLeft, y);\n ctx.lineTo(r - radius.topRight, y);\n ctx.quadraticCurveTo(r, y, r, y + radius.topRight);\n ctx.lineTo(r, y + height - radius.bottomRight);\n ctx.quadraticCurveTo(r, b, r - radius.bottomRight, b);\n ctx.lineTo(x + radius.bottomLeft, b);\n ctx.quadraticCurveTo(x, b, x, b - radius.bottomLeft);\n ctx.lineTo(x, y + radius.topLeft);\n ctx.quadraticCurveTo(x, y, x + radius.topLeft, y);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-rounded-rect/./dist/browser/Utils.js?\n}");
37
+
38
+ /***/ }
39
+
40
+ }]);
package/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { RoundedRectDrawer } from "./RoundedRectDrawer.js";
2
- export async function loadRoundedRectShape(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addShape(new RoundedRectDrawer(), refresh);
1
+ export function loadRoundedRectShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { RoundedRectDrawer } = await import("./RoundedRectDrawer.js");
5
+ e.addShape(new RoundedRectDrawer());
6
+ });
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-rounded-rect",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "tsParticles rounded rect 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.1"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"
107
- }
107
+ },
108
+ "type": "module"
108
109
  }